Changing the author of commits using a rebase

When I start working on a new project, I often forget to set my author name and author e-mail address for the specified project; therefore, I often have commits in my local branch that have been committed with the wrong username and/or e-mail ID. Unfortunately, I can't use the same account everywhere as some work with regards to my cooperate account still needs to be done; however, for most other parts, I can use my private account.

Getting ready

Before we begin this exercise, we need a branch, as always with Git. Name the branch resetAuthorRebase and make it track origin/master. Use the following command to achieve this:

$ git checkout -b resetAuthorRebase -t origin/master
Branch resetAuthorRebase set ...

Get Git: Mastering Version Control now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.