Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show top n most active committers in a git repository

Tags:

git

I use git shortlog -s -n --all to show all the contributors in a git repository.

 18756  Someone   
  6604  Someone Else  
  6025  Etc     
  5503  Another Committer     
  5217  And So On

I wonder if there is an option to show first n contributors. For example:

git shortlog -s -n --all --some-option 3

And the output will be:

18756  Someone   
 6604  Someone Else  
 6025  Etc     

A solution would be use Unix pipes and head:

git shortlog -s -n --all | head -3

...but if there is a built-in

like image 265
Ionică Bizău Avatar asked Jul 08 '15 09:07

Ionică Bizău


People also ask

How do I find my top contributors on GitHub?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Insights. In the left sidebar, click Contributors.

What does -- Oneline do in git?

Git Log Oneline The oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.


1 Answers

There isn't a way of doing this with the native git shortlog command. It's usually used to generate a contributors list between releases rather than a top n statistic.

Your approach of using pipes is likely to be the most efficient way of solving the problem; you could also use a script or git alias to do the same thing.

like image 185
AlBlue Avatar answered Nov 15 '22 14:11

AlBlue