$ git commit --amend --author="Author Name <[email protected]>"
or
$ git commit --amend --reset-author
If you need to change the author for a commit older than the most recent, do a git rebase -i
. For example, if you wanted to change the penultimate commit, you'd run:
$ git rebase -i HEAD~2
Then choose e
or edit
next to the appopriate commit, then when it asks you to amend, run the same command as you would for the most recent commit:
$ git commit --amend --reset-author
Then, to finish, you'd run:
$ git rebase --continue
And you're done. Don't forget you'll have to --force
push if you've already pushed those commits to your remote.
This is a Solutions Log post.