Git - get rid of an unreachable commit
I am trying to clean up my repository and remove all unreachable ones.
I did
git reflog expire --expire=now --all
git fsck --full --unreachable
git repack -A -d
git gc --aggressive --prune=now
But I still have some commits unreachable from my understanding, but not git
I have a commit, say A
git branch --all --contains A
git tag --contains A
return nothing
but
git fsck --full --unreachable
also doesn't return anything, so it doesn't treat A as unreachable.
What am I missing?
+3
source to share
1 answer
Actually, I found it!
These are refs / original / mybranch , which still keep my commit available.
These original refs are created during git filter-branch
git branch --all
does not include them.
The reason I didn't find them at the beginning is because they were missing from the .git / refs / original folder .
I found them in the .git / packaged-refs file . I just removed those branches from this file and cleaned up the repository again.
+2
source to share