Most useful options for git shortlog
, using “Pro Git” book repo as an example.
Part of it:
git shortlog [<options>] [<revision range>] [[--] <path>...]
-n, --numbered Sort output according to the number of commits per author instead of author alphabetic order. -s, --summary Suppress commit description and provide a commit count summary only. ... snip ... <revision range> Show only commits in the specified revision range. When no <revision range> is specified, it defaults to HEAD (i.e. the whole history leading to the current commit). origin..HEAD specifies all the commits reachable from the current commit (i.e. HEAD), but not from origin. For a complete list of ways to spell <revision range>, see the "Specifying Ranges" section of gitrevisions(7). [--] <path>... Consider only commits that are enough to explain how the files that match the specified paths came to be.
Default output:
$ git shortlog 4wk- (1): 4wk: ajusting the documentation - see #1053 and #1054 Adam Laflamme (1): - Fixed a typo in hooks.asc. Issue #1169. Adrien Ollier (42): removed and ignored Gemfile.lock added escaped quotation marks for git commit's message. added a new section for Git as a client for a Bazaar repository added a new section to import a Bazaar repository into a Git repository Modifications done as per Ben's suggestions. minor modifications removed trailing spaces ... snip ...
Sort according to contributions:
$ git shortlog -n Ben Straub (803): Fix markdown H4's (convert into asciidoc H5's) Remove trailing spaces Add remaining headers to outline GitHub is a chapter Tweak github chapter Three trees Add some things Feedback ... snip ...
Just print a summary:
$ git shortlog -n -s 803 Ben Straub 306 Scott Chacon 105 Robert P. J. Day 52 Jean-Noël Avila 50 Cory Donnelly 42 Adrien Ollier 24 Kaartic Sivaraam 20 Yue Lin Ho 11 Markus KARG 10 Kyrylo Yatsenko 10 Sanders Kleinfeld ... snip ...
Don't count merge commits:
$ git shortlog -n -s --no-merges 803 Ben Straub 306 Scott Chacon 105 Robert P. J. Day 52 Jean-Noël Avila 50 Cory Donnelly 42 Adrien Ollier 24 Kaartic Sivaraam 20 Yue Lin Ho 11 Markus KARG 10 Kyrylo Yatsenko 10 Sanders Kleinfeld ... snip ...
Restrict to a pathspec:
$ git shortlog -n -s --no-merges -- images 5 Scott Chacon 2 Adrien Ollier 1 Ben Straub 1 Duncan Dean 1 Yunhai Luo $