441

I'd like to get the number of commits per author on all branches. I see that

git shortlog -s -n

Prints a very nice list but it is not counting the commits that are not yet merged from other branches. If iterate this command over every branch then obviously the common commits get counted multiple times. Could you give me a script/command that would yield me the overall picture?

2
  • 1
    Any way to include users who did not make commits? Show them as 0?
    – niken
    Oct 16, 2017 at 15:08
  • 25
    The problem is every programmer in the universe excluding the actual committers are potentially users with zero commit in your repo. So the list would be too long.
    – jabal
    Dec 7, 2017 at 20:26

1 Answer 1

878
git shortlog -s -n --all --no-merges

Will give you statistics for all branches.

EDIT: Added --no-merges to exclude statistics from merge commits.

8
  • 16
    If anyone also need emails then you can use -e command like this: git shortlog -s -n -e --all
    – Jaex
    Aug 8, 2016 at 17:49
  • 18
    if you need a time period, specify --since="22 Aug 2017"
    – mBardos
    Aug 30, 2017 at 10:54
  • 32
    @mBardos --since="22 Aug 2017" --before="01 Sept 2017" to get period Aug 31, 2017 at 1:04
  • 3
    @Kuncevic I meant period as a date from past till now ;)
    – mBardos
    Aug 31, 2017 at 8:17
  • 4
    Can this be filtered specific to any branch? Feb 5, 2018 at 15:29

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.