And:
I want to delete some garbarge large file from git repository, Then
Long to short
Why file that deleted still show in git rev-list --all --objects and can be show git show xxxxxx
Full version:
Omit a really long time for research, Demo below is unrealistic, I use this demo to show how wrong it gose: Even delete everything except .gitignore.
PS: I'm using linux and tmpfs for speedup
First I use
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch *' HEAD
As it design, This only affect git but the file. So file still there by ls (for HEAD^)
Then, I tried
git filter-branch -f --tree-filter 'rm -rf *' HEAD
Much slower, But all file is deleted. Except .gitignore . But repo size is not decrease.
Then, there are variation:
I use those command to delete all un-ref file.
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --aggressive --prune=now
Here is things go wrong. Size is not shrink. And git rev-list --all --objects and can still show file content with git show xxxxxx.
So file can be show mean the file is not deleted.
Question: What I missed? How to really delete a file from an repo? (Include all commit, all ref, all history, all content, just like never happen)