git shortlog

Inspection & Comparison

Summarize the history by author


The 'git shortlog' command groups commits by author: each author with their number of commits and the commit subjects. It is used for release notes and contributor lists. With -s only the counts are shown, -n sorts by number of commits and -e adds emails. In a terminal it summarizes the current branch; in scripts, name the revision (git shortlog HEAD).

Synopsis

git shortlog [<options>] [<revision-range>] [[--] <path>...]
[ ] optional| or<arg> placeholder... repeatable--flag option

Options

Click any option to expand

Beginner (3)

Show only the number of commits per author.

RecommendedOne line per author with the number of commits

Example

git shortlog -s

Sort authors by number of commits instead of by name.

RecommendedRank authors by number of commits

Example

git shortlog -sn

Show each author’s email address.

When neededTell authors with the same name apart

Example

git shortlog -sne

Choosing the Right Option

shortlog vs log

Grouping

CommandGrouped by
git log --onelineTime (newest first)
git shortlogAuthor

Examples

By author

git shortlog

Every author with their commit subjects.


Ranking

git shortlog -sn

Commit counts, most active first.


Since a release

git shortlog v1.0..HEAD

Who did what since v1.0 — release notes.

Workflow Examples

1
git shortlog v1.0..v1.1

Changes grouped by author

2
git shortlog -sn v1.0..v1.1

Thank the contributors

Troubleshooting

No output

Cause: Not in a terminal, so shortlog reads stdin

Give a revision: git shortlog HEAD

Tips & Pitfalls

Best Practices

  • ✓Keep a .mailmap so one person is counted once.

Common Mistakes

  • ✗Getting empty output in a script: without a revision, shortlog reads from stdin there — pass HEAD.
  • ✗Counting the same person twice because they used two emails — add a .mailmap file.

FAQ

A:

Yes, unless you add --no-merges.