Skip to content

Instantly share code, notes, and snippets.

@onwp
Created February 25, 2023 15:41
Show Gist options
  • Save onwp/0162cb8dfe0bb19d0076c00e67e49867 to your computer and use it in GitHub Desktop.
Save onwp/0162cb8dfe0bb19d0076c00e67e49867 to your computer and use it in GitHub Desktop.
Update your old email and name in commits.
git filter-branch --env-filter '
OLD_EMAIL="old@example.com"
NEW_NAME="New Author Name"
NEW_EMAIL="new@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$NEW_NAME"
export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment