Command Reference

git-shortlog Tutorial

Explains how to use git-shortlog to summarize commit history by author and subject.

Who This Is For
  • Developers who already know basic commit and branch actions
  • Readers who want to understand command boundaries and risk
Prerequisites
  • A basic mental model of worktree, index, and commits
  • Comfort reading `git status` and a small commit graph
Common Risks
  • 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.0 to generate a contributor list sorted by commit count for the release notes.
  • Review a version's changes with git shortlog --no-merges to filter out merge commits and see only actual code contributions.
  • Use git shortlog -sne to display author names, emails, and commit counts together for contributor reports.

Diagram view

Commit summarization by authorshortlog reads commit history, groups by author, and summarizes commit subjects into a human-readable report format.
Commit history
Commit recordsAuthor infoCommit subjectsCommit range
Output
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 shortlog reads from stdin by default (commonly used in a pipe like git log | git shortlog). If run directly without a tty it may produce no output. When running directly, add a commit range like HEAD or v1.0..v2.0.
  • It only reads commit history and does not modify anything in the repository — it is a purely read-only command.
  • With -s only 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 via git log --no-merges | git shortlog).