Skip to content
LatchkeyLatchkey home

git shortlog Command: Summarize Authors in CI

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

Key takeaways

  • git shortlog -sn ranks contributors by commit count for release credits.
  • Scope it with a tag..HEAD range to credit one release.
  • It needs full history, so it does not work on shallow clones.

Frequently asked questions

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.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card