Created
August 7, 2018 06:21
-
-
Save mLuby/6e5f3192e423ffb45947ed3b6dc8b514 to your computer and use it in GitHub Desktop.
replace word in git history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git co master && git branch -D master-backup ; git co -b master-backup && git co master | |
ls -ra db/ | grep -E '\.![0-9]+\!' # should return no results | |
cat known/location/of/secret | grep secret # should return results | |
LC_CTYPE=C && LANG=C && git filter-branch --tree-filter "find . -type f -exec sed -i '' -e 's/secret/replacement/g' {} \;" -f | |
ls -ra db/ | grep -E '\.![0-9]+\!' # should return no results | |
cat known/location/of/secret | grep secret # should return no results | |
git filter-branch --tree-filter "grep -r 'secret' * || true" | |
git push -f origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment