Easily change the author of multiple git commits

Easily change the author of multiple git commits

If you need to standardise your commit author or just force new commits to trigger gpg-gigning this one-liner should do the job.

Some days you realise you messed up user.name or user.email in your commit history.

Or maybe you just want to commit a fresh bunch of commits to trigger gpg signing.

This is the easiest method I know.

Combining rebase’s --interactive and --exec options makes this really quick and easy.

Based on this StackOverflow:

# file: "run this in a terminal"
# change 'origin/master' to whichever SHA suits your needs
git rebase -i origin/master -x "git commit --amend --reset-author -CHEAD"

Attribution