2015-12-07

A reminder for myself of how I use git filter-branch to remove files from git history

It's all about the git "filter-branch" command

To keep things clean, I'll make a new file that contains a space-separated list of files i want to remove:
lets call it files_to_rm and put it on my desktop with the following contents
public/api/docs/dist/css/print.css public/api/docs/dist/css/reset.css

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch `cat ~/Desktop/files_to_rm`" HEAD

And then after this, you'll need to do a force push of course, because you've altered history.