Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I list contributors in a Git repo with dates active?

Tags:

git

I'd like to get a list of all contributors to some Git repository. For each contributor I'd also like to print out their earliest and latest commit timestamp. Is there a way to extract this information using git's command line?

like image 610
user180940 Avatar asked Sep 02 '25 15:09

user180940


2 Answers

This will give you the list you asked for, with author email and author date.

git log --pretty=format:"%ae %ai" | sort | awk 'contributor == $1 { lastContribution = $0 } contributor != $1 { contributor = $1; if (lastContribution) print lastContribution; print } END { print lastContribution }'

If you want committer email or commit date instead, replace %a with %c.
If you want name instead of email, replace %ae by %an.

like image 108
Vampire Avatar answered Sep 05 '25 06:09

Vampire


To show all users and the number of commits you can use:

git shortlog -sn

and you can use the output to get informations about each author via:

git log --author=<pattern> 
like image 43
S.Spieker Avatar answered Sep 05 '25 06:09

S.Spieker