# git shortlog: Usage, Options & Common CI Errors

> git shortlog summarizes commits grouped by author, perfect for changelogs and release notes. Reference for -s, -n, -e, ranges, and mailmap grouping in CI.

Source: https://latchkey.dev/learn/command-reference/git-shortlog  
Updated: 2026-06-25

git shortlog groups commit subjects by author - the fast way to build contributor lists and changelogs.

shortlog is git log shaped for release notes. Pair it with a range and a mailmap for clean output.

## What it does

git shortlog summarizes git log output by author, listing each author and the subject lines of their commits, optionally counting instead of listing.

## Common usage

```Terminal
git shortlog -sn              # authors by commit count
git shortlog v1.0.0..HEAD     # commits since a tag
git shortlog -sne             # include emails
git log --no-merges | git shortlog
```

## Options

| Flag | What it does |
| --- | --- |
| -s / --summary | Show counts, not commit subjects |
| -n / --numbered | Sort by number of commits |
| -e / --email | Show author email |
| --no-merges | Exclude merge commits |
| <range> | Limit to a commit range |

## Common errors in CI

shortlog reads from a tty or piped log; in non-interactive CI pass an explicit range or pipe git log into it, otherwise it may wait for input. Authors split across multiple emails group separately - add a .mailmap to consolidate them.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### git shortlog: Usage, Options & Common CI Errors?

shortlog is git log shaped for release notes. Pair it with a range and a mailmap for clean output.

### What it does?

git shortlog summarizes git log output by author, listing each author and the subject lines of their commits, optionally counting instead of listing.

### Common errors in CI?

shortlog reads from a tty or piped log; in non-interactive CI pass an explicit range or pipe git log into it, otherwise it may wait for input. Authors split across multiple emails group separately - add a .mailmap to consolidate them.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
