Skip to content

Instantly share code, notes, and snippets.

@fujimaki-k
Created November 5, 2017 10:08
Show Gist options
  • Save fujimaki-k/ec413160555c75130cdf20c65c200889 to your computer and use it in GitHub Desktop.
Save fujimaki-k/ec413160555c75130cdf20c65c200889 to your computer and use it in GitHub Desktop.
Change git author and commiter
EMAIL="OLD@EMAIL"
GIT_NAME="NEW NAME"
GIT_EMAIL="NEW@EMAIL"
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "$EMAIL" ];
then
GIT_AUTHOR_NAME="$GIT_NAME";
GIT_AUTHOR_EMAIL="$GIT_EMAIL";
GIT_COMMITER_NAME="$GIT_NAME";
GIT_COMMITER_EMAIL="$GIT_EMAIL";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment