Git Shortlog

View a breakdown of commits per user

May 30, 2021
Summary

To view a list of users and their commit count:

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

git shortlog summarizes the output from git log, grouping each commit by user:

git shortlog
anotheruser (1):
  Fix bug
 
ninest (5):
  First commit
  Second commit
  Update README
  Add contributors
  Publish

Options

--numbered, -n

Sort by number of commits per user:

git shortlog -n
ninest (5):
  First commit
  Second commit
  Update README
  Add contributors
  Publish
 
anotheruser (1):
  Fix bug

--summary -s

Only provide the commit count of each user.

git shortlog -s
  1 anotheruser
  5 ninest

View more options on the documentation for git shortlog.

Breakdown of commits per user

Use the command

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

--no-merges ensures that merge commits are not counted.

The output of the command looks like

git shortlog -s -n --all --no-merges
  5 ninest
  1 anotheruser