How to get (only) the author name or email address in git with SHA1?

I would like to check the author's email and first name, last name to check who clicked on my repo.

Is there a way that I can come up with a command in git to show the name / address of the commiter given only by the SHA1 commit?

This is what I came up with, but it is far from an ideal solution (the first solution for git hook, why it uses 2 SHA1 s rev-list. The second just uses git show):

git rev-list -n 1 --pretty=short  ccd3970..6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev
git show 6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev 
+4
source share
1 answer

You can use the following command:

 git log --format='%ae' HASH^!

git show, - , .

git show --format='%ae' HASH
+7

Source: https://habr.com/ru/post/1584722/


All Articles