I managed to fix it using the thread I linked above. Specifically I did something similar to Darren's answer. I'll put it here for your convenience:
This is the best way:
http://github.com/guides/completely-remove-a-file-from-all-revisions
Just be sure to backup the copies of the files first.
EDIT
The edit by [Neon][1] got unfortunately rejected during review. See Neons post below, it might contain useful information!
[1]: https://stackoverflow.com/users/309261/neon
E.g. to remove all *.gz files accidentally committed into git repository:
$ du -sh .git ==> e.g. 100M $ git filter-branch --index-filter 'git rm --cached --ignore-unmatch *.gz' HEAD $ git push origin master --force $ rm -rf .git/refs/original/ $ git reflog expire --expire=now --all $ git gc --prune=now $ git gc --aggressive --prune=now
That still didn't work for me? (I am currently at git version 1.7.6.1)
$ du -sh .git ==> e.g. 100M
Not sure why, since I only had ONE master branch. Anyways, I finally got my git repo truely cleaned up by pushing into a new empty and bare git repository, e.g.
$ git init --bare /path/to/newcleanrepo.git $ git push /path/to/newcleanrepo.git master $ du -sh /path/to/newcleanrepo.git ==> e.g. 5M
(yes!)
Then I clone that to a new directory and moved over it's .git folder into this one. e.g.
$ mv .git ../large_dot_git $ git clone /path/to/newcleanrepo.git ../tmpdir $ mv ../tmpdir/.git . $ du -sh .git ==> e.g. 5M
(yeah! finally cleaned up!)
After verifying that all is well, then you can delete the ../large_dot_git and ../tmpdir directories (maybe in a couple weeks or month from now, just in case...)
In short: I filtered the branch, created a new bare repo, pushed the master to it, cloned it into a new directory and replaced my project's git directory with the git directory from the clone.
git gc --prune=now.--aggressiveto Gergo's commandmaster. Either way I've fixed it and added the solution to my question.