Git

How to See the Original Author of a Commit?

On Git, many developers work together on the same project. They can use the same account with different profiles. All the commits made by each developer get saved by their username and email. Users can modify the author of commits using different Git commands. However, you can view the original author of the commit whenever you want.

This study will illustrate the method to view the original author of a particular commit.

How to See/View the Original Author of a Particular Commit?

To view the original author of a commit, try out the provided steps:

    • Redirect to the local repository.
    • View the commit history and choose desired commit id.
    • See the author of the specific commit using the “git show <commit-id>” command.

Step 1: Navigate to Local Repository

First, write out the following command and switch to the local repository:

cd "C:\Git"

 
Step 2: View Git Log

Next, view the commit history using the below-provided command:

git log --oneline

 
In the below screenshot, all the commit history can be seen. Now, choose the desired commit id whose author’s details you want to see. For instance, we have selected the “60f911d” commit hash:


Step 3: See Author of Commit

To see the original author of the desired commit, utilize the “git show” command with the selected commit id:

git show 60f911d

 
The below-provided output shows the author name and email of the specific commit:


Moreover, the “–format= “%aN <%aE>”” options can also be used with the “git show” command to view the original author of a commit:

git show --format="%aN <%aE>" 60f911d

 
Here, the “N” option displays the author of the commit, and “E” is utilized to show the email of the author:


We have efficiently explained the procedure of viewing the original author of a particular commit.

Conclusion

To view the original author of a commit, first, redirect to the local repository. Then, check the Git log to view the commit history. Next, choose the desired commit id and execute the “git show <commit-id>” command. Moreover, the “–format= “%aN <%aE>”” option can also be used with the same command to perform the same operation. This study illustrated the method to view the original author of a particular commit.

About the author

Laiba Younas

I have done bachelors in Computer Science. Being passionate about learning new technologies, I am interested in exploring different programming languages and sharing my experience with the world.