Reclaim space after aborted git add?
I accidentally git added a large (32GB) file to my staging area. After a handful of seconds I noticed (my fans spun up!) and hit CTRL+C. This stopped the process but the ~2GB of space it had used has not been returned to the file system.
How can I reclaim that space? Not that I’m short of a gig or two but having big useless clots of data knocking around somewhere (presumably in my .git folder) bothers me.
I’ve looked a git clean but that doesn’t look like it will help.
The files it has added are…
1.9G ./objects/pack 1.9G ./objects/pack/tmp_pack_lwma1r
Can I safely delete these?
One Solution collect form web for “Reclaim space after aborted git add?”
git reflog expire --expire=now --all git fsck --full --unreachable git repack -A -d git gc --aggressive --prune=now
This will do a bunch of cleaning on the repo. Specifically, I think
git repack is the one that will really solve your problem. The others won’t hurt, though.