# git shortlog for Release Notes: Usage & CI Errors

> Using git shortlog to generate release notes and contributor summaries in CI. Reference for grouping, ranges, mailmap, and non-interactive pitfalls.

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

git shortlog between two tags is the simplest reliable way to draft release notes in a pipeline.

This pattern turns a commit range into grouped, deduplicated release notes - with the CI caveats that trip teams up.

## What it does

Run against a tag-to-HEAD range, git shortlog groups commit subjects by author so a release job can emit a contributor-attributed changelog without external tooling.

## Common usage

```Terminal
# notes since the previous tag:
PREV=$(git describe --tags --abbrev=0 HEAD^)
git shortlog --no-merges "$PREV"..HEAD
# just the contributor list:
git shortlog -sne "$PREV"..HEAD
```

## Common errors in CI

git shortlog without a range or piped input can block waiting on stdin in non-interactive CI - always pass an explicit range. fatal: No names found / a bad PREV happens when no earlier tag exists or tags were not fetched; guard the describe call and set fetch-depth: 0.

## 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 for Release Notes: Usage & CI Errors?

This pattern turns a commit range into grouped, deduplicated release notes - with the CI caveats that trip teams up.

### What it does?

Run against a tag-to-HEAD range, git shortlog groups commit subjects by author so a release job can emit a contributor-attributed changelog without external tooling.

### Common errors in CI?

git shortlog without a range or piped input can block waiting on stdin in non-interactive CI - always pass an explicit range. fatal: No names found / a bad PREV happens when no earlier tag exists or tags were not fetched; guard the describe call and set fetch-depth: 0.

---

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
