blob: d9be7c6099395014055deeb6f63ef10834b294b6 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano68cf15a2010-11-06 01:01:596<meta name="generator" content="AsciiDoc 8.4.5" />
7<title>git-diff-tree(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamano1a4e8412005-12-27 08:17:2327
28em {
29 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5930 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2331}
32
33strong {
34 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5935 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2336}
37
38tt {
39 color: navy;
40}
41
42h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2354 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano1a4e8412005-12-27 08:17:2362
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano68cf15a2010-11-06 01:01:5977ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano1a4e8412005-12-27 08:17:2381pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2391}
92span#email {
93}
Junio C Hamano68cf15a2010-11-06 01:01:5994span#revnumber, span#revdate, span#revremark {
Junio C Hamano1a4e8412005-12-27 08:17:2395 font-family: sans-serif;
96}
97
98div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano68cf15a2010-11-06 01:01:59114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano1a4e8412005-12-27 08:17:23118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano1a4e8412005-12-27 08:17:23121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
127}
128
129div.content { /* Block element content. */
130 padding: 0;
131}
132
133/* Block element titles. */
134div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59135 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
141}
142div.title + * {
143 margin-top: 0;
144}
145
146td div.title:first-child {
147 margin-top: 0.0em;
148}
149div.content div.title:first-child {
150 margin-top: 0.0em;
151}
152div.content + div.title {
153 margin-top: 0.0em;
154}
155
156div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
160}
161
162div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
166}
167
Junio C Hamano68cf15a2010-11-06 01:01:59168div.quoteblock {
Junio C Hamano1a4e8412005-12-27 08:17:23169 padding-left: 2.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59170 margin-right: 10%;
Junio C Hamano1a4e8412005-12-27 08:17:23171}
Junio C Hamano68cf15a2010-11-06 01:01:59172div.quoteblock > div.attribution {
173 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23174 text-align: right;
175}
Junio C Hamano68cf15a2010-11-06 01:01:59176
177div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
180}
181div.verseblock > div.content {
182 white-space: pre;
183}
184div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
187}
188/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31189div.verseblock + div.attribution {
190 text-align: left;
191}
Junio C Hamano1a4e8412005-12-27 08:17:23192
193div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
200}
201div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
204}
205
206div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
209}
210
Junio C Hamano1a4e8412005-12-27 08:17:23211div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23212span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59213a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23214
215dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
218}
219dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59222 font-style: normal;
223 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23224}
225dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59226 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23227}
228
229ul, ol {
230 list-style-position: outside;
231}
Junio C Hamano68cf15a2010-11-06 01:01:59232ol.arabic {
233 list-style-type: decimal;
234}
235ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23236 list-style-type: lower-alpha;
237}
Junio C Hamano68cf15a2010-11-06 01:01:59238ol.upperalpha {
239 list-style-type: upper-alpha;
240}
241ol.lowerroman {
242 list-style-type: lower-roman;
243}
244ol.upperroman {
245 list-style-type: upper-roman;
246}
247
248div.compact ul, div.compact ol,
249div.compact p, div.compact p,
250div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
253}
Junio C Hamano1a4e8412005-12-27 08:17:23254
255div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31256 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23257}
258thead {
259 font-family: sans-serif;
260 font-weight: bold;
261}
262tfoot {
263 font-weight: bold;
264}
Junio C Hamano68cf15a2010-11-06 01:01:59265td > div.verse {
266 white-space: pre;
267}
268p.table {
269 margin-top: 0;
270}
271/* Because the table frame attribute is overriden by CSS in most browsers. */
272div.tableblock > table[frame="void"] {
273 border-style: none;
274}
275div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
278}
279div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
282}
Junio C Hamano1a4e8412005-12-27 08:17:23283
Junio C Hamano68cf15a2010-11-06 01:01:59284
285div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
288}
Junio C Hamano68cf15a2010-11-06 01:01:59289div.hdlist tr {
290 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31291}
Junio C Hamano68cf15a2010-11-06 01:01:59292dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
294}
295td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23296 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59297 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23298 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59299 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23300}
Junio C Hamano68cf15a2010-11-06 01:01:59301td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23302 vertical-align: top;
303}
Junio C Hamano68cf15a2010-11-06 01:01:59304div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
307}
308
309.comment {
310 background: yellow;
311}
Junio C Hamano1a4e8412005-12-27 08:17:23312
313@media print {
314 div#footer-badges { display: none; }
315}
Junio C Hamanoba4b9282008-07-06 05:20:31316
317div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
324}
325
326div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
329}
330div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
333}
334div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
337}
338div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
341}
Junio C Hamano68cf15a2010-11-06 01:01:59342/* Overrides for manpage documents */
343h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
348}
349h2 {
350 border-style: none;
351}
352div.sectionbody {
353 margin-left: 5%;
354}
355
356@media print {
357 div#toc { display: none; }
358}
359
Junio C Hamano1a4e8412005-12-27 08:17:23360/* Workarounds for IE6's broken and incomplete CSS2. */
361
362div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
366}
367div.sidebar-title, div.image-title {
Junio C Hamano68cf15a2010-11-06 01:01:59368 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
373}
374
375div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
379}
380
Junio C Hamano68cf15a2010-11-06 01:01:59381div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
384}
385
386div.verseblock-content {
387 white-space: pre;
388}
389div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
Junio C Hamano1a4e8412005-12-27 08:17:23392}
393
394div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
397}
Junio C Hamanoba4b9282008-07-06 05:20:31398
399/* IE6 sets dynamically generated links as visited. */
400div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23401</style>
Junio C Hamano1a4e8412005-12-27 08:17:23402</head>
403<body>
404<div id="header">
405<h1>
406git-diff-tree(1) Manual Page
407</h1>
408<h2>NAME</h2>
409<div class="sectionbody">
410<p>git-diff-tree -
411 Compares the content and mode of blobs found via two tree objects
412</p>
413</div>
414</div>
Junio C Hamano68cf15a2010-11-06 01:01:59415<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23416<div class="sectionbody">
Junio C Hamano235a91e2006-01-07 01:13:58417<div class="verseblock">
Junio C Hamano68cf15a2010-11-06 01:01:59418<div class="verseblock-content"><em>git diff-tree</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
Junio C Hamanofb56a962006-01-28 10:38:19419 [-t] [-r] [-c | --cc] [--root] [&lt;common diff options&gt;]
Junio C Hamano68cf15a2010-11-06 01:01:59420 &lt;tree-ish&gt; [&lt;tree-ish&gt;] [&lt;path&gt;&#8230;]</div>
421<div class="verseblock-attribution">
422</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23423</div>
Junio C Hamanoba4b9282008-07-06 05:20:31424<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23425<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59426<div class="paragraph"><p>Compares the content and mode of the blobs found via two tree objects.</p></div>
427<div class="paragraph"><p>If there is only one &lt;tree-ish&gt; given, the commit is compared with its parents
Junio C Hamanoba4b9282008-07-06 05:20:31428(see --stdin below).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59429<div class="paragraph"><p>Note that <em>git diff-tree</em> can use the tree encapsulated in a commit object.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23430</div>
Junio C Hamanoba4b9282008-07-06 05:20:31431<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23432<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59433<div class="dlist"><dl>
434<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23435-p
436</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59437<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22438-u
439</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59440<dt class="hdlist1">
Junio C Hamanoe97d5772010-05-19 08:13:58441--patch
442</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23443<dd>
444<p>
Junio C Hamanoff979792007-11-16 10:11:30445 Generate patch (see section on generating patches).
446
Junio C Hamano1a4e8412005-12-27 08:17:23447</p>
448</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59449<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34450-U&lt;n&gt;
451</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59452<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34453--unified=&lt;n&gt;
454</dt>
455<dd>
456<p>
457 Generate diffs with &lt;n&gt; lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:37458 the usual three.
459 Implies <tt>-p</tt>.
Junio C Hamano69361562007-07-26 02:14:34460</p>
461</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59462<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34463--raw
464</dt>
465<dd>
466<p>
467 Generate the raw format.
Junio C Hamanoff979792007-11-16 10:11:30468 This is the default.
Junio C Hamano9ae1a062006-07-10 08:12:34469</p>
470</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59471<dt class="hdlist1">
Junio C Hamano54559c82006-04-13 07:45:12472--patch-with-raw
473</dt>
474<dd>
475<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37476 Synonym for <tt>-p --raw</tt>.
Junio C Hamano54559c82006-04-13 07:45:12477</p>
478</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59479<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02480--patience
481</dt>
482<dd>
483<p>
484 Generate a diff using the "patience diff" algorithm.
485</p>
486</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59487<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:17488--stat[=&lt;width&gt;[,&lt;name-width&gt;]]
Junio C Hamanoba7c8d82006-04-15 06:17:42489</dt>
490<dd>
491<p>
Junio C Hamano4a9a76a2006-10-01 05:40:29492 Generate a diffstat. You can override the default
Junio C Hamanod2179ef2010-10-22 04:12:17493 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
Junio C Hamano4a9a76a2006-10-01 05:40:29494 The width of the filename part can be controlled by
495 giving another width to it separated by a comma.
Junio C Hamanoba7c8d82006-04-15 06:17:42496</p>
497</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59498<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48499--numstat
500</dt>
501<dd>
502<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37503 Similar to <tt>--stat</tt>, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:48504 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43505 abbreviation, to make it more machine friendly. For
506 binary files, outputs two <tt>-</tt> instead of saying
507 <tt>0 0</tt>.
Junio C Hamanofbe00522006-10-19 05:58:48508</p>
509</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59510<dt class="hdlist1">
Junio C Hamano7d23f5e2006-12-16 07:44:04511--shortstat
512</dt>
513<dd>
514<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37515 Output only the last line of the <tt>--stat</tt> format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:04516 number of modified files, as well as number of added and deleted
517 lines.
518</p>
519</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59520<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:17521--dirstat[=&lt;limit&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03522</dt>
523<dd>
524<p>
Junio C Hamanoa2f46622008-09-03 05:20:31525 Output the distribution of relative amount of changes (number of lines added or
526 removed) for each sub-directory. Directories with changes below
527 a cut-off percent (3% by default) are not shown. The cut-off percent
Junio C Hamanod2179ef2010-10-22 04:12:17528 can be set with <tt>--dirstat=&lt;limit&gt;</tt>. Changes in a child directory are not
Junio C Hamano3b70d3c2009-11-21 17:37:37529 counted for the parent directory, unless <tt>--cumulative</tt> is used.
Junio C Hamano6a45be92008-04-22 08:19:03530</p>
531</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59532<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:17533--dirstat-by-file[=&lt;limit&gt;]
Junio C Hamanoa476efa2008-10-10 15:31:42534</dt>
535<dd>
536<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37537 Same as <tt>--dirstat</tt>, but counts changed files instead of lines.
Junio C Hamanoa476efa2008-10-10 15:31:42538</p>
539</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59540<dt class="hdlist1">
Junio C Hamano6959c6c2006-05-17 10:34:11541--summary
542</dt>
543<dd>
544<p>
545 Output a condensed summary of extended header information
546 such as creations, renames and mode changes.
547</p>
548</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59549<dt class="hdlist1">
Junio C Hamanod1308c92006-04-16 11:01:09550--patch-with-stat
551</dt>
552<dd>
553<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37554 Synonym for <tt>-p --stat</tt>.
Junio C Hamanod1308c92006-04-16 11:01:09555</p>
556</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59557<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23558-z
559</dt>
560<dd>
561<p>
Junio C Hamano0c053e82010-04-19 06:46:34562 When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been
563 given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano1a4e8412005-12-27 08:17:23564</p>
Junio C Hamano68cf15a2010-11-06 01:01:59565<div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
Junio C Hamano5706e0b2009-11-24 10:54:16566and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
567respectively, and the pathname will be enclosed in double quotes if
568any of those replacements occurred.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23569</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59570<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23571--name-only
572</dt>
573<dd>
574<p>
575 Show only names of changed files.
576</p>
577</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59578<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23579--name-status
580</dt>
581<dd>
582<p>
Junio C Hamanoa9aee782008-04-23 16:09:20583 Show only names and status of changed files. See the description
584 of the <tt>--diff-filter</tt> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:23585</p>
586</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59587<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55588--submodule[=&lt;format&gt;]
589</dt>
590<dd>
591<p>
592 Chose the output format for submodule differences. &lt;format&gt; can be one of
593 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
594 is used when this option is not given. <em>log</em> is the default value for this
595 option and lists the commits in that commit range like the <em>summary</em>
596 option of <a href="git-submodule.html">git-submodule(1)</a> does.
597</p>
598</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59599<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:12600--color[=&lt;when&gt;]
Junio C Hamano9ae1a062006-07-10 08:12:34601</dt>
602<dd>
603<p>
604 Show colored diff.
Junio C Hamano4aa0bcc2010-03-03 05:13:12605 The value must be always (the default), never, or auto.
Junio C Hamano9ae1a062006-07-10 08:12:34606</p>
607</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59608<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34609--no-color
610</dt>
611<dd>
612<p>
613 Turn off colored diff, even when the configuration file
614 gives the default to color output.
Junio C Hamano4aa0bcc2010-03-03 05:13:12615 Same as <tt>--color=never</tt>.
Junio C Hamano9ae1a062006-07-10 08:12:34616</p>
617</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59618<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53619--word-diff[=&lt;mode&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:41620</dt>
621<dd>
622<p>
Junio C Hamanocc7636a2010-05-21 14:57:53623 Show a word diff, using the &lt;mode&gt; to delimit changed words.
624 By default, words are delimited by whitespace; see
625 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
626 must be one of:
Junio C Hamano85e45fa2006-08-13 07:47:41627</p>
Junio C Hamano68cf15a2010-11-06 01:01:59628<div class="dlist"><dl>
629<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53630color
631</dt>
632<dd>
633<p>
634 Highlight changed words using only colors. Implies <tt>--color</tt>.
635</p>
636</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59637<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53638plain
639</dt>
640<dd>
641<p>
Junio C Hamano68cf15a2010-11-06 01:01:59642 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
Junio C Hamanocc7636a2010-05-21 14:57:53643 attempts to escape the delimiters if they appear in the input,
644 so the output may be ambiguous.
645</p>
646</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59647<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53648porcelain
649</dt>
650<dd>
651<p>
652 Use a special line-based format intended for script
653 consumption. Added/removed/unchanged runs are printed in the
Junio C Hamano68cf15a2010-11-06 01:01:59654 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
Junio C Hamanocc7636a2010-05-21 14:57:53655 character at the beginning of the line and extending to the
656 end of the line. Newlines in the input are represented by a
657 tilde <tt>~</tt> on a line of its own.
658</p>
659</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59660<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53661none
662</dt>
663<dd>
664<p>
665 Disable word diff again.
666</p>
667</dd>
668</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:59669<div class="paragraph"><p>Note that despite the name of the first mode, color is used to
Junio C Hamanocc7636a2010-05-21 14:57:53670highlight the changed parts in all modes if enabled.</p></div>
671</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59672<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53673--word-diff-regex=&lt;regex&gt;
674</dt>
675<dd>
676<p>
677 Use &lt;regex&gt; to decide what a word is, instead of considering
678 runs of non-whitespace to be a word. Also implies
679 <tt>--word-diff</tt> unless it was already enabled.
680</p>
Junio C Hamano68cf15a2010-11-06 01:01:59681<div class="paragraph"><p>Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:02682&lt;regex&gt; is considered a word. Anything between these matches is
683considered whitespace and ignored(!) for the purposes of finding
684differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
685expression to make sure that it matches all non-whitespace characters.
686A match that contains a newline is silently truncated(!) at the
687newline.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59688<div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
Junio C Hamano20d47e32009-01-26 06:36:02689<a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
690overrides any diff driver or configuration setting. Diff drivers
691override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:41692</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59693<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53694--color-words[=&lt;regex&gt;]
695</dt>
696<dd>
697<p>
698 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
699 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
700</p>
701</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59702<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34703--no-renames
704</dt>
705<dd>
706<p>
707 Turn off rename detection, even when the configuration
708 file gives the default to do so.
709</p>
710</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59711<dt class="hdlist1">
Junio C Hamanoa890c4f2007-01-28 10:29:21712--check
713</dt>
714<dd>
715<p>
716 Warn if changes introduce trailing whitespace
Junio C Hamano3dac5042007-12-15 08:40:54717 or an indent that uses a space before a tab. Exits with
718 non-zero status if problems are found. Not compatible with
719 --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:21720</p>
721</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59722<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23723--full-index
724</dt>
725<dd>
726<p>
Junio C Hamano5cf43ca2008-08-20 09:14:14727 Instead of the first handful of characters, show the full
728 pre- and post-image blob object names on the "index"
729 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:23730</p>
731</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59732<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34733--binary
734</dt>
735<dd>
736<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37737 In addition to <tt>--full-index</tt>, output a binary diff that
738 can be applied with <tt>git-apply</tt>.
Junio C Hamano9ae1a062006-07-10 08:12:34739</p>
740</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59741<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23742--abbrev[=&lt;n&gt;]
743</dt>
744<dd>
745<p>
746 Instead of showing the full 40-byte hexadecimal object
747 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56748 lines, show only a partial prefix. This is
Junio C Hamano3b70d3c2009-11-21 17:37:37749 independent of the <tt>--full-index</tt> option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:23750 the diff-patch output format. Non default number of
Junio C Hamano3b70d3c2009-11-21 17:37:37751 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
Junio C Hamano1a4e8412005-12-27 08:17:23752</p>
753</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59754<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14755-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:23756</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59757<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:54758--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
759</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23760<dd>
761<p>
Junio C Hamanoe85e36f2010-08-10 05:30:14762 Break complete rewrite changes into pairs of delete and
763 create. This serves two purposes:
Junio C Hamano1a4e8412005-12-27 08:17:23764</p>
Junio C Hamano68cf15a2010-11-06 01:01:59765<div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
Junio C Hamanoe85e36f2010-08-10 05:30:14766not as a series of deletion and insertion mixed together with a very
767few lines that happen to match textually as the context, but as a
768single deletion of everything old followed by a single insertion of
769everything new, and the number <tt>m</tt> controls this aspect of the -B
770option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
771original should remain in the result for git to consider it a total
772rewrite (i.e. otherwise the resulting patch will be a series of
773deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59774<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:14775source of a rename (usually -M only considers a file that disappeared
776as the source of a rename), and the number <tt>n</tt> controls this aspect of
777the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:59778addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:14779eligible for being picked up as a possible source of a rename to
780another file.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23781</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59782<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14783-M[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:23784</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59785<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:26786--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:54787</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23788<dd>
789<p>
790 Detect renames.
Junio C Hamanoe85e36f2010-08-10 05:30:14791 If <tt>n</tt> is specified, it is a is a threshold on the similarity
792 index (i.e. amount of addition/deletions compared to the
Junio C Hamano68cf15a2010-11-06 01:01:59793 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:14794 delete/add pair to be a rename if more than 90% of the file
Junio C Hamano68cf15a2010-11-06 01:01:59795 hasn&#8217;t changed.
Junio C Hamano1a4e8412005-12-27 08:17:23796</p>
797</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59798<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:14799-C[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:23800</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59801<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:26802--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:54803</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23804<dd>
805<p>
Junio C Hamano16f98872007-06-12 16:09:14806 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
Junio C Hamanoe85e36f2010-08-10 05:30:14807 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
Junio C Hamano1a4e8412005-12-27 08:17:23808</p>
809</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59810<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23811--find-copies-harder
812</dt>
813<dd>
814<p>
Junio C Hamano16f98872007-06-12 16:09:14815 For performance reasons, by default, <tt>-C</tt> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:23816 if the original file of the copy was modified in the same
817 changeset. This flag makes the command
818 inspect unmodified files as candidates for the source of
819 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14820 projects, so use it with caution. Giving more than one
821 <tt>-C</tt> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:23822</p>
823</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59824<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23825-l&lt;num&gt;
826</dt>
827<dd>
828<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37829 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:23830 is the number of potential rename/copy targets. This
831 option prevents rename/copy detection from running if
832 the number of rename/copy targets exceeds the specified
833 number.
834</p>
835</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59836<dt class="hdlist1">
Junio C Hamano982eb112010-11-18 00:53:09837--diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
838</dt>
839<dd>
840<p>
841 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
842 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
843 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
844 are Unmerged (<tt>U</tt>), are
845 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
846 Any combination of the filter characters (including none) can be used.
847 When <tt>*</tt> (All-or-none) is added to the combination, all
848 paths are selected if there is any file that matches
849 other criteria in the comparison; if there is no file
850 that matches other criteria, nothing is selected.
851</p>
852</dd>
853<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23854-S&lt;string&gt;
855</dt>
856<dd>
857<p>
Junio C Hamano5217a272009-03-21 00:39:33858 Look for differences that introduce or remove an instance of
859 &lt;string&gt;. Note that this is different than the string simply
860 appearing in diff output; see the <em>pickaxe</em> entry in
861 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
Junio C Hamano1a4e8412005-12-27 08:17:23862</p>
863</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59864<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:34865-G&lt;regex&gt;
866</dt>
867<dd>
868<p>
869 Look for differences whose added or removed line matches
870 the given &lt;regex&gt;.
871</p>
872</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59873<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23874--pickaxe-all
875</dt>
876<dd>
877<p>
Junio C Hamano3b4609d2010-09-30 00:04:34878 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:23879 changeset, not just the files that contain the change
880 in &lt;string&gt;.
881</p>
882</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59883<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:28884--pickaxe-regex
885</dt>
886<dd>
887<p>
888 Make the &lt;string&gt; not a plain string but an extended POSIX
889 regex to match.
890</p>
891</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59892<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23893-O&lt;orderfile&gt;
894</dt>
895<dd>
896<p>
897 Output the patch in the order specified in the
898 &lt;orderfile&gt;, which has one shell glob pattern per line.
899</p>
900</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59901<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23902-R
903</dt>
904<dd>
905<p>
906 Swap two inputs; that is, show differences from index or
907 on-disk file to tree contents.
908</p>
909</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59910<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:44911--relative[=&lt;path&gt;]
912</dt>
913<dd>
914<p>
915 When run from a subdirectory of the project, it can be
916 told to exclude changes outside the directory and show
917 pathnames relative to it with this option. When you are
918 not in a subdirectory (e.g. in a bare repository), you
919 can name which subdirectory to make the output relative
920 to by giving a &lt;path&gt; as an argument.
921</p>
922</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59923<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22924-a
925</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59926<dt class="hdlist1">
Junio C Hamanoc26f5482006-07-09 09:38:14927--text
928</dt>
929<dd>
930<p>
931 Treat all files as text.
932</p>
933</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59934<dt class="hdlist1">
Junio C Hamanofd468962007-02-14 23:45:04935--ignore-space-at-eol
936</dt>
937<dd>
938<p>
Junio C Hamano3a702342007-12-12 21:34:02939 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:04940</p>
941</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59942<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22943-b
944</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59945<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:07946--ignore-space-change
947</dt>
948<dd>
949<p>
Junio C Hamano3a702342007-12-12 21:34:02950 Ignore changes in amount of whitespace. This ignores whitespace
951 at line end, and considers all other sequences of one or
952 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:07953</p>
954</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59955<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22956-w
Junio C Hamanod9c2d2f2006-12-06 08:59:07957</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59958<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:07959--ignore-all-space
960</dt>
961<dd>
962<p>
Junio C Hamano3a702342007-12-12 21:34:02963 Ignore whitespace when comparing lines. This ignores
964 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:07965 line has none.
966</p>
967</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59968<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:16969--inter-hunk-context=&lt;lines&gt;
970</dt>
971<dd>
972<p>
973 Show the context between diff hunks, up to the specified number
974 of lines, thereby fusing hunks that are close to each other.
975</p>
976</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59977<dt class="hdlist1">
Junio C Hamano48fd2f62007-03-19 02:02:30978--exit-code
979</dt>
980<dd>
981<p>
982 Make the program exit with codes similar to diff(1).
983 That is, it exits with 1 if there were differences and
984 0 means no differences.
985</p>
986</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59987<dt class="hdlist1">
Junio C Hamano35e57552007-03-25 07:54:35988--quiet
989</dt>
990<dd>
991<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37992 Disable all output of the program. Implies <tt>--exit-code</tt>.
Junio C Hamano35e57552007-03-25 07:54:35993</p>
994</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59995<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:40996--ext-diff
997</dt>
998<dd>
999<p>
1000 Allow an external diff helper to be executed. If you set an
Junio C Hamano1b50ce92007-10-03 12:05:531001 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1002 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401003</p>
1004</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591005<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401006--no-ext-diff
1007</dt>
1008<dd>
1009<p>
1010 Disallow external diff drivers.
1011</p>
1012</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591013<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511014--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141015</dt>
1016<dd>
1017<p>
Junio C Hamano7d449522010-07-01 00:08:511018 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamano619596a2010-08-18 22:15:351019 either "none", "untracked", "dirty" or "all", which is the default
1020 Using "none" will consider the submodule modified when it either contains
1021 untracked or modified files or its HEAD differs from the commit recorded
1022 in the superproject and can be used to override any settings of the
1023 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
Junio C Hamano7d449522010-07-01 00:08:511024 "untracked" is used submodules are not considered dirty when they only
1025 contain untracked content (but they are still scanned for modified
1026 content). Using "dirty" ignores all changes to the work tree of submodules,
1027 only changes to the commits stored in the superproject are shown (this was
1028 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141029</p>
1030</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591031<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331032--src-prefix=&lt;prefix&gt;
1033</dt>
1034<dd>
1035<p>
1036 Show the given source prefix instead of "a/".
1037</p>
1038</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591039<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331040--dst-prefix=&lt;prefix&gt;
1041</dt>
1042<dd>
1043<p>
1044 Show the given destination prefix instead of "b/".
1045</p>
1046</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591047<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331048--no-prefix
1049</dt>
1050<dd>
1051<p>
1052 Do not show any source or destination prefix.
1053</p>
1054</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311055</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591056<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoba4b9282008-07-06 05:20:311057<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591058<div class="dlist"><dl>
1059<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231060&lt;tree-ish&gt;
1061</dt>
1062<dd>
1063<p>
1064 The id of a tree object.
1065</p>
1066</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591067<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231068&lt;path&gt;&#8230;
1069</dt>
1070<dd>
1071<p>
1072 If provided, the results are limited to a subset of files
1073 matching one of these prefix strings.
Junio C Hamano341071d2006-06-04 07:24:481074 i.e., file matches <tt>/^&lt;pattern1&gt;|&lt;pattern2&gt;|&#8230;/</tt>
Junio C Hamano1a4e8412005-12-27 08:17:231075 Note that this parameter does not provide any wildcard or regexp
1076 features.
1077</p>
1078</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591079<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231080-r
1081</dt>
1082<dd>
1083<p>
1084 recurse into sub-trees
1085</p>
1086</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591087<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231088-t
1089</dt>
1090<dd>
1091<p>
1092 show tree entry itself as well as subtrees. Implies -r.
1093</p>
1094</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591095<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231096--root
1097</dt>
1098<dd>
1099<p>
Junio C Hamano54bf1e22008-12-20 06:30:111100 When <em>--root</em> is specified the initial commit will be shown as a big
Junio C Hamano1a4e8412005-12-27 08:17:231101 creation event. This is equivalent to a diff against the NULL tree.
1102</p>
1103</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591104<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231105--stdin
1106</dt>
1107<dd>
1108<p>
1109 When <em>--stdin</em> is specified, the command does not take
1110 &lt;tree-ish&gt; arguments from the command line. Instead, it
Junio C Hamano3f2f6e52008-08-21 10:34:221111 reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a
1112 list of &lt;commit&gt; from its standard input. (Use a single space
1113 as separator.)
Junio C Hamano1a4e8412005-12-27 08:17:231114</p>
Junio C Hamano68cf15a2010-11-06 01:01:591115<div class="paragraph"><p>When two trees are given, it compares the first tree with the second.
Junio C Hamano3f2f6e52008-08-21 10:34:221116When a single commit is given, it compares the commit with its
1117parents. The remaining commits, when given, are used as if they are
Junio C Hamanob53db3c2008-08-07 00:17:521118parents of the first commit.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591119<div class="paragraph"><p>When comparing two trees, the ID of both trees (separated by a space
Junio C Hamano3f2f6e52008-08-21 10:34:221120and terminated by a newline) is printed before the difference. When
1121comparing commits, the ID of the first (or only) commit, followed by a
1122newline, is printed.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591123<div class="paragraph"><p>The following flags further affect the behavior when comparing
Junio C Hamano3f2f6e52008-08-21 10:34:221124commits (but not trees).</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231125</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591126<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231127-m
1128</dt>
1129<dd>
1130<p>
Junio C Hamano1aa40d22010-01-21 17:46:431131 By default, <em>git diff-tree --stdin</em> does not show
Junio C Hamano1a4e8412005-12-27 08:17:231132 differences for merge commits. With this flag, it shows
Junio C Hamanoa8adb1e2006-04-10 23:46:161133 differences to that commit from all of its parents. See
1134 also <em>-c</em>.
Junio C Hamano1a4e8412005-12-27 08:17:231135</p>
1136</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591137<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231138-s
1139</dt>
1140<dd>
1141<p>
Junio C Hamano1aa40d22010-01-21 17:46:431142 By default, <em>git diff-tree --stdin</em> shows differences,
Junio C Hamano1a4e8412005-12-27 08:17:231143 either in machine-readable form (without <em>-p</em>) or in patch
Junio C Hamano235a91e2006-01-07 01:13:581144 form (with <em>-p</em>). This output can be suppressed. It is
Junio C Hamano1a4e8412005-12-27 08:17:231145 only useful with <em>-v</em> flag.
1146</p>
1147</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591148<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231149-v
1150</dt>
1151<dd>
1152<p>
Junio C Hamano1aa40d22010-01-21 17:46:431153 This flag causes <em>git diff-tree --stdin</em> to also show
Junio C Hamano1a4e8412005-12-27 08:17:231154 the commit message before the differences.
1155</p>
1156</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591157<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:171158--pretty[=&lt;format&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231159</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591160<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:171161--format=&lt;format&gt;
Junio C Hamano0a235222009-03-06 08:21:091162</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231163<dd>
1164<p>
Junio C Hamanoa3770f92007-07-25 08:53:331165 Pretty-print the contents of the commit logs in a given format,
Junio C Hamano0430e3a2007-05-15 03:13:171166 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
Junio C Hamanoe32ec8b2010-06-02 23:32:311167 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>. See
1168 the "PRETTY FORMATS" section for some additional details for each
1169 format. When omitted, the format defaults to <em>medium</em>.
Junio C Hamano1a4e8412005-12-27 08:17:231170</p>
Junio C Hamano68cf15a2010-11-06 01:01:591171<div class="paragraph"><p>Note: you can specify the default pretty format in the repository
Junio C Hamanoba4b9282008-07-06 05:20:311172configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:171173</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591174<dt class="hdlist1">
Junio C Hamanoee695f22007-06-21 00:35:361175--abbrev-commit
1176</dt>
1177<dd>
1178<p>
1179 Instead of showing the full 40-byte hexadecimal commit object
Junio C Hamano6efe3022009-01-13 16:47:561180 name, show only a partial prefix. Non default number of
Junio C Hamanoee695f22007-06-21 00:35:361181 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
1182 diff output, if it is displayed).
1183</p>
Junio C Hamano68cf15a2010-11-06 01:01:591184<div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
Junio C Hamanoba4b9282008-07-06 05:20:311185people using 80-column terminals.</p></div>
Junio C Hamanoee695f22007-06-21 00:35:361186</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591187<dt class="hdlist1">
Junio C Hamano0a235222009-03-06 08:21:091188--oneline
1189</dt>
1190<dd>
1191<p>
1192 This is a shorthand for "--pretty=oneline --abbrev-commit"
1193 used together.
1194</p>
1195</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591196<dt class="hdlist1">
Junio C Hamano0430e3a2007-05-15 03:13:171197--encoding[=&lt;encoding&gt;]
1198</dt>
1199<dd>
1200<p>
1201 The commit objects record the encoding used for the log message
1202 in their encoding header; this option can be used to tell the
1203 command to re-code the commit log message in the encoding
1204 preferred by the user. For non plumbing commands this
1205 defaults to UTF-8.
1206</p>
1207</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591208<dt class="hdlist1">
Junio C Hamano57827fb2010-01-23 03:02:501209--no-notes
1210</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591211<dt class="hdlist1">
Junio C Hamano31667362010-03-25 00:38:531212--show-notes[=&lt;ref&gt;]
Junio C Hamano57827fb2010-01-23 03:02:501213</dt>
1214<dd>
1215<p>
1216 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
1217 commit, when showing the commit log message. This is the default
1218 for <tt>git log</tt>, <tt>git show</tt> and <tt>git whatchanged</tt> commands when
1219 there is no <tt>--pretty</tt>, <tt>--format</tt> nor <tt>--oneline</tt> option is
1220 given on the command line.
1221</p>
Junio C Hamano68cf15a2010-11-06 01:01:591222<div class="paragraph"><p>With an optional argument, add this ref to the list of notes. The ref
Junio C Hamano31667362010-03-25 00:38:531223is taken to be in <tt>refs/notes/</tt> if it is not qualified.</p></div>
1224</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591225<dt class="hdlist1">
Junio C Hamano31667362010-03-25 00:38:531226--[no-]standard-notes
1227</dt>
1228<dd>
1229<p>
1230 Enable or disable populating the notes ref list from the
1231 <em>core.notesRef</em> and <em>notes.displayRef</em> variables (or
1232 corresponding environment overrides). Enabled by default.
1233 See <a href="git-config.html">git-config(1)</a>.
1234</p>
Junio C Hamano57827fb2010-01-23 03:02:501235</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591236<dt class="hdlist1">
Junio C Hamano0430e3a2007-05-15 03:13:171237--no-commit-id
1238</dt>
1239<dd>
1240<p>
Junio C Hamano1aa40d22010-01-21 17:46:431241 <em>git diff-tree</em> outputs a line with the commit ID when
Junio C Hamano0430e3a2007-05-15 03:13:171242 applicable. This flag suppressed the commit ID output.
1243</p>
1244</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591245<dt class="hdlist1">
Junio C Hamano0430e3a2007-05-15 03:13:171246-c
1247</dt>
1248<dd>
1249<p>
1250 This flag changes the way a merge commit is displayed
1251 (which means it is useful only when the command is given
1252 one &lt;tree-ish&gt;, or <em>--stdin</em>). It shows the differences
1253 from each of the parents to the merge result simultaneously
1254 instead of showing pairwise diff between a parent and the
1255 result one at a time (which is what the <em>-m</em> option does).
1256 Furthermore, it lists only files which were modified
1257 from all parents.
1258</p>
1259</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591260<dt class="hdlist1">
Junio C Hamano0430e3a2007-05-15 03:13:171261--cc
1262</dt>
1263<dd>
1264<p>
1265 This flag changes the way a merge commit patch is displayed,
1266 in a similar way to the <em>-c</em> option. It implies the <em>-c</em>
1267 and <em>-p</em> options and further compresses the patch output
Junio C Hamanoccc2f762008-07-24 04:03:331268 by omitting uninteresting hunks whose the contents in the parents
1269 have only two variants and the merge result picks one of them
1270 without modification. When all hunks are uninteresting, the commit
1271 itself and the commit log message is not shown, just like in any other
1272 "empty diff" case.
Junio C Hamano0430e3a2007-05-15 03:13:171273</p>
1274</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591275<dt class="hdlist1">
Junio C Hamano0430e3a2007-05-15 03:13:171276--always
1277</dt>
1278<dd>
1279<p>
1280 Show the commit itself and the commit log message even
1281 if the diff itself is empty.
1282</p>
1283</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311284</dl></div>
Junio C Hamano0430e3a2007-05-15 03:13:171285</div>
Junio C Hamanoba4b9282008-07-06 05:20:311286<h2 id="_pretty_formats">PRETTY FORMATS</h2>
Junio C Hamano0430e3a2007-05-15 03:13:171287<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591288<div class="paragraph"><p>If the commit is a merge, and if the pretty-format
Junio C Hamano0430e3a2007-05-15 03:13:171289is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1290inserted before the <em>Author:</em> line. This line begins with
1291"Merge: " and the sha1s of ancestral commits are printed,
1292separated by spaces. Note that the listed commits may not
1293necessarily be the list of the <strong>direct</strong> parent commits if you
1294have limited your view of history: for example, if you are
1295only interested in changes related to a certain directory or
Junio C Hamanoba4b9282008-07-06 05:20:311296file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591297<div class="paragraph"><p>There are several built-in formats, and you can define
Junio C Hamanoa574a092010-06-13 19:57:101298additional formats by setting a pretty.&lt;name&gt;
1299config option to either another format name, or a
1300<em>format:</em> string, as described below (see
1301<a href="git-config.html">git-config(1)</a>). Here are the details of the
1302built-in formats:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591303<div class="ulist"><ul>
Junio C Hamanoa340aaa2006-11-23 02:47:331304<li>
1305<p>
1306<em>oneline</em>
1307</p>
1308<div class="literalblock">
1309<div class="content">
1310<pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
1311</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591312<div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:331313</li>
1314<li>
1315<p>
1316<em>short</em>
1317</p>
1318<div class="literalblock">
1319<div class="content">
1320<pre><tt>commit &lt;sha1&gt;
1321Author: &lt;author&gt;</tt></pre>
1322</div></div>
1323<div class="literalblock">
1324<div class="content">
1325<pre><tt>&lt;title line&gt;</tt></pre>
1326</div></div>
1327</li>
1328<li>
1329<p>
1330<em>medium</em>
1331</p>
1332<div class="literalblock">
1333<div class="content">
1334<pre><tt>commit &lt;sha1&gt;
1335Author: &lt;author&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181336Date: &lt;author date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331337</div></div>
1338<div class="literalblock">
1339<div class="content">
1340<pre><tt>&lt;title line&gt;</tt></pre>
1341</div></div>
1342<div class="literalblock">
1343<div class="content">
1344<pre><tt>&lt;full commit message&gt;</tt></pre>
1345</div></div>
1346</li>
1347<li>
1348<p>
1349<em>full</em>
1350</p>
1351<div class="literalblock">
1352<div class="content">
1353<pre><tt>commit &lt;sha1&gt;
1354Author: &lt;author&gt;
1355Commit: &lt;committer&gt;</tt></pre>
1356</div></div>
1357<div class="literalblock">
1358<div class="content">
1359<pre><tt>&lt;title line&gt;</tt></pre>
1360</div></div>
1361<div class="literalblock">
1362<div class="content">
1363<pre><tt>&lt;full commit message&gt;</tt></pre>
1364</div></div>
1365</li>
1366<li>
1367<p>
1368<em>fuller</em>
1369</p>
1370<div class="literalblock">
1371<div class="content">
1372<pre><tt>commit &lt;sha1&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181373Author: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311374AuthorDate: &lt;author date&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181375Commit: &lt;committer&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311376CommitDate: &lt;committer date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331377</div></div>
1378<div class="literalblock">
1379<div class="content">
1380<pre><tt>&lt;title line&gt;</tt></pre>
1381</div></div>
1382<div class="literalblock">
1383<div class="content">
1384<pre><tt>&lt;full commit message&gt;</tt></pre>
1385</div></div>
1386</li>
1387<li>
1388<p>
1389<em>email</em>
1390</p>
1391<div class="literalblock">
1392<div class="content">
1393<pre><tt>From &lt;sha1&gt; &lt;date&gt;
1394From: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311395Date: &lt;author date&gt;
Junio C Hamanoa340aaa2006-11-23 02:47:331396Subject: [PATCH] &lt;title line&gt;</tt></pre>
1397</div></div>
1398<div class="literalblock">
1399<div class="content">
Junio C Hamano0430e3a2007-05-15 03:13:171400<pre><tt>&lt;full commit message&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331401</div></div>
1402</li>
1403<li>
1404<p>
1405<em>raw</em>
1406</p>
Junio C Hamano68cf15a2010-11-06 01:01:591407<div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
Junio C Hamanoa340aaa2006-11-23 02:47:331408stored in the commit object. Notably, the SHA1s are
1409displayed in full, regardless of whether --abbrev or
1410--no-abbrev are used, and <em>parents</em> information show the
1411true parent commits, without taking grafts nor history
Junio C Hamanoba4b9282008-07-06 05:20:311412simplification into account.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:331413</li>
Junio C Hamanoa3fd83c2007-03-02 10:34:361414<li>
1415<p>
Junio C Hamanoe32ec8b2010-06-02 23:32:311416<em>format:&lt;string&gt;</em>
Junio C Hamanoa3fd83c2007-03-02 10:34:361417</p>
Junio C Hamano68cf15a2010-11-06 01:01:591418<div class="paragraph"><p>The <em>format:&lt;string&gt;</em> format allows you to specify which information
Junio C Hamanoa3fd83c2007-03-02 10:34:361419you want to show. It works a little bit like printf format,
1420with the notable exception that you get a newline with <em>%n</em>
Junio C Hamanoba4b9282008-07-06 05:20:311421instead of <em>\n</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591422<div class="paragraph"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
Junio C Hamanoba4b9282008-07-06 05:20:311423would show something like this:</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:171424<div class="listingblock">
1425<div class="content">
1426<pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
Junio C Hamano68cf15a2010-11-06 01:01:591427The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</tt></pre>
Junio C Hamano0430e3a2007-05-15 03:13:171428</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591429<div class="paragraph"><p>The placeholders are:</p></div>
1430<div class="ulist"><ul>
Junio C Hamanoa3fd83c2007-03-02 10:34:361431<li>
1432<p>
1433<em>%H</em>: commit hash
1434</p>
1435</li>
1436<li>
1437<p>
1438<em>%h</em>: abbreviated commit hash
1439</p>
1440</li>
1441<li>
1442<p>
1443<em>%T</em>: tree hash
1444</p>
1445</li>
1446<li>
1447<p>
1448<em>%t</em>: abbreviated tree hash
1449</p>
1450</li>
1451<li>
1452<p>
1453<em>%P</em>: parent hashes
1454</p>
1455</li>
1456<li>
1457<p>
1458<em>%p</em>: abbreviated parent hashes
1459</p>
1460</li>
1461<li>
1462<p>
1463<em>%an</em>: author name
1464</p>
1465</li>
1466<li>
1467<p>
Junio C Hamano8bc410e2009-02-15 10:38:191468<em>%aN</em>: author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
Junio C Hamanof5a93622008-07-16 03:23:571469</p>
1470</li>
1471<li>
1472<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361473<em>%ae</em>: author email
1474</p>
1475</li>
1476<li>
1477<p>
Junio C Hamano8bc410e2009-02-15 10:38:191478<em>%aE</em>: author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1479</p>
1480</li>
1481<li>
1482<p>
Junio C Hamanoa387df32008-08-29 08:56:581483<em>%ad</em>: author date (format respects --date= option)
Junio C Hamanoa3fd83c2007-03-02 10:34:361484</p>
1485</li>
1486<li>
1487<p>
1488<em>%aD</em>: author date, RFC2822 style
1489</p>
1490</li>
1491<li>
1492<p>
1493<em>%ar</em>: author date, relative
1494</p>
1495</li>
1496<li>
1497<p>
1498<em>%at</em>: author date, UNIX timestamp
1499</p>
1500</li>
1501<li>
1502<p>
Junio C Hamano02f130b2007-07-14 08:26:561503<em>%ai</em>: author date, ISO 8601 format
1504</p>
1505</li>
1506<li>
1507<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361508<em>%cn</em>: committer name
1509</p>
1510</li>
1511<li>
1512<p>
Junio C Hamano8bc410e2009-02-15 10:38:191513<em>%cN</em>: committer name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
Junio C Hamanof5a93622008-07-16 03:23:571514</p>
1515</li>
1516<li>
1517<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361518<em>%ce</em>: committer email
1519</p>
1520</li>
1521<li>
1522<p>
Junio C Hamano8bc410e2009-02-15 10:38:191523<em>%cE</em>: committer email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1524</p>
1525</li>
1526<li>
1527<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361528<em>%cd</em>: committer date
1529</p>
1530</li>
1531<li>
1532<p>
1533<em>%cD</em>: committer date, RFC2822 style
1534</p>
1535</li>
1536<li>
1537<p>
1538<em>%cr</em>: committer date, relative
1539</p>
1540</li>
1541<li>
1542<p>
1543<em>%ct</em>: committer date, UNIX timestamp
1544</p>
1545</li>
1546<li>
1547<p>
Junio C Hamano02f130b2007-07-14 08:26:561548<em>%ci</em>: committer date, ISO 8601 format
1549</p>
1550</li>
1551<li>
1552<p>
Junio C Hamano5e4d8de2008-09-19 06:27:021553<em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
1554</p>
1555</li>
1556<li>
1557<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361558<em>%e</em>: encoding
1559</p>
1560</li>
1561<li>
1562<p>
1563<em>%s</em>: subject
1564</p>
1565</li>
1566<li>
1567<p>
Junio C Hamano5f9a6f02009-04-06 08:26:561568<em>%f</em>: sanitized subject line, suitable for a filename
1569</p>
1570</li>
1571<li>
1572<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361573<em>%b</em>: body
1574</p>
1575</li>
1576<li>
1577<p>
Junio C Hamanocb39aea2010-05-09 07:24:481578<em>%B</em>: raw body (unwrapped subject and body)
1579</p>
1580</li>
1581<li>
1582<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371583<em>%N</em>: commit notes
1584</p>
1585</li>
1586<li>
1587<p>
Junio C Hamanoc21ab052009-10-31 04:03:551588<em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
1589</p>
1590</li>
1591<li>
1592<p>
1593<em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
1594</p>
1595</li>
1596<li>
1597<p>
1598<em>%gs</em>: reflog subject
1599</p>
1600</li>
1601<li>
1602<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361603<em>%Cred</em>: switch color to red
1604</p>
1605</li>
1606<li>
1607<p>
1608<em>%Cgreen</em>: switch color to green
1609</p>
1610</li>
1611<li>
1612<p>
1613<em>%Cblue</em>: switch color to blue
1614</p>
1615</li>
1616<li>
1617<p>
1618<em>%Creset</em>: reset color
1619</p>
1620</li>
1621<li>
1622<p>
Junio C Hamanocc0cb312009-01-22 03:38:501623<em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
1624</p>
1625</li>
1626<li>
1627<p>
Junio C Hamanod9e0e5d2007-04-14 16:22:041628<em>%m</em>: left, right or boundary mark
1629</p>
1630</li>
1631<li>
1632<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361633<em>%n</em>: newline
1634</p>
Junio C Hamano0430e3a2007-05-15 03:13:171635</li>
Junio C Hamanob78d2592008-04-09 09:39:081636<li>
1637<p>
Junio C Hamanoa9701f02010-01-21 00:42:161638<em>%%</em>: a raw <em>%</em>
1639</p>
1640</li>
1641<li>
1642<p>
Junio C Hamanob78d2592008-04-09 09:39:081643<em>%x00</em>: print a byte from a hex code
1644</p>
1645</li>
Junio C Hamanobf984de2009-11-23 06:11:191646<li>
1647<p>
1648<em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
Junio C Hamano5706e0b2009-11-24 10:54:161649 <a href="git-shortlog.html">git-shortlog(1)</a>.
Junio C Hamanobf984de2009-11-23 06:11:191650</p>
1651</li>
Junio C Hamanoba4b9282008-07-06 05:20:311652</ul></div>
Junio C Hamanoa3fd83c2007-03-02 10:34:361653</li>
Junio C Hamanoc21ab052009-10-31 04:03:551654</ul></div>
1655<div class="admonitionblock">
1656<table><tr>
1657<td class="icon">
1658<div class="title">Note</div>
1659</td>
1660<td class="content">Some placeholders may depend on other options given to the
1661revision traversal engine. For example, the <tt>%g*</tt> reflog options will
1662insert an empty string unless we are traversing reflog entries (e.g., by
1663<tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
1664format if <tt>--decorate</tt> was not already provided on the command line.</td>
1665</tr></table>
1666</div>
Junio C Hamano68cf15a2010-11-06 01:01:591667<div class="paragraph"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
Junio C Hamano2bd8a742009-12-01 21:16:591668is inserted immediately before the expansion if and only if the
1669placeholder expands to a non-empty string.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591670<div class="paragraph"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
Junio C Hamano2bd8a742009-12-01 21:16:591671immediately precede the expansion are deleted if and only if the
1672placeholder expands to an empty string.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591673<div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
Junio C Hamano89a57342010-06-22 23:22:551674is inserted immediately before the expansion if and only if the
1675placeholder expands to a non-empty string.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591676<div class="ulist"><ul>
Junio C Hamano6fb124c2008-06-13 10:04:011677<li>
1678<p>
1679<em>tformat:</em>
1680</p>
Junio C Hamano68cf15a2010-11-06 01:01:591681<div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
Junio C Hamano6fb124c2008-06-13 10:04:011682provides "terminator" semantics instead of "separator" semantics. In
1683other words, each commit has the message terminator character (usually a
1684newline) appended, rather than a separator placed between entries.
1685This means that the final entry of a single-line format will be properly
1686terminated with a new line, just as the "oneline" format does.
Junio C Hamanoba4b9282008-07-06 05:20:311687For example:</p></div>
Junio C Hamano6fb124c2008-06-13 10:04:011688<div class="listingblock">
1689<div class="content">
1690<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
1691 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
16924da45be
16937134973 -- NO NEWLINE
1694
1695$ git log -2 --pretty=tformat:%h 4da45bef \
1696 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
16974da45be
16987134973</tt></pre>
1699</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591700<div class="paragraph"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
Junio C Hamano0a235222009-03-06 08:21:091701as if it has <tt>tformat:</tt> in front of it. For example, these two are
1702equivalent:</p></div>
1703<div class="listingblock">
1704<div class="content">
1705<pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
1706$ git log -2 --pretty=%h 4da45bef</tt></pre>
1707</div></div>
Junio C Hamano6fb124c2008-06-13 10:04:011708</li>
Junio C Hamanoba4b9282008-07-06 05:20:311709</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231710</div>
Junio C Hamanoba4b9282008-07-06 05:20:311711<h2 id="_limiting_output">Limiting Output</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231712<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591713<div class="paragraph"><p>If you&#8217;re only interested in differences in a subset of files, for
Junio C Hamanoba4b9282008-07-06 05:20:311714example some architecture-specific files, you might do:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231715<div class="literalblock">
1716<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381717<pre><tt>git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; arch/ia64 include/asm-ia64</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231718</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591719<div class="paragraph"><p>and it will only show you what changed in those two directories.</p></div>
1720<div class="paragraph"><p>Or if you are searching for what changed in just <tt>kernel/sched.c</tt>, just do</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231721<div class="literalblock">
1722<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381723<pre><tt>git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; kernel/sched.c</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231724</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591725<div class="paragraph"><p>and it will ignore all differences to other files.</p></div>
1726<div class="paragraph"><p>The pattern is always the prefix, and is matched exactly. There are no
Junio C Hamano1a4e8412005-12-27 08:17:231727wildcards. Even stricter, it has to match a complete path component.
1728I.e. "foo" does not pick up <tt>foobar.h</tt>. "foo" does match <tt>foo/bar.h</tt>
Junio C Hamanoba4b9282008-07-06 05:20:311729so it can be used to name subdirectories.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591730<div class="paragraph"><p>An example of normal usage is:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231731<div class="literalblock">
1732<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381733<pre><tt>torvalds@ppc970:~/git&gt; git diff-tree 5319e4......
Junio C Hamano1a4e8412005-12-27 08:17:231734*100664-&gt;100664 blob ac348b.......-&gt;a01513....... git-fsck-objects.c</tt></pre>
1735</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591736<div class="paragraph"><p>which tells you that the last commit changed just one file (it&#8217;s from
Junio C Hamanoba4b9282008-07-06 05:20:311737this one:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231738<div class="listingblock">
1739<div class="content">
1740<pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
1741tree 5319e4d609cdd282069cc4dce33c1db559539b03
1742parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
1743author Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
1744committer Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
1745
1746Make "git-fsck-objects" print out all the root commits it finds.
1747
1748Once I do the reference tracking, I'll also make it print out all the
1749HEAD commits it finds, which is even more interesting.</tt></pre>
1750</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591751<div class="paragraph"><p>in case you care).</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231752</div>
Junio C Hamano543f8d62009-07-29 08:35:211753<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231754<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591755<div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:311756"git-diff-files" and "git diff --raw" are very similar.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591757<div class="paragraph"><p>These commands all compare two sets of things; what is
Junio C Hamanoba4b9282008-07-06 05:20:311758compared differs:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591759<div class="dlist"><dl>
1760<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231761git-diff-index &lt;tree-ish&gt;
1762</dt>
1763<dd>
1764<p>
1765 compares the &lt;tree-ish&gt; and the files on the filesystem.
1766</p>
1767</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591768<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231769git-diff-index --cached &lt;tree-ish&gt;
1770</dt>
1771<dd>
1772<p>
1773 compares the &lt;tree-ish&gt; and the index.
1774</p>
1775</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591776<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231777git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1778</dt>
1779<dd>
1780<p>
1781 compares the trees named by the two arguments.
1782</p>
1783</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591784<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231785git-diff-files [&lt;pattern&gt;&#8230;]
1786</dt>
1787<dd>
1788<p>
1789 compares the index and the files on the filesystem.
1790</p>
1791</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311792</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591793<div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
Junio C Hamano543f8d62009-07-29 08:35:211794what is being compared. After that, all the commands print one output
1795line per changed file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591796<div class="paragraph"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231797<div class="listingblock">
1798<div class="content">
1799<pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1800copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1801rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1802create :000000 100644 0000000... 1234567... A file4
1803delete :100644 000000 1234567... 0000000... D file5
1804unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1805</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591806<div class="paragraph"><p>That is, from the left to the right:</p></div>
1807<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231808<li>
1809<p>
1810a colon.
1811</p>
1812</li>
1813<li>
1814<p>
1815mode for "src"; 000000 if creation or unmerged.
1816</p>
1817</li>
1818<li>
1819<p>
1820a space.
1821</p>
1822</li>
1823<li>
1824<p>
1825mode for "dst"; 000000 if deletion or unmerged.
1826</p>
1827</li>
1828<li>
1829<p>
1830a space.
1831</p>
1832</li>
1833<li>
1834<p>
1835sha1 for "src"; 0{40} if creation or unmerged.
1836</p>
1837</li>
1838<li>
1839<p>
1840a space.
1841</p>
1842</li>
1843<li>
1844<p>
1845sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1846</p>
1847</li>
1848<li>
1849<p>
1850a space.
1851</p>
1852</li>
1853<li>
1854<p>
1855status, followed by optional "score" number.
1856</p>
1857</li>
1858<li>
1859<p>
1860a tab or a NUL when <em>-z</em> option is used.
1861</p>
1862</li>
1863<li>
1864<p>
1865path for "src"
1866</p>
1867</li>
1868<li>
1869<p>
1870a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1871</p>
1872</li>
1873<li>
1874<p>
1875path for "dst"; only exists for C or R.
1876</p>
1877</li>
1878<li>
1879<p>
1880an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1881</p>
1882</li>
Junio C Hamanoba4b9282008-07-06 05:20:311883</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591884<div class="paragraph"><p>Possible status letters are:</p></div>
1885<div class="ulist"><ul>
Junio C Hamanoaa17c7c2008-11-03 04:36:581886<li>
1887<p>
1888A: addition of a file
1889</p>
1890</li>
1891<li>
1892<p>
1893C: copy of a file into a new one
1894</p>
1895</li>
1896<li>
1897<p>
1898D: deletion of a file
1899</p>
1900</li>
1901<li>
1902<p>
1903M: modification of the contents or mode of a file
1904</p>
1905</li>
1906<li>
1907<p>
1908R: renaming of a file
1909</p>
1910</li>
1911<li>
1912<p>
1913T: change in the type of the file
1914</p>
1915</li>
1916<li>
1917<p>
1918U: file is unmerged (you must complete the merge before it can
1919be committed)
1920</p>
1921</li>
1922<li>
1923<p>
1924X: "unknown" change type (most probably a bug, please report it)
1925</p>
1926</li>
1927</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591928<div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:581929percentage of similarity between the source and target of the move or
1930copy), and are the only ones to be so.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591931<div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
Junio C Hamanoba4b9282008-07-06 05:20:311932and it is out of sync with the index.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591933<div class="paragraph"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231934<div class="listingblock">
1935<div class="content">
1936<pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
1937</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591938<div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
Junio C Hamano1a4e8412005-12-27 08:17:231939in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
Junio C Hamanoba4b9282008-07-06 05:20:311940respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231941</div>
Junio C Hamanoba4b9282008-07-06 05:20:311942<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:121943<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591944<div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano7ae0ab22007-11-03 02:46:461945can take <em>-c</em> or <em>--cc</em> option
Junio C Hamano67fad6d2007-05-06 08:53:121946to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:311947from the format described above in the following way:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591948<div class="olist arabic"><ol class="arabic">
Junio C Hamano67fad6d2007-05-06 08:53:121949<li>
1950<p>
1951there is a colon for each parent
1952</p>
1953</li>
1954<li>
1955<p>
1956there are more "src" modes and "src" sha1
1957</p>
1958</li>
1959<li>
1960<p>
1961status is concatenated status characters for each parent
1962</p>
1963</li>
1964<li>
1965<p>
1966no optional "score" number
1967</p>
1968</li>
1969<li>
1970<p>
1971single path, only for "dst"
1972</p>
1973</li>
Junio C Hamanoba4b9282008-07-06 05:20:311974</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591975<div class="paragraph"><p>Example:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121976<div class="listingblock">
1977<div class="content">
1978<pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
1979</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591980<div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
Junio C Hamanoba4b9282008-07-06 05:20:311981all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121982</div>
Junio C Hamanoba4b9282008-07-06 05:20:311983<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231984<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591985<div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano00b8b632007-12-07 09:50:491986with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
1987"git log" with the "-p" option, they
Junio C Hamano7ae0ab22007-11-03 02:46:461988do not produce the output described above; instead they produce a
1989patch file. You can customize the creation of such patches via the
Junio C Hamanoba4b9282008-07-06 05:20:311990GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591991<div class="paragraph"><p>What the -p option produces is slightly different from the traditional
Junio C Hamano7f9fa862010-10-19 23:51:141992diff format:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591993<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231994<li>
1995<p>
Junio C Hamano7f9fa862010-10-19 23:51:141996It is preceded with a "git diff" header that looks like this:
Junio C Hamano1a4e8412005-12-27 08:17:231997</p>
1998<div class="literalblock">
1999<div class="content">
2000<pre><tt>diff --git a/file1 b/file2</tt></pre>
2001</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592002<div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
Junio C Hamano1a4e8412005-12-27 08:17:232003involved. Especially, even for a creation or a deletion,
Junio C Hamano68cf15a2010-11-06 01:01:592004<tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2005<div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
Junio C Hamano1a4e8412005-12-27 08:17:232006name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:312007the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232008</li>
2009<li>
2010<p>
2011It is followed by one or more extended header lines:
2012</p>
2013<div class="literalblock">
2014<div class="content">
2015<pre><tt>old mode &lt;mode&gt;
2016new mode &lt;mode&gt;
2017deleted file mode &lt;mode&gt;
2018new file mode &lt;mode&gt;
2019copy from &lt;path&gt;
2020copy to &lt;path&gt;
2021rename from &lt;path&gt;
2022rename to &lt;path&gt;
2023similarity index &lt;number&gt;
2024dissimilarity index &lt;number&gt;
2025index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
2026</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592027<div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
Junio C Hamano7f9fa862010-10-19 23:51:142028and file permission bits.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592029<div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2030<div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano7f9fa862010-10-19 23:51:142031the dissimilarity index is the percentage of changed lines. It
2032is a rounded down integer, followed by a percent sign. The
2033similarity index value of 100% is thus reserved for two equal
2034files, while 100% dissimilarity means that no line from the old
2035file made it into the new one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592036<div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
Junio C Hamano7f9fa862010-10-19 23:51:142037The &lt;mode&gt; is included if the file mode does not change; otherwise,
2038separate lines indicate the old and the new mode.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232039</li>
2040<li>
2041<p>
Junio C Hamanoa053d542006-10-27 09:29:132042TAB, LF, double quote and backslash characters in pathnames
2043 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
2044 If there is need for such substitution then the whole
2045 pathname is put in double quotes.
Junio C Hamano1a4e8412005-12-27 08:17:232046</p>
2047</li>
Junio C Hamano7f9fa862010-10-19 23:51:142048<li>
2049<p>
2050All the <tt>file1</tt> files in the output refer to files before the
2051 commit, and all the <tt>file2</tt> files refer to files after the commit.
2052 It is incorrect to apply each change to each file sequentially. For
2053 example, this patch will swap a and b:
2054</p>
2055<div class="literalblock">
2056<div class="content">
2057<pre><tt>diff --git a/a b/b
2058rename from a
2059rename to b
2060diff --git a/b b/a
2061rename from b
2062rename to a</tt></pre>
2063</div></div>
2064</li>
Junio C Hamanoba4b9282008-07-06 05:20:312065</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:232066</div>
Junio C Hamanoba4b9282008-07-06 05:20:312067<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:192068<div class="sectionbody">
Junio C Hamanoc5be4cc2011-03-09 07:20:432069<div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
2070produce a <em>combined diff</em> when showing a merge. This is the default
2071format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
2072<a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
2073of these commands to force generation of diffs with individual parents
2074of a merge.</p></div>
2075<div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192076<div class="listingblock">
2077<div class="content">
2078<pre><tt>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:292079index fabadb8,cc95eb0..4866510
2080--- a/describe.c
2081+++ b/describe.c
2082@@@ -98,20 -98,12 +98,20 @@@
2083 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:192084 }
2085
2086- static void describe(char *arg)
2087 -static void describe(struct commit *cmit, int last_one)
2088++static void describe(char *arg, int last_one)
2089 {
Junio C Hamano29f14312006-10-26 08:47:292090 + unsigned char sha1[20];
2091 + struct commit *cmit;
2092 struct commit_list *list;
2093 static int initialized = 0;
2094 struct commit_name *n;
2095
2096 + if (get_sha1(arg, sha1) &lt; 0)
2097 + usage(describe_usage);
2098 + cmit = lookup_commit_reference(sha1);
2099 + if (!cmit)
2100 + usage(describe_usage);
2101 +
2102 if (!initialized) {
2103 initialized = 1;
2104 for_each_ref(get_name);</tt></pre>
Junio C Hamanofb56a962006-01-28 10:38:192105</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592106<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:292107<li>
2108<p>
2109It is preceded with a "git diff" header, that looks like
2110 this (when <em>-c</em> option is used):
2111</p>
2112<div class="literalblock">
2113<div class="content">
2114<pre><tt>diff --combined file</tt></pre>
2115</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592116<div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:292117<div class="literalblock">
2118<div class="content">
Junio C Hamano0868a302008-07-22 09:20:442119<pre><tt>diff --cc file</tt></pre>
Junio C Hamano29f14312006-10-26 08:47:292120</div></div>
2121</li>
2122<li>
2123<p>
2124It is followed by one or more extended header lines
2125 (this example shows a merge with two parents):
2126</p>
2127<div class="literalblock">
2128<div class="content">
2129<pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
2130mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2131new file mode &lt;mode&gt;
2132deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
2133</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592134<div class="paragraph"><p>The <tt>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</tt> line appears only if at least one of
Junio C Hamanoee1e4282007-02-04 08:32:042135the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:292136information about detected contents movement (renames and
2137copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:312138&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292139</li>
2140<li>
2141<p>
2142It is followed by two-line from-file/to-file header
2143</p>
2144<div class="literalblock">
2145<div class="content">
2146<pre><tt>--- a/file
2147+++ b/file</tt></pre>
2148</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592149<div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamano29f14312006-10-26 08:47:292150format, <tt>/dev/null</tt> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:312151files.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292152</li>
2153<li>
2154<p>
2155Chunk header format is modified to prevent people from
2156 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
2157 was created for review of merge commit changes, and was not
2158 meant for apply. The change is similar to the change in the
2159 extended <em>index</em> header:
2160</p>
2161<div class="literalblock">
2162<div class="content">
2163<pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
2164</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592165<div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
Junio C Hamanoba4b9282008-07-06 05:20:312166header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292167</li>
Junio C Hamanoba4b9282008-07-06 05:20:312168</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592169<div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
2170files A and B with a single column that has <tt>-</tt> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <tt>+</tt> (plus&#8201;&#8212;&#8201;missing in A but
2171added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:192172compares two or more files file1, file2,&#8230; with one file X, and
2173shows how X differs from each of fileN. One column for each of
Junio C Hamano68cf15a2010-11-06 01:01:592174fileN is prepended to the output line to note how X&#8217;s line is
Junio C Hamanoba4b9282008-07-06 05:20:312175different from it.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592176<div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
Junio C Hamano29f14312006-10-26 08:47:292177fileN but it does not appear in the result. A <tt>+</tt> character
Junio C Hamano54bf1e22008-12-20 06:30:112178in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:292179and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:312180added, from the point of view of that parent).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592181<div class="paragraph"><p>In the above example output, the function signature was changed
Junio C Hamanofb56a962006-01-28 10:38:192182from both files (hence two <tt>-</tt> removals from both file1 and
Junio C Hamano5e4d8de2008-09-19 06:27:022183file2, plus <tt>++</tt> to mean one line that was added does not appear
Junio C Hamano54bf1e22008-12-20 06:30:112184in either file1 nor file2). Also eight other lines are the same
2185from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592186<div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
Junio C Hamanofb56a962006-01-28 10:38:192187merge commit with the merge result (i.e. file1..fileN are the
2188parents). When shown by <tt>git diff-files -c</tt>, it compares the
2189two unresolved merge parents with the working tree file
2190(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:312191"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192192</div>
Junio C Hamanoba4b9282008-07-06 05:20:312193<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:022194<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592195<div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
Junio C Hamano3a702342007-12-12 21:34:022196copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
2197output. These options can be combined with other options, such as
Junio C Hamanoba4b9282008-07-06 05:20:312198<tt>-p</tt>, and are meant for human consumption.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592199<div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
Junio C Hamano3a702342007-12-12 21:34:022200formats the pathnames compactly by combining common prefix and suffix of
2201the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
Junio C Hamanoba4b9282008-07-06 05:20:312202<tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022203<div class="listingblock">
2204<div class="content">
2205<pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
2206</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592207<div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
Junio C Hamano3a702342007-12-12 21:34:022208for easier machine consumption. An entry in <tt>--numstat</tt> output looks
Junio C Hamanoba4b9282008-07-06 05:20:312209like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022210<div class="listingblock">
2211<div class="content">
2212<pre><tt>1 2 README
22133 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
2214</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592215<div class="paragraph"><p>That is, from left to right:</p></div>
2216<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022217<li>
2218<p>
2219the number of added lines;
2220</p>
2221</li>
2222<li>
2223<p>
2224a tab;
2225</p>
2226</li>
2227<li>
2228<p>
2229the number of deleted lines;
2230</p>
2231</li>
2232<li>
2233<p>
2234a tab;
2235</p>
2236</li>
2237<li>
2238<p>
2239pathname (possibly with rename/copy information);
2240</p>
2241</li>
2242<li>
2243<p>
2244a newline.
2245</p>
2246</li>
Junio C Hamanoba4b9282008-07-06 05:20:312247</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592248<div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022249<div class="listingblock">
2250<div class="content">
2251<pre><tt>1 2 README NUL
22523 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
2253</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592254<div class="paragraph"><p>That is:</p></div>
2255<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022256<li>
2257<p>
2258the number of added lines;
2259</p>
2260</li>
2261<li>
2262<p>
2263a tab;
2264</p>
2265</li>
2266<li>
2267<p>
2268the number of deleted lines;
2269</p>
2270</li>
2271<li>
2272<p>
2273a tab;
2274</p>
2275</li>
2276<li>
2277<p>
2278a NUL (only exists if renamed/copied);
2279</p>
2280</li>
2281<li>
2282<p>
2283pathname in preimage;
2284</p>
2285</li>
2286<li>
2287<p>
2288a NUL (only exists if renamed/copied);
2289</p>
2290</li>
2291<li>
2292<p>
2293pathname in postimage (only exists if renamed/copied);
2294</p>
2295</li>
2296<li>
2297<p>
2298a NUL.
2299</p>
2300</li>
Junio C Hamanoba4b9282008-07-06 05:20:312301</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592302<div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
Junio C Hamano3a702342007-12-12 21:34:022303scripts that read the output to tell if the current record being read is
2304a single-path record or a rename/copy record without reading ahead.
2305After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
Junio C Hamanoba4b9282008-07-06 05:20:312306the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:022307</div>
Junio C Hamanoba4b9282008-07-06 05:20:312308<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232309<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592310<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232311</div>
2312<div id="footer">
2313<div id="footer-text">
Junio C Hamano5f3d8392011-03-15 23:33:352314Last updated 2011-03-15 23:30:13 UTC
Junio C Hamano1a4e8412005-12-27 08:17:232315</div>
2316</div>
2317</body>
2318</html>