When starting to work on a new project, it is common to forget to set the author name and author email address for the specified project. Therefore, you will often have commits in your local branch that have been committed with the wrong username and/or email ID.
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'
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 rarely have to change the author of commits that have already been published to a remote repository.
You can change the author of the HEAD
commit by using git commit --amend...