completely remove a file from all revisions

If you've added a file to a .gitignore list and it still shows up for commits, you can ignore it from that point on by removing it with this:

git rm --cached <file>

If you find a file that should never have been committed into the repo, you need to do more than this. Adding the file to a .gitignore list doesn't get rid of it for you, and you want the file to disappear from everything. (probably a good idea to back up repo before doing this)

method 1

git filter-branch --index-filter 'git rm --cached <file>' HEAD

method 2

git filter-branch -f --index-filter 'git update-index --remove filename' HEAD