No bizarre need with a filter-branch - it's just in one recent commit. If not, just delete the file ( git rm --cached <filename> ) and fix the commit ( git commit --amend ). The --cached option tells git to remove only the copy in the index (commit execution area) and leave the version in the work tree intact.
If this is even deeper in history, you can use interactive rebase ( git rebase -i <commit before the bad one> master ), select edit bad commit and rm / modify as before. Be sure to add it to your gitor too, of course.
Please note that if you have already clicked on this commit, you will need to use push -f to get an immediate fast forward, and if someone else pulled it, they will be annoyed (see the “Recovery from upstream” section on page git-rebase guides.
source share