Skip to content

Instantly share code, notes, and snippets.

@boseji
Created August 13, 2019 03:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boseji/62d72ffe8021847a095d862bd6573128 to your computer and use it in GitHub Desktop.
Save boseji/62d72ffe8021847a095d862bd6573128 to your computer and use it in GitHub Desktop.
Rename the Commiter and Email address in Git

Details

This command would alter the default committer name and email address for each of the commits.

This command uses the git filter-branch command.

$ git filter-branch --env-filter '
WRONG_EMAIL="wrong@example.com"
NEW_NAME="New Name Value"
NEW_EMAIL="correct@example.com"

if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$NEW_NAME"
    export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$NEW_NAME"
    export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

Credits to Original Source

https://www.git-tower.com/learn/git/faq/change-author-name-email

There are more interesting tutorials in the same site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment