1

I have been browsing Git Basics - Viewing the Commit History as well as Git Tools - Searching and while most of the ways seem straight-forward I have been trying to figure out if there was a way to figure out the author who has done the most commits or/and the committers who has done most of the commits in a porject.

I am sure there would be some ways like -

  1. Find the author who has done the most commits in a project.

  2. find the authors who have done the most commits in a descending manner.

  3. Find committers who have done the most commits in a project

and things like that. It could make for some interesting analysis of a project's state per se.

Do people have any idea what could be done in the above instance?

I am on Debian buster.

3
git log --pretty=format:%aN | sort | uniq -c | sort -n

git log --pretty=format:%aN outputs just the author name for every commit. sort collects all the repeated names together, then uniq -c turns each run of equal lines into the number of repetitions and the value, before sorting numerically. You can take the last line (tail -n 1) to find the most prolific, reverse the sort (sort -nr) for descending, or whatever other processing you like.

3

There is a Git command specifically made for this purpose.

git shortlog --numbered --summary

or simply:

git shortlog -ns

See the manpage git-shortlog(1) for more details.

1

You could write your own tool to parse the git log, or you could use a tool such as GitStats which will produce a report listing, amongst other things, the top committers; see for example this old report on the Linux kernel.

There are also services which will add analytics to projects; see for example Bitergia, which produces this sort of Kibana front-end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.