Skip to content

Instantly share code, notes, and snippets.

@tjbenton
Last active August 29, 2015 14:21
Show Gist options
  • Save tjbenton/488b5a39143df94aca65 to your computer and use it in GitHub Desktop.
Save tjbenton/488b5a39143df94aca65 to your computer and use it in GitHub Desktop.
Change the author or several commits to be under a new author. This is useful if you accidentally commit under a different name/email.
# found in http://stackoverflow.com/questions/750172/change-the-author-of-a-commit-in-git#answer-870367
# you may get errors
# if so just use `--force`
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_NAME" = "<Old name>" ]; then
GIT_COMMITTER_NAME="<New name>";
GIT_COMMITTER_EMAIL="<New email>";
GIT_AUTHOR_NAME="<New name>";
GIT_AUTHOR_EMAIL="<New email>";
fi' -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment