user180940
user180940

Reputation: 354

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

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?

Upvotes: 4

Views: 1377

Answers (2)

Vampire
Vampire

Reputation: 38669

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.

Upvotes: 4

S.Spieker
S.Spieker

Reputation: 7365

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> 

Upvotes: 2

Related Questions