2005-08-15 00:24:36 +00:00
|
|
|
git-shortlog(1)
|
|
|
|
===============
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2010-01-09 23:33:00 +00:00
|
|
|
git-shortlog - Summarize 'git log' output
|
2005-08-15 00:24:36 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2007-04-18 22:10:22 +00:00
|
|
|
[verse]
|
2018-04-17 19:15:27 +00:00
|
|
|
'git shortlog' [<options>] [<revision range>] [[--] <path>...]
|
2018-03-10 11:52:10 +00:00
|
|
|
git log --pretty=short | 'git shortlog' [<options>]
|
2005-08-15 00:24:36 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2010-01-09 23:33:00 +00:00
|
|
|
Summarizes 'git log' output in a format suitable for inclusion
|
2012-09-13 22:27:09 +00:00
|
|
|
in release announcements. Each commit will be grouped by author and title.
|
2006-06-07 18:32:33 +00:00
|
|
|
|
|
|
|
Additionally, "[PATCH]" will be stripped from the commit description.
|
|
|
|
|
2010-05-04 02:57:10 +00:00
|
|
|
If no revisions are passed on the command line and either standard input
|
|
|
|
is not a terminal or there is no current branch, 'git shortlog' will
|
|
|
|
output a summary of the log read from standard input, without
|
|
|
|
reference to the current repository.
|
|
|
|
|
2006-10-06 19:39:09 +00:00
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
-n::
|
|
|
|
--numbered::
|
2006-10-06 19:39:09 +00:00
|
|
|
Sort output according to the number of commits per author instead
|
|
|
|
of author alphabetic order.
|
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
-s::
|
|
|
|
--summary::
|
2007-01-17 15:32:41 +00:00
|
|
|
Suppress commit description and provide a commit count summary only.
|
2006-10-06 19:39:09 +00:00
|
|
|
|
2008-06-08 01:36:09 +00:00
|
|
|
-e::
|
|
|
|
--email::
|
2007-12-11 12:33:12 +00:00
|
|
|
Show the email address of each author.
|
|
|
|
|
2010-10-08 17:31:18 +00:00
|
|
|
--format[=<format>]::
|
2010-05-04 02:59:55 +00:00
|
|
|
Instead of the commit subject, use some other information to
|
|
|
|
describe each commit. '<format>' can be any string accepted
|
docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.
It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:
1. The source is much easier to read when the literal
contains punctuation. You can use `master~1` instead
of `master{tilde}1`.
2. They are less error-prone. Because of point (1), we
tend to make mistakes and forget the extra layer of
quoting.
This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).
Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:
- HTML rendering used the ellipsis character instead of
literal "..." in code examples (like "git log A...B")
- some code examples used the right-arrow character
instead of '->' because they failed to quote
- api-config.txt did not quote tilde, and the resulting
HTML contained a bogus snippet like:
<tt><sub></tt> foo <tt></sub>bar</tt>
which caused some parsers to choke and omit whole
sections of the page.
- git-commit.txt confused ``foo`` (backticks inside a
literal) with ``foo'' (matched double-quotes)
- mentions of `A U Thor <author@example.com>` used to
erroneously auto-generate a mailto footnote for
author@example.com
- the description of --word-diff=plain incorrectly showed
the output as "[-removed-] and {added}", not "{+added+}".
- using "prime" notation like:
commit `C` and its replacement `C'`
confused asciidoc into thinking that everything between
the first backtick and the final apostrophe were meant
to be inside matched quotes
- asciidoc got confused by the escaping of some of our
asterisks. In particular,
`credential.\*` and `credential.<url>.\*`
properly escaped the asterisk in the first case, but
literally passed through the backslash in the second
case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 08:51:57 +00:00
|
|
|
by the `--format` option of 'git log', such as '* [%h] %s'.
|
2010-05-04 02:59:55 +00:00
|
|
|
(See the "PRETTY FORMATS" section of linkgit:git-log[1].)
|
|
|
|
|
|
|
|
Each pretty-printed commit will be rewrapped before it is shown.
|
|
|
|
|
2020-09-27 08:39:59 +00:00
|
|
|
--group=<type>::
|
|
|
|
Group commits based on `<type>`. If no `--group` option is
|
|
|
|
specified, the default is `author`. `<type>` is one of:
|
|
|
|
+
|
shortlog: allow multiple groups to be specified
Now that shortlog supports reading from trailers, it can be useful to
combine counts from multiple trailers, or between trailers and authors.
This can be done manually by post-processing the output from multiple
runs, but it's non-trivial to make sure that each name/commit pair is
counted only once.
This patch teaches shortlog to accept multiple --group options on the
command line, and pull data from all of them. That makes it possible to
run:
git shortlog -ns --group=author --group=trailer:co-authored-by
to get a shortlog that counts authors and co-authors equally.
The implementation is mostly straightforward. The "group" enum becomes a
bitfield, and the trailer key becomes a list. I didn't bother
implementing the multi-group semantics for reading from stdin. It would
be possible to do, but the existing matching code makes it awkward, and
I doubt anybody cares.
The duplicate suppression we used for trailers now covers authors and
committers as well (though in non-trailer single-group mode we can skip
the hash insertion and lookup, since we only see one value per commit).
There is one subtlety: we now care about the case when no group bit is
set (in which case we default to showing the author). The caller in
builtin/log.c needs to be adapted to ask explicitly for authors, rather
than relying on shortlog_init(). It would be possible with some
gymnastics to make this keep working as-is, but it's not worth it for a
single caller.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-27 08:40:15 +00:00
|
|
|
--
|
2020-09-27 08:39:59 +00:00
|
|
|
- `author`, commits are grouped by author
|
|
|
|
- `committer`, commits are grouped by committer (the same as `-c`)
|
2020-09-27 08:40:04 +00:00
|
|
|
- `trailer:<field>`, the `<field>` is interpreted as a case-insensitive
|
|
|
|
commit message trailer (see linkgit:git-interpret-trailers[1]). For
|
|
|
|
example, if your project uses `Reviewed-by` trailers, you might want
|
|
|
|
to see who has been reviewing with
|
|
|
|
`git shortlog -ns --group=trailer:reviewed-by`.
|
|
|
|
+
|
|
|
|
Note that commits that do not include the trailer will not be counted.
|
|
|
|
Likewise, commits with multiple trailers (e.g., multiple signoffs) may
|
2020-09-27 08:40:07 +00:00
|
|
|
be counted more than once (but only once per unique trailer value in
|
|
|
|
that commit).
|
2020-09-27 08:40:04 +00:00
|
|
|
+
|
2020-09-27 08:40:11 +00:00
|
|
|
Shortlog will attempt to parse each trailer value as a `name <email>`
|
|
|
|
identity. If successful, the mailmap is applied and the email is omitted
|
|
|
|
unless the `--email` option is specified. If the value cannot be parsed
|
|
|
|
as an identity, it will be taken literally and completely.
|
shortlog: allow multiple groups to be specified
Now that shortlog supports reading from trailers, it can be useful to
combine counts from multiple trailers, or between trailers and authors.
This can be done manually by post-processing the output from multiple
runs, but it's non-trivial to make sure that each name/commit pair is
counted only once.
This patch teaches shortlog to accept multiple --group options on the
command line, and pull data from all of them. That makes it possible to
run:
git shortlog -ns --group=author --group=trailer:co-authored-by
to get a shortlog that counts authors and co-authors equally.
The implementation is mostly straightforward. The "group" enum becomes a
bitfield, and the trailer key becomes a list. I didn't bother
implementing the multi-group semantics for reading from stdin. It would
be possible to do, but the existing matching code makes it awkward, and
I doubt anybody cares.
The duplicate suppression we used for trailers now covers authors and
committers as well (though in non-trailer single-group mode we can skip
the hash insertion and lookup, since we only see one value per commit).
There is one subtlety: we now care about the case when no group bit is
set (in which case we default to showing the author). The caller in
builtin/log.c needs to be adapted to ask explicitly for authors, rather
than relying on shortlog_init(). It would be possible with some
gymnastics to make this keep working as-is, but it's not worth it for a
single caller.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-27 08:40:15 +00:00
|
|
|
--
|
|
|
|
+
|
|
|
|
If `--group` is specified multiple times, commits are counted under each
|
|
|
|
value (but again, only once per unique value in that commit). For
|
|
|
|
example, `git shortlog --group=author --group=trailer:co-authored-by`
|
|
|
|
counts both authors and co-authors.
|
2020-09-27 08:39:59 +00:00
|
|
|
|
2016-12-16 13:51:41 +00:00
|
|
|
-c::
|
|
|
|
--committer::
|
2020-09-27 08:39:59 +00:00
|
|
|
This is an alias for `--group=committer`.
|
2016-12-16 13:51:41 +00:00
|
|
|
|
2008-04-12 22:38:20 +00:00
|
|
|
-w[<width>[,<indent1>[,<indent2>]]]::
|
|
|
|
Linewrap the output by wrapping each line at `width`. The first
|
|
|
|
line of each entry is indented by `indent1` spaces, and the second
|
|
|
|
and subsequent lines are indented by `indent2` spaces. `width`,
|
|
|
|
`indent1`, and `indent2` default to 76, 6 and 9 respectively.
|
2013-01-09 20:16:45 +00:00
|
|
|
+
|
|
|
|
If width is `0` (zero) then indent the lines of the output without wrapping
|
|
|
|
them.
|
2008-04-12 22:38:20 +00:00
|
|
|
|
2013-04-22 05:30:30 +00:00
|
|
|
<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 linkgit:gitrevisions[7].
|
|
|
|
|
2018-04-17 19:15:27 +00:00
|
|
|
[--] <path>...::
|
2013-04-22 05:30:30 +00:00
|
|
|
Consider only commits that are enough to explain how the files
|
|
|
|
that match the specified paths came to be.
|
|
|
|
+
|
git-[short]log.txt: unify quoted standalone --
In git-log.txt, we have an instance of \--, which is known to sometimes
render badly. This one is even worse than normal though, since ``\-- ''
(with or without that trailing space) appears to be entirely broken,
both in HTML and manpages, both with AsciiDoc (version 8.6.9) and
Asciidoctor (version 1.5.4).
Further down in git-log.txt we have a ``--'', which renders good. In
git-shortlog.txt, we use "\-- " (including the quotes and the space),
which happens to look fairly good. I failed to find any other similar
instances. So all in all, we quote a double-dash in three different
places and do it differently each time, with various degrees of success.
Switch all of these to `--`. This sets the double-dash in monospace and
matches what we usually do with example command line usages and options.
Note that we drop the trailing space as well, since `-- ` does not
render well. These should still be clear enough since just a few lines
above each instance, the space is clearly visible in a longer context.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
2018-04-17 19:15:28 +00:00
|
|
|
Paths may need to be prefixed with `--` to separate them from
|
2013-04-22 05:30:30 +00:00
|
|
|
options or the revision range, when confusion arises.
|
2009-02-08 14:34:31 +00:00
|
|
|
|
2019-11-08 19:26:27 +00:00
|
|
|
:git-shortlog: 1
|
|
|
|
include::rev-list-options.txt[]
|
|
|
|
|
2009-02-08 14:34:31 +00:00
|
|
|
MAPPING AUTHORS
|
|
|
|
---------------
|
|
|
|
|
2021-01-12 20:17:45 +00:00
|
|
|
See linkgit:gitmailmap[5].
|
2009-02-08 14:34:29 +00:00
|
|
|
|
mailmap: only look for .mailmap in work tree
When trying to find a .mailmap file, we will always look for it in the
current directory. This makes sense in a repository with a working tree,
since we'd always go to the toplevel directory at startup. But for a
bare repository, it can be confusing. With an option like --git-dir (or
$GIT_DIR in the environment), we don't chdir at all, and we'd read
.mailmap from whatever directory you happened to be in before starting
Git.
(Note that --git-dir without specifying a working tree historically
means "the current directory is the root of the working tree", but most
bare repositories will have core.bare set these days, meaning they will
realize there is no working tree at all).
The documentation for gitmailmap(5) says:
If the file `.mailmap` exists at the toplevel of the repository[...]
which likewise reinforces the notion that we are looking in the working
tree.
This patch prevents us from looking for such a file when we're in a bare
repository. This does break something that used to work:
cd bare.git
git cat-file blob HEAD:.mailmap >.mailmap
git shortlog
But that was never advertised in the documentation. And these days we
have mailmap.blob (which defaults to HEAD:.mailmap) to do the same thing
in a much cleaner way.
However, there's one more interesting case: we might not have a
repository at all! The git-shortlog command can be run with git-log
output fed on its stdin, and it will apply the mailmap. In that case, it
probably does make sense to read .mailmap from the current directory.
This patch will continue to do so.
That leads to one even weirder case: if you run git-shortlog to process
stdin, the input _could_ be from a different repository entirely. Should
we respect the in-tree .mailmap then? Probably yes. Whatever the source
of the input, if shortlog is running in a repository, the documentation
claims that we'd read the .mailmap from its top-level (and of course
it's reasonably likely that it _is_ from the same repo, and the user
just preferred to run git-log and git-shortlog separately for whatever
reason).
The included test covers these cases, and we now document the "no repo"
case explicitly.
We also add a test that confirms we find a top-level ".mailmap" even
when we start in a subdirectory of the working tree. This worked both
before and after this commit, but we never tested it explicitly (it
works because we always chdir to the top-level of the working tree if
there is one).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-10 20:34:33 +00:00
|
|
|
Note that if `git shortlog` is run outside of a repository (to process
|
|
|
|
log contents on standard input), it will look for a `.mailmap` file in
|
|
|
|
the current directory.
|
|
|
|
|
2005-08-15 00:24:36 +00:00
|
|
|
GIT
|
|
|
|
---
|
2008-06-06 07:07:32 +00:00
|
|
|
Part of the linkgit:git[1] suite
|