LinuxCommandLibrary

git-shortlog

Summarize git commit history

TLDR

View a summary of all the commits made, grouped alphabetically by author name

$ git shortlog
copy

View a summary of all the commits made, sorted by the number of commits made
$ git shortlog [[-n|--numbered]]
copy

View a summary of all the commits made, grouped by the committer identities (name and email)
$ git shortlog [[-c|--committer]]
copy

View a summary of the last 5 commits (i.e. specify a revision range)
$ git shortlog HEAD~5..HEAD
copy

View all users, emails and the number of commits in the current branch
$ git shortlog [[-s|--summary]] [[-n|--numbered]] [[-e|--email]]
copy

View all users, emails and the number of commits in all branches
$ git shortlog [[-s|--summary]] [[-n|--numbered]] [[-e|--email]] --all
copy

SYNOPSIS

git shortlog [-sn] [-e] [-w=,,] [] [--summary]

PARAMETERS

-n, --numbered
    Sort output according to the number of commits per author instead of author alphabetical order.

-s, --summary
    Suppress the commit message and only output the commit count per author.

-e, --email
    Show the email address of each author instead of the name.

-w=[,[,]]
    Linewrap the output shorter than columns, with and for the first and second line of each commit message, respectively. defaults to 76, to 6, and to 9. Note that affects lines wrapped due to message being too long.

[]
    Specify the revision range to summarize. Defaults to all commits. See git rev-parse(1)

DESCRIPTION

The `git shortlog` command is used to summarize git commit logs. It groups commits by author and shows the number of commits each author has made. It can also optionally display the commit messages themselves. This is a useful tool for getting a quick overview of the contributions to a project, identifying active developers, and understanding the overall development activity. The command provides features for sorting author contributions, filtering by date and commit range, and customizing the output format to suit different needs.

Unlike `git log`, `git shortlog` focuses on summarizing author contributions rather than displaying detailed commit histories.

CAVEATS

The output format may change slightly between Git versions. The order of authors when not using the `-n` option is locale-dependent.

EXIT STATUS

The command exits with 0 on success, and non-zero on failure.

HISTORY

The `git shortlog` command has been a part of Git since its early development. It was designed to provide a concise summary of the commit history, focusing on author contributions rather than individual commit details. Over time, features like sorting options and output customization have been added to improve its utility.

SEE ALSO

git log(1), git rev-parse(1)

Copied to clipboard