Created
August 29, 2019 08:26
-
-
Save fbatiga/66ec191f31c6af00eaa4f35fe1a7d471 to your computer and use it in GitHub Desktop.
rewrite history to remove unwanted email adresses
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
| #!/bin/zsh | |
| echo "making commits from $1 anonymous" | |
| export OLD_EMAIL=$1 | |
| export CORRECT_NAME="Enyosolutions" | |
| export CORRECT_EMAIL="new@Email.com" | |
| echo $OLD_EMAIL | |
| git filter-branch -f --env-filter ' | |
| if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
| then | |
| echo "\n changing git commiter data" $OLD_EMAIL | |
| export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
| export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" | |
| fi | |
| if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] | |
| then | |
| echo "\n changing git author data" $OLD_EMAIL | |
| export GIT_AUTHOR_NAME="$CORRECT_NAME" | |
| export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" | |
| fi | |
| ' --tag-name-filter cat -- --branches --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment