GIT – Change author or committer

If you want to change author’s and/or committer’s name and/or email in given GIT revisions, you can use the following script:

git filter-branch -f --commit-filter '
  if [ "$GIT_AUTHOR_NAME" = "Old Author" ];
  then
    export GIT_AUTHOR_NAME    = "New Author";
    export GIT_AUTHOR_EMAIL   = "new_author@example.com";
    export GIT_COMMITER_NAME  = "New Author";
    export GIT_COMMITER_EMAIL = "new_author@example.com";
  fi;
  git commit-tree "$@"'

Now update the remote (bare) repository

git push --force --tags origin 'refs/heads/*'

Leave a Reply