Skip to content

Commit 331b51d

Browse files
jnarebJunio C Hamano
authored andcommitted
Documentation: Split description of pretty formats of commit log
Split description of pretty formats into list of pretty options (--pretty and --encoding) in new file Documentation/pretty-options.txt and description of formats itself as a separate "PRETTY FORMATS" section in pretty-formats.txt While at it correct formatting a bit, to be better laid out in the resulting manpages: git-rev-list(1), git-show(1), git-log(1) and git-diff-tree(1). Those manpages now include pretty options in the same place as it was before, and description of formats just after all options. Inspired by the split into two filesdocumentation for merge strategies: Documentation/merge-options.txt and Documentation/merge-strategies.txt Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 785cdea commit 331b51d

File tree

6 files changed

+60
-39
lines changed

6 files changed

+60
-39
lines changed

Documentation/git-diff-tree.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ separated with a single space are given.
7373
This flag causes "git-diff-tree --stdin" to also show
7474
the commit message before the differences.
7575

76-
include::pretty-formats.txt[]
76+
include::pretty-options.txt[]
7777

7878
--no-commit-id::
7979
git-diff-tree outputs a line with the commit ID when
@@ -104,6 +104,9 @@ include::pretty-formats.txt[]
104104
if the diff itself is empty.
105105

106106

107+
include::pretty-formats.txt[]
108+
109+
107110
Limiting Output
108111
---------------
109112
If you're only interested in differences in a subset of files, for

Documentation/git-log.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This manual page describes only the most frequently used options.
2525
OPTIONS
2626
-------
2727

28-
include::pretty-formats.txt[]
28+
include::pretty-options.txt[]
2929

3030
-<n>::
3131
Limits the number of commits to show.
@@ -58,6 +58,9 @@ include::pretty-formats.txt[]
5858
Show only commits that affect the specified paths.
5959

6060

61+
include::pretty-formats.txt[]
62+
63+
6164
Examples
6265
--------
6366
git log --no-merges::

Documentation/git-rev-list.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Using these options, gitlink:git-rev-list[1] will act similar to the
8787
more specialized family of commit log tools: gitlink:git-log[1],
8888
gitlink:git-show[1], and gitlink:git-whatchanged[1]
8989

90-
include::pretty-formats.txt[]
90+
include::pretty-options.txt[]
9191

9292
--relative-date::
9393

@@ -367,6 +367,10 @@ These options are mostly targeted for packing of git repositories.
367367
Only useful with '--objects'; print the object IDs that are not
368368
in packs.
369369

370+
371+
include::pretty-formats.txt[]
372+
373+
370374
Author
371375
------
372376
Written by Linus Torvalds <[email protected]>

Documentation/git-show.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ OPTIONS
3838
For a more complete list of ways to spell object names, see
3939
"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
4040

41+
include::pretty-options.txt[]
42+
43+
4144
include::pretty-formats.txt[]
4245

4346

Documentation/pretty-formats.txt

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
--pretty[='<format>']::
2-
3-
Pretty-prints the details of a commit. `--pretty`
4-
without an explicit `=<format>` defaults to 'medium'.
5-
If the commit is a merge, and if the pretty-format
6-
is not 'oneline', 'email' or 'raw', an additional line is
7-
inserted before the 'Author:' line. This line begins with
8-
"Merge: " and the sha1s of ancestral commits are printed,
9-
separated by spaces. Note that the listed commits may not
10-
necessarily be the list of the *direct* parent commits if you
11-
have limited your view of history: for example, if you are
12-
only interested in changes related to a certain directory or
13-
file. Here are some additional details for each format:
14-
15-
* 'oneline'
1+
PRETTY FORMATS
2+
--------------
3+
4+
If the commit is a merge, and if the pretty-format
5+
is not 'oneline', 'email' or 'raw', an additional line is
6+
inserted before the 'Author:' line. This line begins with
7+
"Merge: " and the sha1s of ancestral commits are printed,
8+
separated by spaces. Note that the listed commits may not
9+
necessarily be the list of the *direct* parent commits if you
10+
have limited your view of history: for example, if you are
11+
only interested in changes related to a certain directory or
12+
file.
13+
14+
Here are some additional details for each format:
15+
16+
* 'oneline'
1617

1718
<sha1> <title line>
1819
+
1920
This is designed to be as compact as possible.
2021

21-
* 'short'
22+
* 'short'
2223

2324
commit <sha1>
2425
Author: <author>
2526

2627
<title line>
2728

28-
* 'medium'
29+
* 'medium'
2930

3031
commit <sha1>
3132
Author: <author>
@@ -35,7 +36,7 @@ This is designed to be as compact as possible.
3536

3637
<full commit message>
3738

38-
* 'full'
39+
* 'full'
3940

4041
commit <sha1>
4142
Author: <author>
@@ -45,7 +46,7 @@ This is designed to be as compact as possible.
4546

4647
<full commit message>
4748

48-
* 'fuller'
49+
* 'fuller'
4950

5051
commit <sha1>
5152
Author: <author>
@@ -57,18 +58,16 @@ This is designed to be as compact as possible.
5758

5859
<full commit message>
5960

60-
61-
* 'email'
61+
* 'email'
6262

6363
From <sha1> <date>
6464
From: <author>
6565
Date: <date & time>
6666
Subject: [PATCH] <title line>
6767

68-
full commit message>
69-
68+
<full commit message>
7069

71-
* 'raw'
70+
* 'raw'
7271
+
7372
The 'raw' format shows the entire commit exactly as
7473
stored in the commit object. Notably, the SHA1s are
@@ -77,19 +76,22 @@ displayed in full, regardless of whether --abbrev or
7776
true parent commits, without taking grafts nor history
7877
simplification into account.
7978

80-
* 'format:'
79+
* 'format:'
8180
+
8281
The 'format:' format allows you to specify which information
8382
you want to show. It works a little bit like printf format,
8483
with the notable exception that you get a newline with '%n'
8584
instead of '\n'.
86-
87-
E.g, 'format:"The author of %h was %an, %ar%nThe title was >>%s<<"'
85+
+
86+
E.g, 'format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"'
8887
would show something like this:
89-
88+
+
89+
-------
9090
The author of fe6e0ee was Junio C Hamano, 23 hours ago
9191
The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
9292

93+
--------
94+
+
9395
The placeholders are:
9496

9597
- '%H': commit hash
@@ -120,11 +122,3 @@ The placeholders are:
120122
- '%m': left, right or boundary mark
121123
- '%n': newline
122124

123-
124-
--encoding[=<encoding>]::
125-
The commit objects record the encoding used for the log message
126-
in their encoding header; this option can be used to tell the
127-
command to re-code the commit log message in the encoding
128-
preferred by the user. For non plumbing commands this
129-
defaults to UTF-8.
130-

Documentation/pretty-options.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--pretty[='<format>']::
2+
3+
Pretty print the contents of the commit logs in a given format,
4+
where '<format>' can be one of 'oneline', 'short', 'medium',
5+
'full', 'fuller', 'email', 'raw' and 'format:<string>'.
6+
When left out the format default to 'medium'.
7+
8+
--encoding[=<encoding>]::
9+
The commit objects record the encoding used for the log message
10+
in their encoding header; this option can be used to tell the
11+
command to re-code the commit log message in the encoding
12+
preferred by the user. For non plumbing commands this
13+
defaults to UTF-8.
14+

0 commit comments

Comments
 (0)