As mentioned in the Git FAQ (and this SO question), the idea is:
- Create new temporary branch,
- rewind it to the commit you want to change using git reset --hard,
- change that commit (it would be top of current head, and you can modify the content of any file),
- then rebase branch on top of changed commit, using
git rebase --onto <tmp branch> <commit after changed> <branch>
.
The trick is to be sure the information you want to remove is not reintroduced by a later commit somewhere else in your file.
If you suspect that, then you have to use filter-branch --tree-filter
to make sure the content of that file does not contain in any commit the sensible information.
In both case, you end up rewriting the SHA1 of every commits, so be careful if you have already published the branch you are modifying the content of.
You probably shouldn’t do it unless your project isn’t yet public and other people haven’t based work off the commits you’re about to rewrite.