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
Choosing the Right Option
shortlog vs log
Grouping
| Command | Grouped by |
|---|---|
git log --oneline | Time (newest first) |
git shortlog | Author |
Examples
By author
git shortlogEvery author with their commit subjects.
Ranking
git shortlog -snCommit counts, most active first.
Since a release
git shortlog v1.0..HEADWho did what since v1.0 — release notes.
Workflow Examples
1
git shortlog v1.0..v1.1Changes grouped by author
2
git shortlog -sn v1.0..v1.1Thank 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.