I can't say for sure without access to your repository data, but I believe there are probably one or more packed refs still referencing old commits from before you ran git filter-branch
. This would explain why git fsck --full --unreachable
doesn't call the large blob an unreachable object, even though you've expired your reflog and removed the original (unpacked) refs.
Here's what I'd do (after git filter-branch
and git gc
have been done):
1) Make sure original refs are gone:
rm -rf .git/refs/original
2) Expire all reflog entries:
git reflog expire --all --expire='0 days'
3) Check for old packed refs
This could potentially be tricky, depending on how many packed refs you have. I don't know of any Git commands that automate this, so I think you'll have to do this manually. Make a backup of .git/packed-refs
. Now edit .git/packed-refs
. Check for old refs (in particular, see if it packed any of the refs from .git/refs/original
). If you find any old ones that don't need to be there, delete them (remove the line for that ref).
After you finish cleaning up the packed-refs
file, see if git fsck
notices the unreachable objects:
git fsck --full --unreachable
If that worked, and git fsck
now reports your large blob as unreachable, you can move on to the next step.
4) Repack your packed archive(s)
git repack -A -d
This will ensure that the unreachable objects get unpacked and stay unpacked.
5) Prune loose (unreachable) objects
git prune
And that should do it. Git really should have a better way to manage packed refs. Maybe there is a better way that I don't know about. In the absence of a better way, manual editing of the packed-refs
file might be the only way to go.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…