Pages

Showing posts with label filter-branch. Show all posts
Showing posts with label filter-branch. Show all posts

26 February, 2013

Removing secrets from git's history

If you are ever going to do as stupid thing as I did last time -- commit username and password to public git, here is a short demonstration how to get rid of it:
Remove all the lines that contains "string" [1]:
git filter-branch -f --tree-filter "find . -type f -exec sed -i -e '/$*string/d' {} \;"

Reference

[1] -- tutorial for usage of git filter-branch
[2] -- official article on github