Skip to content

Instantly share code, notes, and snippets.

@mavaji
Last active April 17, 2022 05:57
Show Gist options
  • Select an option

  • Save mavaji/4acdac3bd46f2a6fc79eaf3cbdf362d0 to your computer and use it in GitHub Desktop.

Select an option

Save mavaji/4acdac3bd46f2a6fc79eaf3cbdf362d0 to your computer and use it in GitHub Desktop.
Change Git Author Commiter
git filter-branch --env-filter '
OLD_EMAIL="old_email"
CORRECT_NAME="Author Name"
CORRECT_EMAIL="new_email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' -f --tag-name-filter cat -- --branches --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment