- Developers who already know basic commit and branch actions
- Readers who want to understand command boundaries and risk
Command Reference
git-shortlog Tutorial
Explains how to use git-shortlog to summarize commit history by author and subject.
- A basic mental model of worktree, index, and commits
- Comfort reading `git status` and a small commit graph
- Using local cleanup commands on already shared history
- Continuing to rewrite before confirming a recovery path
The short version
git-shortlog is used to summarize commit history by author and subject.
When it is a good fit
- when you need to summarize commit history by author and subject
- when you want this step to be repeatable instead of ad hoc
- when you need a clearer mental model of what Git is recording or updating
Basic example
git shortlog -sn
What to watch most closely
Learn the default behavior first. Many surprises come from adding flags before the base behavior is clear.
A safer working habit
Pair it with status, log, or diff so you can confirm what actually changed.
Useful angles for understanding it
- Understand the default behavior clearly
- Use it in day-to-day Git routines
- Reuse it safely in scripts or team habits
Related reading
Read it alongside git status, git log, and git show so it is easier to see how the command changes history, refs, the index, or the working tree.
What problem this command solves in a workflow
git shortlog solves the problem of "I need commit information grouped by author." It takes git log output, groups commits by author, and counts them — suitable for generating release notes, contributor lists, or team workload statistics.
Typical use cases
- When releasing a new version, use
git shortlog -sn v1.0..v2.0to generate a contributor list sorted by commit count for the release notes. - Review a version's changes with
git shortlog --no-mergesto filter out merge commits and see only actual code contributions. - Use
git shortlog -sneto display author names, emails, and commit counts together for contributor reports.
Diagram view
Commit recordsAuthor infoCommit subjectsCommit range
Grouped by authorCommit count statsSummarized commit subjects
shortlog output can be used directly in release notes, but by default it reads from stdin — add a commit range like HEAD or v1.0..v2.0 when running directly.
Special cases and boundaries
git shortlogreads from stdin by default (commonly used in a pipe likegit log | git shortlog). If run directly without a tty it may produce no output. When running directly, add a commit range likeHEADorv1.0..v2.0.- It only reads commit history and does not modify anything in the repository — it is a purely read-only command.
- With
-sonly the count is shown; without it, each commit's subject line is also displayed. - Merge commits are also counted; to exclude them, pair with
--no-merges(usually viagit log --no-merges | git shortlog).