Created
October 15, 2021 15:40
-
-
Save paolobrasolin/a4c58a3f67e5feb15d1a79728496b3b4 to your computer and use it in GitHub Desktop.
Replace user/email in git history
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
#!/usr/bin/env bash | |
git filter-branch --env-filter ' | |
OLD_MAIL="[email protected]" | |
NEW_NAME="Paolo Brasolin" | |
NEW_MAIL="[email protected]" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_MAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$NEW_NAME" | |
export GIT_COMMITTER_EMAIL="$NEW_MAIL" | |
fi | |
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_MAIL" ] | |
then | |
export GIT_AUTHOR_NAME="$NEW_NAME" | |
export GIT_AUTHOR_EMAIL="$NEW_MAIL" | |
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