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.
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
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:
Unique Author Names Only
%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:
Now git shortlog -sne merges commits under the canonical name:
Filtering by Date Range
First and Last Commit per Author
More structured output:
Lines Changed per Author
A simpler approach using git log --stat:
Authors vs Committers
Git tracks two identities per commit — the author (who wrote the change) and the committer (who applied it):
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
Common Pitfalls
- Duplicate identities: The same person using different names or emails appears as multiple contributors. Use a
.mailmapfile to consolidate identities before running reports. - Counting only the current branch:
git shortlogoperates on the current branch. To include all branches, usegit shortlog -sne --all. - Confusing authors with committers: In projects that use
git cherry-pickorgit am, the committer may differ from the author. Use%aN/%aEfor authors and%cN/%cEfor committers. - Shallow clones missing history: If the repo was cloned with
--depth, older commits and their authors are missing. Rungit fetch --unshallowto 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-mergesand exclude known bot emails.
Summary
git shortlog -sneis the fastest way to list all contributors with commit counts and emails- Use
.mailmapto merge multiple identities for the same contributor - Filter by date with
--sinceand--afterflags - Use
--allto include contributors from all branches, not just the current one - Distinguish between authors (code writers) and committers (people who applied the commit)
Related reading
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.