The .git/objects in my rails project directory is still massive, after deleting hundreds of Megabytes of accidentally generated garbage.
I have tried git add -A, as well as other commands to update the index and remove nonexistent files. I gather, perhaps incorrectly, that the files with two character names in the directory are blobs. I have tried rolling back to previous commits, but no luck.
What can I do to clean this directory?
If you added the files and then removed them, the blobs still exist but are dangling.
git fsckwill list unreachable blobs, andgit prunewill delete them.If you added the files, committed them, and then rolled back with
git reset --hard HEAD^, they’re stuck a little deeper.git fsckwill not list any dangling commits or blobs, because your branch’s reflog is holding onto them. Here’s one way to ensure that only objects which are in your history proper will remain:Another way is also to clone the repository, as that will only carry the objects which are reachable. However, if the dangling objects got packed (and if you performed many operations, git may well have packed automatically), then a local clone will carry the entire packfile:
You must specify a protocol to force git to compute a new pack: