What is git shortlog?
Why Interviewers Ask This
Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Git & GitHub basics — a prerequisite for any developer role.
Answer
git shortlog summarizes commit history by grouping commits by author, making it useful for project statistics and contributor recognition. Usage: git shortlog — groups commits by author (alphabetical), listing each commit message; git shortlog -s — summary only (count per author, no messages); git shortlog -sn — sort by number of commits (most active contributors first); git shortlog -sne — include email addresses; git shortlog -n --since="2024-01-01" — filter by date; git log --oneline | git shortlog — can pipe log output. Typical output: 15 Alice (15 commits listed)\n 8 Bob (8 commits listed). With -s -n: 15 Alice\n 8 Bob\n 3 Carol. Use cases: (1) Generate a contributor list for release notes; (2) Understand team activity; (3) Identify who to ask about specific areas of the codebase. Difference from git log: log shows chronological commit history; shortlog summarizes by contributor. Combined with --since/--until to analyze contributions per sprint or release cycle.
Common Mistake
Candidates often give textbook answers here. Interviewers are more impressed when you relate the concept to a specific problem you solved in a real Git & GitHub project.