We have a git repo of 500MB large. Now it turns out that somewhere in the history a few unneeded files of 50MB - 75MB were added and removed after. To make the repo smaller I've decided to rewrite the history by removing the files from their commits.
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch Projects/largefile.xml" HEAD
git push -f
The files are gone indeed but it seems the .git directory has not gotten smaller. Does it help to do this? How can we make a git repo as small as possible?