Following situation: I have a git repo with a lot of commits, and I want to remove a file that was introduced in a commit changed in a few and finally deleted in a commit. So now I want to remove the commit completely from my repo and therefore did:
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch UNWANTED_FILE' --prune-empty --tag-name-filter cat -- --all
git push -f origin master
This worked great and my history was rewritten (several commits were rewritten. However:
git log --all -- UNWANTED_FILE
I still get two entries showing up, namely the commits were nothing else than removing the file and adding the file was done.
Alll the other commits were other things were done as well are completely gone. How can I remove the last traces of these commits as well?