Skip to content

Instantly share code, notes, and snippets.

@marcelosantos
Last active May 15, 2017 13:09
Show Gist options
  • Save marcelosantos/bbc63b2dcff157b66baa7b7c03600368 to your computer and use it in GitHub Desktop.
Save marcelosantos/bbc63b2dcff157b66baa7b7c03600368 to your computer and use it in GitHub Desktop.

To change the author only for the last commit:

git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit

Suppose you only want to change the author for the last N commits:

git rebase -i HEAD~4 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"

NOTES

the --no-edit flag makes sure the git commit --amend doesn't ask an extra confirmation

when you use git rebase -i, you can manually select the commits where to change the author,

the file you edit will look like this:

pick 897fe9e simplify code a little
pick abb60f9 add new feature
exec git commit --a

Based on http://stackoverflow.com/questions/4981126/how-to-amend-several-commits-in-git-to-change-author

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