Skip to content

Instantly share code, notes, and snippets.

@lifuzu
Created April 13, 2016 17:11
Show Gist options
  • Save lifuzu/145fb2251bf867bd789085df9746c3cc to your computer and use it in GitHub Desktop.
Save lifuzu/145fb2251bf867bd789085df9746c3cc to your computer and use it in GitHub Desktop.
Update email and user name in the git history
git filter-branch -f --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" -o "$GIT_AUTHOR_EMAIL" = "[email protected]" ];
then
GIT_AUTHOR_NAME="User Name";
GIT_AUTHOR_EMAIL="[email protected]";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
# Reference:
# http://git-scm.com/book/en/Git-Tools-Rewriting-History
@lifuzu
Copy link
Author

lifuzu commented Apr 13, 2016

git commit --amend --no-edit --author="User Name <[email protected]>"

http://stackoverflow.com/questions/3042437/change-commit-author-at-one-specific-commit

If only the latest one.

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