Git
developers
project management
version control
collaboration

List all developers on a project in Git

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

Listing all developers who have contributed to a Git project is done by extracting author information from the commit history. The primary command is git shortlog -sne, which shows every unique author with their commit count and email. For more detailed analysis, git log with format strings lets you extract specific fields like author name, email, and date of first or last commit. These commands are useful for auditing contributions, generating release credits, and understanding team involvement.

Quick List: git shortlog

bash
1# List all authors sorted by commit count (most commits first)
2git shortlog -sne
3
4#   142  Alice Johnson <[email protected]>
5#    87  Bob Smith <[email protected]>
6#    34  Charlie Lee <[email protected]>
7#    12  Diana Chen <[email protected]>

Flags:

  • -s: Summary only (commit count, no commit messages)
  • -n: Sort by number of commits (descending)
  • -e: Show email addresses

Without -s, git shortlog groups commit messages by author:

bash
1git shortlog
2# Alice Johnson (142):
3#       Fix login page redirect
4#       Add user profile API
5#       ...
6# Bob Smith (87):
7#       Update README
8#       ...

Unique Author Names Only

bash
1# Just names, one per line
2git log --format='%aN' | sort -u
3
4# Alice Johnson
5# Bob Smith
6# Charlie Lee
7# Diana Chen
bash
1# Names with emails
2git log --format='%aN <%aE>' | sort -u
3
4# Alice Johnson <[email protected]>
5# Bob Smith <[email protected]>

%aN is the author name (respecting .mailmap), and %aE is the author email.

Using .mailmap to Consolidate Identities

Developers often commit under different names or emails. The .mailmap file maps variations to a canonical identity:

bash
1# .mailmap (placed in the repo root)
2Alice Johnson <[email protected]> <[email protected]>
3Alice Johnson <[email protected]> A. Johnson <[email protected]>
4Bob Smith <[email protected]> <[email protected]>

Now git shortlog -sne merges commits under the canonical name:

bash
1# Before .mailmap:
2#    90  Alice Johnson <[email protected]>
3#    52  A. Johnson <[email protected]>
4
5# After .mailmap:
6#   142  Alice Johnson <[email protected]>

Filtering by Date Range

bash
1# Contributors in the last 6 months
2git shortlog -sne --since="6 months ago"
3
4# Contributors in 2025
5git shortlog -sne --after="2025-01-01" --before="2026-01-01"
6
7# Contributors to a specific branch
8git shortlog -sne main

First and Last Commit per Author

bash
1# Last commit date per author
2git log --format='%aN|%ai' | sort -t'|' -k1,1 -u
3
4# First commit date per author (reverse log)
5git log --reverse --format='%aN|%ai' | sort -t'|' -k1,1 -u

More structured output:

bash
1# Show each author's first and last commit dates
2git log --format='%aN' | sort -u | while read author; do
3    first=$(git log --reverse --author="$author" --format='%ai' | head -1)
4    last=$(git log --author="$author" --format='%ai' | head -1)
5    echo "$author | first: $first | last: $last"
6done
7
8# Alice Johnson | first: 2023-03-15 | last: 2025-02-28
9# Bob Smith     | first: 2023-06-01 | last: 2025-01-15

Lines Changed per Author

bash
1# Total lines added/removed per author
2git log --format='%aN' --numstat | awk '
3    /^[0-9]/ { added[$3] += $1; removed[$3] += $2 }
4    /^[A-Z]/ || /^[a-z]/ { author = $0 }
5    END { for (f in added) print added[f], removed[f], f }
6'

A simpler approach using git log --stat:

bash
1# Commit count and total changes per author
2git log --shortstat --format='AUTHOR:%aN' | awk '
3    /^AUTHOR:/ { author = substr($0, 8) }
4    /files? changed/ {
5        commits[author]++
6        split($0, a, ",")
7        for (i in a) {
8            if (a[i] ~ /insertion/) { gsub(/[^0-9]/, "", a[i]); added[author] += a[i] }
9            if (a[i] ~ /deletion/) { gsub(/[^0-9]/, "", a[i]); deleted[author] += a[i] }
10        }
11    }
12    END {
13        for (a in commits)
14            printf "%s: %d commits, +%d -%d\n", a, commits[a], added[a], deleted[a]
15    }
16'

Authors vs Committers

Git tracks two identities per commit — the author (who wrote the change) and the committer (who applied it):

bash
1# List authors (who wrote the code)
2git log --format='%aN <%aE>' | sort -u
3
4# List committers (who committed — different in rebases, cherry-picks, etc.)
5git log --format='%cN <%cE>' | sort -u
6
7# Show both when they differ
8git log --format='Author: %aN <%aE> | Committer: %cN <%cE>' | sort -u

In most workflows, author and committer are the same. They differ when patches are applied by maintainers (e.g., in open source projects using git am or git cherry-pick).

Programmatic Access

bash
1# Output as JSON (requires jq)
2git log --format='{"name": "%aN", "email": "%aE", "date": "%ai"}' | \
3    jq -s 'group_by(.name) | map({name: .[0].name, email: .[0].email, commits: length})' | \
4    jq 'sort_by(-.commits)'
python
1# Python: using subprocess
2import subprocess
3import collections
4
5result = subprocess.run(
6    ["git", "log", "--format=%aN"],
7    capture_output=True, text=True
8)
9authors = result.stdout.strip().split("\n")
10counts = collections.Counter(authors)
11
12for name, count in counts.most_common():
13    print(f"{count:>5}  {name}")

Common Pitfalls

  • Duplicate identities: The same person using different names or emails appears as multiple contributors. Use a .mailmap file to consolidate identities before running reports.
  • Counting only the current branch: git shortlog operates on the current branch. To include all branches, use git shortlog -sne --all.
  • Confusing authors with committers: In projects that use git cherry-pick or git am, the committer may differ from the author. Use %aN/%aE for authors and %cN/%cE for committers.
  • Shallow clones missing history: If the repo was cloned with --depth, older commits and their authors are missing. Run git fetch --unshallow to get the full history.
  • Bots inflating contributor counts: CI bots, dependabot, and automated commits can dominate the list. Filter them with git shortlog -sne --no-merges and exclude known bot emails.

Summary

  • git shortlog -sne is the fastest way to list all contributors with commit counts and emails
  • Use .mailmap to merge multiple identities for the same contributor
  • Filter by date with --since and --after flags
  • Use --all to include contributors from all branches, not just the current one
  • Distinguish between authors (code writers) and committers (people who applied the commit)

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.