# git shortlog Command: Summarize Authors in CI

> git shortlog groups commits by author. Reference for -s, -n, and ranges to build contributor summaries and release-note credits in CI.

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

git shortlog summarizes commit history grouped by author, ideal for release credits.

Release automation uses shortlog to list who contributed since the last version. Its summary flags turn raw history into a tidy, attributed list.

## Common flags

- `-s` / `--summary` - show only a commit count per author, not the messages
- `-n` / `--numbered` - sort authors by number of commits, descending
- `-e` / `--email` - include the email address of each author
- `--no-merges` - exclude merge commits
- `<from>..<to>` - limit to a commit range (e.g. since the last tag)

## Example

```shell
# Contributors since the previous tag, ranked
PREV="$(git describe --tags --abbrev=0 HEAD^)"
git shortlog -sn --no-merges "${PREV}..HEAD"
```

## In CI

shortlog -sn over a tag..HEAD range produces a ready-made contributor list for release notes. It reads commit metadata, so it needs full history; deepen shallow clones first. A .mailmap file consolidates duplicate author identities.

## 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 Command: Summarize Authors in CI?

Release automation uses shortlog to list who contributed since the last version. Its summary flags turn raw history into a tidy, attributed list.

### In CI?

shortlog -sn over a tag..HEAD range produces a ready-made contributor list for release notes. It reads commit metadata, so it needs full history; deepen shallow clones first. A .mailmap file consolidates duplicate author identities.

---

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
