Skip to content

Instantly share code, notes, and snippets.

@carlosame
Created April 10, 2026 16:18
Show Gist options
  • Select an option

  • Save carlosame/56a65f40c0a3d99df686a1ce4d031ebc to your computer and use it in GitHub Desktop.

Select an option

Save carlosame/56a65f40c0a3d99df686a1ce4d031ebc to your computer and use it in GitHub Desktop.
Change the author of a commit

Changing the author of a commit is often useful when backporting commits in a project fork (e.g. applying Batik commits to EchoSVG). For example, to change the author of the last two commits ("1" and "2"), first run:

git rebase -i HEAD~2

In the subsequent edit session, change the commands from pick to e. Then run

git commit --amend --author="Commit 1 Author <commit-1-author@example.com>" --no-edit

where the --no-edit prevents modification of the commit message. Now:

git rebase --continue
git commit --amend --author="Commit 2 Author <commit-2-author@example.com>" --no-edit
git rebase --continue

And the change is done.

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