Created
August 18, 2020 18:14
-
-
Save JosephGaiser/8225c339ba83ad42a690aed1180ee228 to your computer and use it in GitHub Desktop.
Rewrite history to remove any sensative data without deleteing files
This file contains 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
# Sync with the remote master | |
git pull | |
# Force your clone to look like HEAD | |
git reset --hard | |
# AGAIN, A WARNING: This can really break stuff! | |
# Run your filter branch command, replacing all instances of "password" with "your_password" | |
# The example looks for Ruby files ("*.rb"), you can change this to match your needs | |
git filter-branch --tree-filter 'git ls-files -z "*.rb" |xargs -0 perl -p -i -e "s#(password)#your_password#g"' -- --all | |
# Overwrite your master with local changes | |
git push origin master --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
credit: https://gist.github.com/palexander/1375271#file-gistfile1-sh