May 4, 2012

Git :: Removing files from all commits

Alright… this is just a tiny hint on the process I used to nuke some committed files from all commit history git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch my_files" HEAD rm -rf .git/refs/original/ git reflog expire --all git gc --aggressive --prune git push origin +master And here comes the explanation: git filter-branch –index-filter “git rm -rf –cached –ignore-unmatch my_files” HEAD Our action is to rewrite our branch, hence we need to use the top level “filter-branch” command. ... Read more