Created
August 18, 2020 18:14
-
-
Save JosephGaiser/216f919ab685d4258c686dbaa77667c0 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