Merge branch 'dl/pretty-reference'
"git log" family learned "--pretty=reference" that gives the name of a commit in the format that is often used to refer to it in log messages. * dl/pretty-reference: SubmittingPatches: use `--pretty=reference` pretty: implement 'reference' format pretty: add struct cmt_fmt_map::default_date_mode_type pretty: provide short date format t4205: cover `git log --reflog -z` blindspot pretty.c: inline initalize format_context revision: make get_revision_mark() return const pointer completion: complete `tformat:` pretty format SubmittingPatches: remove dq from commit reference pretty-formats.txt: use generic terms for hash SubmittingPatches: use generic terms for hash
This commit is contained in:
@ -142,19 +142,25 @@ archive, summarize the relevant points of the discussion.
|
||||
|
||||
[[commit-reference]]
|
||||
If you want to reference a previous commit in the history of a stable
|
||||
branch, use the format "abbreviated sha1 (subject, date)",
|
||||
with the subject enclosed in a pair of double-quotes, like this:
|
||||
branch, use the format "abbreviated hash (subject, date)", like this:
|
||||
|
||||
....
|
||||
Commit f86a374 ("pack-bitmap.c: fix a memleak", 2015-03-30)
|
||||
Commit f86a374 (pack-bitmap.c: fix a memleak, 2015-03-30)
|
||||
noticed that ...
|
||||
....
|
||||
|
||||
The "Copy commit summary" command of gitk can be used to obtain this
|
||||
format, or this invocation of `git show`:
|
||||
format (with the subject enclosed in a pair of double-quotes), or this
|
||||
invocation of `git show`:
|
||||
|
||||
....
|
||||
git show -s --date=short --pretty='format:%h ("%s", %ad)' <commit>
|
||||
git show -s --pretty=reference <commit>
|
||||
....
|
||||
|
||||
or, on an older version of Git without support for --pretty=reference:
|
||||
|
||||
....
|
||||
git show -s --date=short --pretty='format:%h (%s, %ad)' <commit>
|
||||
....
|
||||
|
||||
[[git-tools]]
|
||||
|
@ -4,7 +4,7 @@ PRETTY FORMATS
|
||||
If the commit is a merge, and if the pretty-format
|
||||
is not 'oneline', 'email' or 'raw', an additional line is
|
||||
inserted before the 'Author:' line. This line begins with
|
||||
"Merge: " and the sha1s of ancestral commits are printed,
|
||||
"Merge: " and the hashes of ancestral commits are printed,
|
||||
separated by spaces. Note that the listed commits may not
|
||||
necessarily be the list of the *direct* parent commits if you
|
||||
have limited your view of history: for example, if you are
|
||||
@ -20,20 +20,20 @@ built-in formats:
|
||||
|
||||
* 'oneline'
|
||||
|
||||
<sha1> <title line>
|
||||
<hash> <title line>
|
||||
+
|
||||
This is designed to be as compact as possible.
|
||||
|
||||
* 'short'
|
||||
|
||||
commit <sha1>
|
||||
commit <hash>
|
||||
Author: <author>
|
||||
|
||||
<title line>
|
||||
|
||||
* 'medium'
|
||||
|
||||
commit <sha1>
|
||||
commit <hash>
|
||||
Author: <author>
|
||||
Date: <author date>
|
||||
|
||||
@ -43,7 +43,7 @@ This is designed to be as compact as possible.
|
||||
|
||||
* 'full'
|
||||
|
||||
commit <sha1>
|
||||
commit <hash>
|
||||
Author: <author>
|
||||
Commit: <committer>
|
||||
|
||||
@ -53,7 +53,7 @@ This is designed to be as compact as possible.
|
||||
|
||||
* 'fuller'
|
||||
|
||||
commit <sha1>
|
||||
commit <hash>
|
||||
Author: <author>
|
||||
AuthorDate: <author date>
|
||||
Commit: <committer>
|
||||
@ -63,9 +63,20 @@ This is designed to be as compact as possible.
|
||||
|
||||
<full commit message>
|
||||
|
||||
* 'reference'
|
||||
|
||||
<abbrev hash> (<title line>, <short author date>)
|
||||
+
|
||||
This format is used to refer to another commit in a commit message and
|
||||
is the same as `--pretty='format:%C(auto)%h (%s, %ad)'`. By default,
|
||||
the date is formatted with `--date=short` unless another `--date` option
|
||||
is explicitly specified. As with any `format:` with format
|
||||
placeholders, its output is not affected by other options like
|
||||
`--decorate` and `--walk-reflogs`.
|
||||
|
||||
* 'email'
|
||||
|
||||
From <sha1> <date>
|
||||
From <hash> <date>
|
||||
From: <author>
|
||||
Date: <author date>
|
||||
Subject: [PATCH] <title line>
|
||||
@ -75,7 +86,7 @@ This is designed to be as compact as possible.
|
||||
* 'raw'
|
||||
+
|
||||
The 'raw' format shows the entire commit exactly as
|
||||
stored in the commit object. Notably, the SHA-1s are
|
||||
stored in the commit object. Notably, the hashes are
|
||||
displayed in full, regardless of whether --abbrev or
|
||||
--no-abbrev are used, and 'parents' information show the
|
||||
true parent commits, without taking grafts or history
|
||||
@ -172,6 +183,7 @@ The placeholders are:
|
||||
'%at':: author date, UNIX timestamp
|
||||
'%ai':: author date, ISO 8601-like format
|
||||
'%aI':: author date, strict ISO 8601 format
|
||||
'%as':: author date, short format (`YYYY-MM-DD`)
|
||||
'%cn':: committer name
|
||||
'%cN':: committer name (respecting .mailmap, see
|
||||
linkgit:git-shortlog[1] or linkgit:git-blame[1])
|
||||
@ -187,6 +199,7 @@ The placeholders are:
|
||||
'%ct':: committer date, UNIX timestamp
|
||||
'%ci':: committer date, ISO 8601-like format
|
||||
'%cI':: committer date, strict ISO 8601 format
|
||||
'%cs':: committer date, short format (`YYYY-MM-DD`)
|
||||
'%d':: ref names, like the --decorate option of linkgit:git-log[1]
|
||||
'%D':: ref names without the " (", ")" wrapping.
|
||||
'%S':: ref name given on the command line by which the commit was reached
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
Pretty-print the contents of the commit logs in a given format,
|
||||
where '<format>' can be one of 'oneline', 'short', 'medium',
|
||||
'full', 'fuller', 'email', 'raw', 'format:<string>'
|
||||
'full', 'fuller', 'reference', 'email', 'raw', 'format:<string>'
|
||||
and 'tformat:<string>'. When '<format>' is none of the above,
|
||||
and has '%placeholder' in it, it acts as if
|
||||
'--pretty=tformat:<format>' were given.
|
||||
|
@ -269,7 +269,7 @@ list.
|
||||
exclude (that is, '{caret}commit', 'commit1..commit2',
|
||||
and 'commit1\...commit2' notations cannot be used).
|
||||
+
|
||||
With `--pretty` format other than `oneline` (for obvious reasons),
|
||||
With `--pretty` format other than `oneline` and `reference` (for obvious reasons),
|
||||
this causes the output to have two extra lines of information
|
||||
taken from the reflog. The reflog designator in the output may be shown
|
||||
as `ref@{Nth}` (where `Nth` is the reverse-chronological index in the
|
||||
@ -293,6 +293,8 @@ Under `--pretty=oneline`, the commit message is
|
||||
prefixed with this information on the same line.
|
||||
This option cannot be combined with `--reverse`.
|
||||
See also linkgit:git-reflog[1].
|
||||
+
|
||||
Under `--pretty=reference`, this information will not be shown at all.
|
||||
|
||||
--merge::
|
||||
After a failed merge, show refs that touch files having a
|
||||
|
Reference in New Issue
Block a user