I've a large blob that I want to get rid of!
I thought I removed the file using this solution:
http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
(I've used -- --all
instead of HEAD
so that files are removed from all branches)
rm -rf .git/refs/original/ && git reflog expire --all &&
git gc --aggressive --prune
I've looked in the pack folder via this Why is my git repository so big?
$ git verify-pack -v .git/objects/pack/pack-*.idx | sort -k3n
... last 4 lines:
bc7ae9801052180b283cd81880753549f0f92587 blob 19464809 749446 305054873
acd5f09a35846bec25ebc324738139e5caabc50f blob 294278199 71381636 39607483
986d152935434b56cf182d8a32e24cb57af75ac3 blob 480385718 108184804 110989119
ba9d1d27ee64154146b37dfaf42ededecea847e1 blob 761172819 27430741 277589990
The script git-find-blob
is taken from Which commit has this blob?
$ ./git-find-blob ba9d1d27ee64154146b37dfaf42ededecea847e1
But it doesn't find anything.
Any ideas how to get rid of it from my repository?
You can use git repack -Ad
to force git to reconstruct your packs, and to unpack any unreachable objects into loose objects. At this point you can use git gc --prune=now
to discard the unreachable objects.
You should also double-check that you actually expired your reflogs. I believe git reflog expire --all
will default to 90 days (or 30 for unreachable objects), so you may want to use git reflog expire --expire-unreachable=now --all
instead (this needs to be done before the repack+gc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With