Skip to content

Commit fa5b4f3

Browse files
peffgitster
authored andcommitted
document --pretty=tformat: option
This was introduced in 4da45be, but never documented anywhere. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent fe22e54 commit fa5b4f3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Documentation/pretty-formats.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,25 @@ The placeholders are:
124124
- '%m': left, right or boundary mark
125125
- '%n': newline
126126
- '%x00': print a byte from a hex code
127+
128+
* 'tformat:'
129+
+
130+
The 'tformat:' format works exactly like 'format:', except that it
131+
provides "terminator" semantics instead of "separator" semantics. In
132+
other words, each commit has the message terminator character (usually a
133+
newline) appended, rather than a separator placed between entries.
134+
This means that the final entry of a single-line format will be properly
135+
terminated with a new line, just as the "oneline" format does.
136+
For example:
137+
+
138+
---------------------
139+
$ git log -2 --pretty=format:%h 4da45bef \
140+
| perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
141+
4da45be
142+
7134973 -- NO NEWLINE
143+
144+
$ git log -2 --pretty=tformat:%h 4da45bef \
145+
| perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
146+
4da45be
147+
7134973
148+
---------------------

0 commit comments

Comments
 (0)