Steps to Change Author and Committer Info

The `git commit –amend` is useful to correct the recent commits. This command allows you to modify the commit message and committer and author information.

We will use a combination of commit amend and interactive rebase like `git commit –amend` and `git rebase -i` to change the commit metadata.

Step 1: Interactive rebase including all commits

We will performance interactive rebase with –root in the current branch. The –root means it starts from the initial commit. This command opens an editor with a list of all commits from the current branch history.

git rebase -i --root

Interactive Rebase

Step 2: Select commits

The below image shows list of command and change “pick” to “edit” for commits you want to perform amend (modification).

Commit list pick and edit

Step 3: Amend commits

The amend command is use to modify commit. This modification includes commit name and metadata. The metadata includes author and committer name.

The Git pauses on each commit you selected as “edit“. You need include author name and email with amend command.

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

The “–no-edit” will not populate the window to modify the commit message. If you want to edit commit message then skip “–no-edit“.

After perform amend continue the rebase process by entering below command.

git rebase --continue

Repeat the step for each commit you have selected for “edit“.

The below image show amend with author name and email with continue rebase.

Amend commit

Step 4: Complete the rebase

When all commits are amended, the rebase will finish and applying all changes across all the specified commits.

Commit logs

By following these steps we will able to change the author and committer name/email for multiple commits.


How to Change Author and Committer Info for Multiple Git Commits?

When we are working with Git, the changed history does not preserve the commits but the metadata that is attached to each commit. The metadata includes the author and committer name and email. Sometimes, due to misconfiguration of Git causes incorrect details of the committer and author for not one commit but for all commits. In this article, we’ll explore how to change the author and committer name/email for multiple commits.

Similar Reads

What is Git commit?

In the Git commits, we have metadata including information on committer and author....

Steps to Change Author and Committer Info

The `git commit –amend` is useful to correct the recent commits. This command allows you to modify the commit message and committer and author information....