git: filter out a file from a branch

If you want to completely remove a file from the history of a branch in git, do this:

 

git filter-branch --index-filter \
'git rm --cached --ignore-unmatch <file>'

Leave a Reply

Your email address will not be published. Required fields are marked *