Git: Reset Author of Previous Commits

If you created commits without setting your username and eMail correctly, you want to change those commits. Git offers you the –reset-author feature. Without any additional effort, this feature only applies to the latest commit. What you could do is:

$ git log                          # Check which commits you want to change
$ git rebase -i                    # Rebase all commits since the last push/pull

You can also append a commit hash after rebase command to rebase up to a specific commit:

git rebase -i aba44192a4

After calling the rebase command, an editor should open showing you the latest commits. Each commit is prefixed with a command that git should execute them during the rebase. You have to replace the „pick“ through a „edit“ or just „e“ if you want to reset the author of that commit. Now close the editor and wait until git is ready. It will prompt you with something like:

Stopped at bb44b3177d3cd836a6fa1c52618f0701747de77e... Added some new questions
You can amend the commit now, with
        git commit --amend
Once you are satisfied with your changes, run
        git rebase --continue

Now you want to run the reset-author command and continue to rebase until all commits are done:

$ git commit --amend --reset-author
$ git rebase --continue

Git then responds with „Successfully rebased and updated refs/heads/master.“ You can verify the correct author information using „git log“ again.