1

I'm doing a Git repository viewer, and I need to get the name of the repository author and email.

The following command returns me the author of a commit.

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

I need it to return the author of the repository.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
BernardoGO
  • 1,826
  • 1
  • 20
  • 35
  • I think the author that you mention refers to the repository owner. The git repository itself does not store any infomation about the owner. And the owner could be a team instead of one person. Although it's not always true, we can still assume the root commit is made by the repository owner. `git log --max-parents=0 --format="%an <%ae>"`. Note that the branch may have more than one root commit. – ElpieKay May 16 '17 at 05:38

1 Answers1

1

Git does not store any meta data for the owner of the repository. But you can list the commits in ascending order time with:

git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n

Please refer to Find out a Git branch creator.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Abc_omega
  • 11
  • 3