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 up to track remote branch master from origin. Switched to a new branch 'resetAuthorRebase'
How to do it...
Now, we want to change the author of all the commits from origin/stable-3.2
to our HEAD
, which is master
. This is just an example; you will...