Welcome to End Point’s blog

Ongoing observations by End Point people

Git commits per contributor one-liner

Just for fun, in the Spree Git repository:

git log | grep ^Author: | sed 's/ <.*//; s/^Author: //' | sort | uniq -c | sort -nr
    813 Sean Schofield
     97 Brian Quinn
     81 Steph (Powell) Skardal
     42 Jorge Calás Lozano
     37 paulcc
     27 Edmundo Valle Neto
     16 Dale Hofkens
     13 Gregg Pollack
     12 Sonny Cook
     11 Bobby Santiago
      8 Paul Saieg
      7 Robert Kuhr
      6 pierre
      6 mjwall
      6 Eric Budd
      5 Fabio Akita
      5 Ben Marini
      4 Tor Hovland
      4 Jason Seifer
      2 Wynn Netherland
      2 Will Emerson
      2 spariev
      2 ron
      2 Ricardo Shiota Yasuda
      1 Yves Dufour
      1 yitzhakbg
      1 unknown
      1 Tomasz Mazur
      1 tom
      1 Peter Berkenbosch
      1 Nate Murray
      1 mwestover
      1 Manuel Stuefer
      1 Joshua Nussbaum
      1 Jon Jensen
      1 Chris Gaskett
      1 Caius Durling
      1 Bernd Ahlers


Anonymous said...

I've been doing this recently (to rewrite git-svn imports). I raise you:

git for-each-ref --format='%(objectname)' |while read r; do git log --pretty=format:%an "$r"; echo; done |sort |uniq -c |sort -n

Jon Jensen said...


Your method was about 8x slower in my initial tests, but I found that's because it's gathering data from all branches in the repo, not just the current branch as my method does.

Once I removed all but one branch, your method is slightly faster on average (about 0.10 vs 0.12 seconds per run).

Robin said...

In case you didn't know, that's exactly what "git shortlog" does:

git shortlog -sn

Jon Jensen said...

Robin, thanks for the tip. I was only familiar with git shortlog's full output format. The -sn options are handy.