blob: f3fb8a2c63da04929bb6a7b5c93cedab3e8e1470 [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 Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-diff-tree(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-diff-tree(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-diff-tree -
317 Compares the content and mode of blobs found via two tree objects
318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamano235a91e2006-01-07 01:13:58323<div class="verseblock">
Junio C Hamanofce7c7e2008-07-02 03:06:38324<div class="content"><em>git diff-tree</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
Junio C Hamanofb56a962006-01-28 10:38:19325 [-t] [-r] [-c | --cc] [--root] [&lt;common diff options&gt;]
326 &lt;tree-ish&gt; [&lt;tree-ish&gt;] [&lt;path&gt;&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23327</div>
Junio C Hamanoba4b9282008-07-06 05:20:31328<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23329<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31330<div class="para"><p>Compares the content and mode of the blobs found via two tree objects.</p></div>
331<div class="para"><p>If there is only one &lt;tree-ish&gt; given, the commit is compared with its parents
332(see --stdin below).</p></div>
333<div class="para"><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:23334</div>
Junio C Hamanoba4b9282008-07-06 05:20:31335<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23336<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31337<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23338<dt>
339-p
340</dt>
Junio C Hamanobbbb8652008-12-29 10:34:22341<dt>
342-u
343</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23344<dd>
345<p>
Junio C Hamanoff979792007-11-16 10:11:30346 Generate patch (see section on generating patches).
347
Junio C Hamano1a4e8412005-12-27 08:17:23348</p>
349</dd>
350<dt>
Junio C Hamano69361562007-07-26 02:14:34351-U&lt;n&gt;
352</dt>
Junio C Hamano69361562007-07-26 02:14:34353<dt>
354--unified=&lt;n&gt;
355</dt>
356<dd>
357<p>
358 Generate diffs with &lt;n&gt; lines of context instead of
359 the usual three. Implies "-p".
360</p>
361</dd>
362<dt>
Junio C Hamano9ae1a062006-07-10 08:12:34363--raw
364</dt>
365<dd>
366<p>
367 Generate the raw format.
Junio C Hamanoff979792007-11-16 10:11:30368 This is the default.
Junio C Hamano9ae1a062006-07-10 08:12:34369</p>
370</dd>
371<dt>
Junio C Hamano54559c82006-04-13 07:45:12372--patch-with-raw
373</dt>
374<dd>
375<p>
Junio C Hamano9ae1a062006-07-10 08:12:34376 Synonym for "-p --raw".
Junio C Hamano54559c82006-04-13 07:45:12377</p>
378</dd>
Junio C Hamano20d47e32009-01-26 06:36:02379<dt>
380--patience
381</dt>
382<dd>
383<p>
384 Generate a diff using the "patience diff" algorithm.
385</p>
386</dd>
Junio C Hamano54559c82006-04-13 07:45:12387<dt>
Junio C Hamano4a9a76a2006-10-01 05:40:29388--stat[=width[,name-width]]
Junio C Hamanoba7c8d82006-04-15 06:17:42389</dt>
390<dd>
391<p>
Junio C Hamano4a9a76a2006-10-01 05:40:29392 Generate a diffstat. You can override the default
393 output width for 80-column terminal by "--stat=width".
394 The width of the filename part can be controlled by
395 giving another width to it separated by a comma.
Junio C Hamanoba7c8d82006-04-15 06:17:42396</p>
397</dd>
398<dt>
Junio C Hamanofbe00522006-10-19 05:58:48399--numstat
400</dt>
401<dd>
402<p>
403 Similar to --stat, but shows number of added and
404 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43405 abbreviation, to make it more machine friendly. For
406 binary files, outputs two <tt>-</tt> instead of saying
407 <tt>0 0</tt>.
Junio C Hamanofbe00522006-10-19 05:58:48408</p>
409</dd>
410<dt>
Junio C Hamano7d23f5e2006-12-16 07:44:04411--shortstat
412</dt>
413<dd>
414<p>
415 Output only the last line of the --stat format containing total
416 number of modified files, as well as number of added and deleted
417 lines.
418</p>
419</dd>
420<dt>
Junio C Hamano6a45be92008-04-22 08:19:03421--dirstat[=limit]
422</dt>
423<dd>
424<p>
Junio C Hamanoa2f46622008-09-03 05:20:31425 Output the distribution of relative amount of changes (number of lines added or
426 removed) for each sub-directory. Directories with changes below
427 a cut-off percent (3% by default) are not shown. The cut-off percent
428 can be set with "--dirstat=limit". Changes in a child directory is not
429 counted for the parent directory, unless "--cumulative" is used.
Junio C Hamano6a45be92008-04-22 08:19:03430</p>
431</dd>
432<dt>
Junio C Hamanoa476efa2008-10-10 15:31:42433--dirstat-by-file[=limit]
434</dt>
435<dd>
436<p>
437 Same as --dirstat, but counts changed files instead of lines.
438</p>
439</dd>
440<dt>
Junio C Hamano6959c6c2006-05-17 10:34:11441--summary
442</dt>
443<dd>
444<p>
445 Output a condensed summary of extended header information
446 such as creations, renames and mode changes.
447</p>
448</dd>
449<dt>
Junio C Hamanod1308c92006-04-16 11:01:09450--patch-with-stat
451</dt>
452<dd>
453<p>
Junio C Hamano9ae1a062006-07-10 08:12:34454 Synonym for "-p --stat".
Junio C Hamanoff979792007-11-16 10:11:30455
Junio C Hamanod1308c92006-04-16 11:01:09456</p>
457</dd>
458<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23459-z
460</dt>
461<dd>
462<p>
Junio C Hamanob968dbb2007-07-27 07:26:40463 NUL-line termination on output. This affects the --raw
464 output field terminator. Also output from commands such
465 as "git-log" will be delimited with NUL between commits.
Junio C Hamano1a4e8412005-12-27 08:17:23466</p>
467</dd>
468<dt>
469--name-only
470</dt>
471<dd>
472<p>
473 Show only names of changed files.
474</p>
475</dd>
476<dt>
477--name-status
478</dt>
479<dd>
480<p>
Junio C Hamanoa9aee782008-04-23 16:09:20481 Show only names and status of changed files. See the description
482 of the <tt>--diff-filter</tt> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:23483</p>
484</dd>
485<dt>
Junio C Hamano9ae1a062006-07-10 08:12:34486--color
487</dt>
488<dd>
489<p>
490 Show colored diff.
491</p>
492</dd>
493<dt>
494--no-color
495</dt>
496<dd>
497<p>
498 Turn off colored diff, even when the configuration file
499 gives the default to color output.
500</p>
501</dd>
502<dt>
Junio C Hamano20d47e32009-01-26 06:36:02503--color-words[=&lt;regex&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:41504</dt>
505<dd>
506<p>
Junio C Hamano20d47e32009-01-26 06:36:02507 Show colored word diff, i.e., color words which have changed.
508 By default, words are separated by whitespace.
Junio C Hamano85e45fa2006-08-13 07:47:41509</p>
Junio C Hamano20d47e32009-01-26 06:36:02510<div class="para"><p>When a &lt;regex&gt; is specified, every non-overlapping match of the
511&lt;regex&gt; is considered a word. Anything between these matches is
512considered whitespace and ignored(!) for the purposes of finding
513differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
514expression to make sure that it matches all non-whitespace characters.
515A match that contains a newline is silently truncated(!) at the
516newline.</p></div>
517<div class="para"><p>The regex can also be set via a diff driver or configuration option, see
518<a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
519overrides any diff driver or configuration setting. Diff drivers
520override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:41521</dd>
522<dt>
Junio C Hamano9ae1a062006-07-10 08:12:34523--no-renames
524</dt>
525<dd>
526<p>
527 Turn off rename detection, even when the configuration
528 file gives the default to do so.
529</p>
530</dd>
531<dt>
Junio C Hamanoa890c4f2007-01-28 10:29:21532--check
533</dt>
534<dd>
535<p>
536 Warn if changes introduce trailing whitespace
Junio C Hamano3dac5042007-12-15 08:40:54537 or an indent that uses a space before a tab. Exits with
538 non-zero status if problems are found. Not compatible with
539 --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:21540</p>
541</dd>
542<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23543--full-index
544</dt>
545<dd>
546<p>
Junio C Hamano5cf43ca2008-08-20 09:14:14547 Instead of the first handful of characters, show the full
548 pre- and post-image blob object names on the "index"
549 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:23550</p>
551</dd>
552<dt>
Junio C Hamano9ae1a062006-07-10 08:12:34553--binary
554</dt>
555<dd>
556<p>
557 In addition to --full-index, output "binary diff" that
558 can be applied with "git apply".
559</p>
560</dd>
561<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23562--abbrev[=&lt;n&gt;]
563</dt>
564<dd>
565<p>
566 Instead of showing the full 40-byte hexadecimal object
567 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56568 lines, show only a partial prefix. This is
Junio C Hamano1a4e8412005-12-27 08:17:23569 independent of --full-index option above, which controls
570 the diff-patch output format. Non default number of
571 digits can be specified with --abbrev=&lt;n&gt;.
572</p>
573</dd>
574<dt>
575-B
576</dt>
577<dd>
578<p>
579 Break complete rewrite changes into pairs of delete and create.
580</p>
581</dd>
582<dt>
583-M
584</dt>
585<dd>
586<p>
587 Detect renames.
588</p>
589</dd>
590<dt>
591-C
592</dt>
593<dd>
594<p>
Junio C Hamano16f98872007-06-12 16:09:14595 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
Junio C Hamano1a4e8412005-12-27 08:17:23596</p>
597</dd>
598<dt>
Junio C Hamano6ec31b92006-02-10 05:52:01599--diff-filter=[ACDMRTUXB*]
600</dt>
601<dd>
602<p>
603 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
604 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
Junio C Hamanoa2deec52008-10-18 18:58:09605 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
606 are Unmerged (<tt>U</tt>), are
Junio C Hamano6ec31b92006-02-10 05:52:01607 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
608 Any combination of the filter characters may be used.
609 When <tt>*</tt> (All-or-none) is added to the combination, all
610 paths are selected if there is any file that matches
611 other criteria in the comparison; if there is no file
612 that matches other criteria, nothing is selected.
613</p>
614</dd>
615<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23616--find-copies-harder
617</dt>
618<dd>
619<p>
Junio C Hamano16f98872007-06-12 16:09:14620 For performance reasons, by default, <tt>-C</tt> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:23621 if the original file of the copy was modified in the same
622 changeset. This flag makes the command
623 inspect unmodified files as candidates for the source of
624 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14625 projects, so use it with caution. Giving more than one
626 <tt>-C</tt> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:23627</p>
628</dd>
629<dt>
630-l&lt;num&gt;
631</dt>
632<dd>
633<p>
634 -M and -C options require O(n^2) processing time where n
635 is the number of potential rename/copy targets. This
636 option prevents rename/copy detection from running if
637 the number of rename/copy targets exceeds the specified
638 number.
639</p>
640</dd>
641<dt>
642-S&lt;string&gt;
643</dt>
644<dd>
645<p>
Junio C Hamano5217a272009-03-21 00:39:33646 Look for differences that introduce or remove an instance of
647 &lt;string&gt;. Note that this is different than the string simply
648 appearing in diff output; see the <em>pickaxe</em> entry in
649 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
Junio C Hamano1a4e8412005-12-27 08:17:23650</p>
651</dd>
652<dt>
653--pickaxe-all
654</dt>
655<dd>
656<p>
657 When -S finds a change, show all the changes in that
658 changeset, not just the files that contain the change
659 in &lt;string&gt;.
660</p>
661</dd>
662<dt>
Junio C Hamanobfe9e752006-04-05 21:43:28663--pickaxe-regex
664</dt>
665<dd>
666<p>
667 Make the &lt;string&gt; not a plain string but an extended POSIX
668 regex to match.
669</p>
670</dd>
671<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23672-O&lt;orderfile&gt;
673</dt>
674<dd>
675<p>
676 Output the patch in the order specified in the
677 &lt;orderfile&gt;, which has one shell glob pattern per line.
678</p>
679</dd>
680<dt>
681-R
682</dt>
683<dd>
684<p>
685 Swap two inputs; that is, show differences from index or
686 on-disk file to tree contents.
687</p>
688</dd>
Junio C Hamanoc26f5482006-07-09 09:38:14689<dt>
Junio C Hamano24bc09a2008-02-28 00:27:44690--relative[=&lt;path&gt;]
691</dt>
692<dd>
693<p>
694 When run from a subdirectory of the project, it can be
695 told to exclude changes outside the directory and show
696 pathnames relative to it with this option. When you are
697 not in a subdirectory (e.g. in a bare repository), you
698 can name which subdirectory to make the output relative
699 to by giving a &lt;path&gt; as an argument.
700</p>
701</dd>
702<dt>
Junio C Hamanobbbb8652008-12-29 10:34:22703-a
704</dt>
705<dt>
Junio C Hamanoc26f5482006-07-09 09:38:14706--text
707</dt>
708<dd>
709<p>
710 Treat all files as text.
711</p>
712</dd>
713<dt>
Junio C Hamanofd468962007-02-14 23:45:04714--ignore-space-at-eol
715</dt>
716<dd>
717<p>
Junio C Hamano3a702342007-12-12 21:34:02718 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:04719</p>
720</dd>
721<dt>
Junio C Hamanobbbb8652008-12-29 10:34:22722-b
723</dt>
724<dt>
Junio C Hamanod9c2d2f2006-12-06 08:59:07725--ignore-space-change
726</dt>
727<dd>
728<p>
Junio C Hamano3a702342007-12-12 21:34:02729 Ignore changes in amount of whitespace. This ignores whitespace
730 at line end, and considers all other sequences of one or
731 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:07732</p>
733</dd>
734<dt>
Junio C Hamanobbbb8652008-12-29 10:34:22735-w
Junio C Hamanod9c2d2f2006-12-06 08:59:07736</dt>
Junio C Hamanod9c2d2f2006-12-06 08:59:07737<dt>
738--ignore-all-space
739</dt>
740<dd>
741<p>
Junio C Hamano3a702342007-12-12 21:34:02742 Ignore whitespace when comparing lines. This ignores
743 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:07744 line has none.
745</p>
746</dd>
747<dt>
Junio C Hamano1d40ee82009-01-07 10:14:16748--inter-hunk-context=&lt;lines&gt;
749</dt>
750<dd>
751<p>
752 Show the context between diff hunks, up to the specified number
753 of lines, thereby fusing hunks that are close to each other.
754</p>
755</dd>
756<dt>
Junio C Hamano48fd2f62007-03-19 02:02:30757--exit-code
758</dt>
759<dd>
760<p>
761 Make the program exit with codes similar to diff(1).
762 That is, it exits with 1 if there were differences and
763 0 means no differences.
764</p>
765</dd>
Junio C Hamano35e57552007-03-25 07:54:35766<dt>
767--quiet
768</dt>
769<dd>
770<p>
771 Disable all output of the program. Implies --exit-code.
772</p>
773</dd>
Junio C Hamanobb0f4042007-07-04 06:41:40774<dt>
775--ext-diff
776</dt>
777<dd>
778<p>
779 Allow an external diff helper to be executed. If you set an
Junio C Hamano1b50ce92007-10-03 12:05:53780 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
781 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:40782</p>
783</dd>
784<dt>
785--no-ext-diff
786</dt>
787<dd>
788<p>
789 Disallow external diff drivers.
790</p>
791</dd>
Junio C Hamanoe27cbd22007-12-21 17:57:33792<dt>
Junio C Hamanodfccbb02008-05-26 01:16:14793--ignore-submodules
794</dt>
795<dd>
796<p>
797 Ignore changes to submodules in the diff generation.
798</p>
799</dd>
800<dt>
Junio C Hamanoe27cbd22007-12-21 17:57:33801--src-prefix=&lt;prefix&gt;
802</dt>
803<dd>
804<p>
805 Show the given source prefix instead of "a/".
806</p>
807</dd>
808<dt>
809--dst-prefix=&lt;prefix&gt;
810</dt>
811<dd>
812<p>
813 Show the given destination prefix instead of "b/".
814</p>
815</dd>
816<dt>
817--no-prefix
818</dt>
819<dd>
820<p>
821 Do not show any source or destination prefix.
822</p>
823</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31824</dl></div>
825<div class="para"><p>For more detailed explanation on these common options, see also
826<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
827<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23828<dt>
829&lt;tree-ish&gt;
830</dt>
831<dd>
832<p>
833 The id of a tree object.
834</p>
835</dd>
836<dt>
837&lt;path&gt;&#8230;
838</dt>
839<dd>
840<p>
841 If provided, the results are limited to a subset of files
842 matching one of these prefix strings.
Junio C Hamano341071d2006-06-04 07:24:48843 i.e., file matches <tt>/^&lt;pattern1&gt;|&lt;pattern2&gt;|&#8230;/</tt>
Junio C Hamano1a4e8412005-12-27 08:17:23844 Note that this parameter does not provide any wildcard or regexp
845 features.
846</p>
847</dd>
848<dt>
849-r
850</dt>
851<dd>
852<p>
853 recurse into sub-trees
854</p>
855</dd>
856<dt>
857-t
858</dt>
859<dd>
860<p>
861 show tree entry itself as well as subtrees. Implies -r.
862</p>
863</dd>
864<dt>
865--root
866</dt>
867<dd>
868<p>
Junio C Hamano54bf1e22008-12-20 06:30:11869 When <em>--root</em> is specified the initial commit will be shown as a big
Junio C Hamano1a4e8412005-12-27 08:17:23870 creation event. This is equivalent to a diff against the NULL tree.
871</p>
872</dd>
873<dt>
874--stdin
875</dt>
876<dd>
877<p>
878 When <em>--stdin</em> is specified, the command does not take
879 &lt;tree-ish&gt; arguments from the command line. Instead, it
Junio C Hamano3f2f6e52008-08-21 10:34:22880 reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a
881 list of &lt;commit&gt; from its standard input. (Use a single space
882 as separator.)
Junio C Hamano1a4e8412005-12-27 08:17:23883</p>
Junio C Hamano3f2f6e52008-08-21 10:34:22884<div class="para"><p>When two trees are given, it compares the first tree with the second.
885When a single commit is given, it compares the commit with its
886parents. The remaining commits, when given, are used as if they are
Junio C Hamanob53db3c2008-08-07 00:17:52887parents of the first commit.</p></div>
Junio C Hamano3f2f6e52008-08-21 10:34:22888<div class="para"><p>When comparing two trees, the ID of both trees (separated by a space
889and terminated by a newline) is printed before the difference. When
890comparing commits, the ID of the first (or only) commit, followed by a
891newline, is printed.</p></div>
Junio C Hamano54bf1e22008-12-20 06:30:11892<div class="para"><p>The following flags further affect the behavior when comparing
Junio C Hamano3f2f6e52008-08-21 10:34:22893commits (but not trees).</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23894</dd>
895<dt>
896-m
897</dt>
898<dd>
899<p>
Junio C Hamanoba4b9282008-07-06 05:20:31900 By default, <em>git-diff-tree --stdin</em> does not show
Junio C Hamano1a4e8412005-12-27 08:17:23901 differences for merge commits. With this flag, it shows
Junio C Hamanoa8adb1e2006-04-10 23:46:16902 differences to that commit from all of its parents. See
903 also <em>-c</em>.
Junio C Hamano1a4e8412005-12-27 08:17:23904</p>
905</dd>
906<dt>
907-s
908</dt>
909<dd>
910<p>
Junio C Hamanoba4b9282008-07-06 05:20:31911 By default, <em>git-diff-tree --stdin</em> shows differences,
Junio C Hamano1a4e8412005-12-27 08:17:23912 either in machine-readable form (without <em>-p</em>) or in patch
Junio C Hamano235a91e2006-01-07 01:13:58913 form (with <em>-p</em>). This output can be suppressed. It is
Junio C Hamano1a4e8412005-12-27 08:17:23914 only useful with <em>-v</em> flag.
915</p>
916</dd>
917<dt>
918-v
919</dt>
920<dd>
921<p>
Junio C Hamanoba4b9282008-07-06 05:20:31922 This flag causes <em>git-diff-tree --stdin</em> to also show
Junio C Hamano1a4e8412005-12-27 08:17:23923 the commit message before the differences.
924</p>
925</dd>
926<dt>
Junio C Hamanoa340aaa2006-11-23 02:47:33927--pretty[=<em>&lt;format&gt;</em>]
Junio C Hamano1a4e8412005-12-27 08:17:23928</dt>
Junio C Hamano0a235222009-03-06 08:21:09929<dt>
930--format[=<em>&lt;format&gt;</em>]
931</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23932<dd>
933<p>
Junio C Hamanoa3770f92007-07-25 08:53:33934 Pretty-print the contents of the commit logs in a given format,
Junio C Hamano0430e3a2007-05-15 03:13:17935 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
936 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>.
Junio C Hamanoa3770f92007-07-25 08:53:33937 When omitted, the format defaults to <em>medium</em>.
Junio C Hamano1a4e8412005-12-27 08:17:23938</p>
Junio C Hamanoba4b9282008-07-06 05:20:31939<div class="para"><p>Note: you can specify the default pretty format in the repository
940configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:17941</dd>
942<dt>
Junio C Hamanoee695f22007-06-21 00:35:36943--abbrev-commit
944</dt>
945<dd>
946<p>
947 Instead of showing the full 40-byte hexadecimal commit object
Junio C Hamano6efe3022009-01-13 16:47:56948 name, show only a partial prefix. Non default number of
Junio C Hamanoee695f22007-06-21 00:35:36949 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
950 diff output, if it is displayed).
951</p>
Junio C Hamanoba4b9282008-07-06 05:20:31952<div class="para"><p>This should make "--pretty=oneline" a whole lot more readable for
953people using 80-column terminals.</p></div>
Junio C Hamanoee695f22007-06-21 00:35:36954</dd>
955<dt>
Junio C Hamano0a235222009-03-06 08:21:09956--oneline
957</dt>
958<dd>
959<p>
960 This is a shorthand for "--pretty=oneline --abbrev-commit"
961 used together.
962</p>
963</dd>
964<dt>
Junio C Hamano0430e3a2007-05-15 03:13:17965--encoding[=&lt;encoding&gt;]
966</dt>
967<dd>
968<p>
969 The commit objects record the encoding used for the log message
970 in their encoding header; this option can be used to tell the
971 command to re-code the commit log message in the encoding
972 preferred by the user. For non plumbing commands this
973 defaults to UTF-8.
974</p>
975</dd>
976<dt>
977--no-commit-id
978</dt>
979<dd>
980<p>
Junio C Hamanoba4b9282008-07-06 05:20:31981 <em>git-diff-tree</em> outputs a line with the commit ID when
Junio C Hamano0430e3a2007-05-15 03:13:17982 applicable. This flag suppressed the commit ID output.
983</p>
984</dd>
985<dt>
986-c
987</dt>
988<dd>
989<p>
990 This flag changes the way a merge commit is displayed
991 (which means it is useful only when the command is given
992 one &lt;tree-ish&gt;, or <em>--stdin</em>). It shows the differences
993 from each of the parents to the merge result simultaneously
994 instead of showing pairwise diff between a parent and the
995 result one at a time (which is what the <em>-m</em> option does).
996 Furthermore, it lists only files which were modified
997 from all parents.
998</p>
999</dd>
1000<dt>
1001--cc
1002</dt>
1003<dd>
1004<p>
1005 This flag changes the way a merge commit patch is displayed,
1006 in a similar way to the <em>-c</em> option. It implies the <em>-c</em>
1007 and <em>-p</em> options and further compresses the patch output
Junio C Hamanoccc2f762008-07-24 04:03:331008 by omitting uninteresting hunks whose the contents in the parents
1009 have only two variants and the merge result picks one of them
1010 without modification. When all hunks are uninteresting, the commit
1011 itself and the commit log message is not shown, just like in any other
1012 "empty diff" case.
Junio C Hamano0430e3a2007-05-15 03:13:171013</p>
1014</dd>
1015<dt>
1016--always
1017</dt>
1018<dd>
1019<p>
1020 Show the commit itself and the commit log message even
1021 if the diff itself is empty.
1022</p>
1023</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311024</dl></div>
Junio C Hamano0430e3a2007-05-15 03:13:171025</div>
Junio C Hamanoba4b9282008-07-06 05:20:311026<h2 id="_pretty_formats">PRETTY FORMATS</h2>
Junio C Hamano0430e3a2007-05-15 03:13:171027<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311028<div class="para"><p>If the commit is a merge, and if the pretty-format
Junio C Hamano0430e3a2007-05-15 03:13:171029is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1030inserted before the <em>Author:</em> line. This line begins with
1031"Merge: " and the sha1s of ancestral commits are printed,
1032separated by spaces. Note that the listed commits may not
1033necessarily be the list of the <strong>direct</strong> parent commits if you
1034have limited your view of history: for example, if you are
1035only interested in changes related to a certain directory or
Junio C Hamanoba4b9282008-07-06 05:20:311036file.</p></div>
1037<div class="para"><p>Here are some additional details for each format:</p></div>
1038<div class="ilist"><ul>
Junio C Hamanoa340aaa2006-11-23 02:47:331039<li>
1040<p>
1041<em>oneline</em>
1042</p>
1043<div class="literalblock">
1044<div class="content">
1045<pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
1046</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311047<div class="para"><p>This is designed to be as compact as possible.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:331048</li>
1049<li>
1050<p>
1051<em>short</em>
1052</p>
1053<div class="literalblock">
1054<div class="content">
1055<pre><tt>commit &lt;sha1&gt;
1056Author: &lt;author&gt;</tt></pre>
1057</div></div>
1058<div class="literalblock">
1059<div class="content">
1060<pre><tt>&lt;title line&gt;</tt></pre>
1061</div></div>
1062</li>
1063<li>
1064<p>
1065<em>medium</em>
1066</p>
1067<div class="literalblock">
1068<div class="content">
1069<pre><tt>commit &lt;sha1&gt;
1070Author: &lt;author&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181071Date: &lt;author date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331072</div></div>
1073<div class="literalblock">
1074<div class="content">
1075<pre><tt>&lt;title line&gt;</tt></pre>
1076</div></div>
1077<div class="literalblock">
1078<div class="content">
1079<pre><tt>&lt;full commit message&gt;</tt></pre>
1080</div></div>
1081</li>
1082<li>
1083<p>
1084<em>full</em>
1085</p>
1086<div class="literalblock">
1087<div class="content">
1088<pre><tt>commit &lt;sha1&gt;
1089Author: &lt;author&gt;
1090Commit: &lt;committer&gt;</tt></pre>
1091</div></div>
1092<div class="literalblock">
1093<div class="content">
1094<pre><tt>&lt;title line&gt;</tt></pre>
1095</div></div>
1096<div class="literalblock">
1097<div class="content">
1098<pre><tt>&lt;full commit message&gt;</tt></pre>
1099</div></div>
1100</li>
1101<li>
1102<p>
1103<em>fuller</em>
1104</p>
1105<div class="literalblock">
1106<div class="content">
1107<pre><tt>commit &lt;sha1&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181108Author: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311109AuthorDate: &lt;author date&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181110Commit: &lt;committer&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311111CommitDate: &lt;committer date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331112</div></div>
1113<div class="literalblock">
1114<div class="content">
1115<pre><tt>&lt;title line&gt;</tt></pre>
1116</div></div>
1117<div class="literalblock">
1118<div class="content">
1119<pre><tt>&lt;full commit message&gt;</tt></pre>
1120</div></div>
1121</li>
1122<li>
1123<p>
1124<em>email</em>
1125</p>
1126<div class="literalblock">
1127<div class="content">
1128<pre><tt>From &lt;sha1&gt; &lt;date&gt;
1129From: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311130Date: &lt;author date&gt;
Junio C Hamanoa340aaa2006-11-23 02:47:331131Subject: [PATCH] &lt;title line&gt;</tt></pre>
1132</div></div>
1133<div class="literalblock">
1134<div class="content">
Junio C Hamano0430e3a2007-05-15 03:13:171135<pre><tt>&lt;full commit message&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331136</div></div>
1137</li>
1138<li>
1139<p>
1140<em>raw</em>
1141</p>
Junio C Hamanoba4b9282008-07-06 05:20:311142<div class="para"><p>The <em>raw</em> format shows the entire commit exactly as
Junio C Hamanoa340aaa2006-11-23 02:47:331143stored in the commit object. Notably, the SHA1s are
1144displayed in full, regardless of whether --abbrev or
1145--no-abbrev are used, and <em>parents</em> information show the
1146true parent commits, without taking grafts nor history
Junio C Hamanoba4b9282008-07-06 05:20:311147simplification into account.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:331148</li>
Junio C Hamanoa3fd83c2007-03-02 10:34:361149<li>
1150<p>
1151<em>format:</em>
1152</p>
Junio C Hamanoba4b9282008-07-06 05:20:311153<div class="para"><p>The <em>format:</em> format allows you to specify which information
Junio C Hamanoa3fd83c2007-03-02 10:34:361154you want to show. It works a little bit like printf format,
1155with the notable exception that you get a newline with <em>%n</em>
Junio C Hamanoba4b9282008-07-06 05:20:311156instead of <em>\n</em>.</p></div>
1157<div class="para"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
1158would show something like this:</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:171159<div class="listingblock">
1160<div class="content">
1161<pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
1162The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;
1163</tt></pre>
1164</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311165<div class="para"><p>The placeholders are:</p></div>
1166<div class="ilist"><ul>
Junio C Hamanoa3fd83c2007-03-02 10:34:361167<li>
1168<p>
1169<em>%H</em>: commit hash
1170</p>
1171</li>
1172<li>
1173<p>
1174<em>%h</em>: abbreviated commit hash
1175</p>
1176</li>
1177<li>
1178<p>
1179<em>%T</em>: tree hash
1180</p>
1181</li>
1182<li>
1183<p>
1184<em>%t</em>: abbreviated tree hash
1185</p>
1186</li>
1187<li>
1188<p>
1189<em>%P</em>: parent hashes
1190</p>
1191</li>
1192<li>
1193<p>
1194<em>%p</em>: abbreviated parent hashes
1195</p>
1196</li>
1197<li>
1198<p>
1199<em>%an</em>: author name
1200</p>
1201</li>
1202<li>
1203<p>
Junio C Hamano8bc410e2009-02-15 10:38:191204<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:571205</p>
1206</li>
1207<li>
1208<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361209<em>%ae</em>: author email
1210</p>
1211</li>
1212<li>
1213<p>
Junio C Hamano8bc410e2009-02-15 10:38:191214<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>)
1215</p>
1216</li>
1217<li>
1218<p>
Junio C Hamanoa387df32008-08-29 08:56:581219<em>%ad</em>: author date (format respects --date= option)
Junio C Hamanoa3fd83c2007-03-02 10:34:361220</p>
1221</li>
1222<li>
1223<p>
1224<em>%aD</em>: author date, RFC2822 style
1225</p>
1226</li>
1227<li>
1228<p>
1229<em>%ar</em>: author date, relative
1230</p>
1231</li>
1232<li>
1233<p>
1234<em>%at</em>: author date, UNIX timestamp
1235</p>
1236</li>
1237<li>
1238<p>
Junio C Hamano02f130b2007-07-14 08:26:561239<em>%ai</em>: author date, ISO 8601 format
1240</p>
1241</li>
1242<li>
1243<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361244<em>%cn</em>: committer name
1245</p>
1246</li>
1247<li>
1248<p>
Junio C Hamano8bc410e2009-02-15 10:38:191249<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:571250</p>
1251</li>
1252<li>
1253<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361254<em>%ce</em>: committer email
1255</p>
1256</li>
1257<li>
1258<p>
Junio C Hamano8bc410e2009-02-15 10:38:191259<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>)
1260</p>
1261</li>
1262<li>
1263<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361264<em>%cd</em>: committer date
1265</p>
1266</li>
1267<li>
1268<p>
1269<em>%cD</em>: committer date, RFC2822 style
1270</p>
1271</li>
1272<li>
1273<p>
1274<em>%cr</em>: committer date, relative
1275</p>
1276</li>
1277<li>
1278<p>
1279<em>%ct</em>: committer date, UNIX timestamp
1280</p>
1281</li>
1282<li>
1283<p>
Junio C Hamano02f130b2007-07-14 08:26:561284<em>%ci</em>: committer date, ISO 8601 format
1285</p>
1286</li>
1287<li>
1288<p>
Junio C Hamano5e4d8de2008-09-19 06:27:021289<em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
1290</p>
1291</li>
1292<li>
1293<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361294<em>%e</em>: encoding
1295</p>
1296</li>
1297<li>
1298<p>
1299<em>%s</em>: subject
1300</p>
1301</li>
1302<li>
1303<p>
Junio C Hamano5f9a6f02009-04-06 08:26:561304<em>%f</em>: sanitized subject line, suitable for a filename
1305</p>
1306</li>
1307<li>
1308<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361309<em>%b</em>: body
1310</p>
1311</li>
1312<li>
1313<p>
1314<em>%Cred</em>: switch color to red
1315</p>
1316</li>
1317<li>
1318<p>
1319<em>%Cgreen</em>: switch color to green
1320</p>
1321</li>
1322<li>
1323<p>
1324<em>%Cblue</em>: switch color to blue
1325</p>
1326</li>
1327<li>
1328<p>
1329<em>%Creset</em>: reset color
1330</p>
1331</li>
1332<li>
1333<p>
Junio C Hamanocc0cb312009-01-22 03:38:501334<em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
1335</p>
1336</li>
1337<li>
1338<p>
Junio C Hamanod9e0e5d2007-04-14 16:22:041339<em>%m</em>: left, right or boundary mark
1340</p>
1341</li>
1342<li>
1343<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361344<em>%n</em>: newline
1345</p>
Junio C Hamano0430e3a2007-05-15 03:13:171346</li>
Junio C Hamanob78d2592008-04-09 09:39:081347<li>
1348<p>
1349<em>%x00</em>: print a byte from a hex code
1350</p>
1351</li>
Junio C Hamanoba4b9282008-07-06 05:20:311352</ul></div>
Junio C Hamanoa3fd83c2007-03-02 10:34:361353</li>
Junio C Hamano6fb124c2008-06-13 10:04:011354<li>
1355<p>
1356<em>tformat:</em>
1357</p>
Junio C Hamanoba4b9282008-07-06 05:20:311358<div class="para"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
Junio C Hamano6fb124c2008-06-13 10:04:011359provides "terminator" semantics instead of "separator" semantics. In
1360other words, each commit has the message terminator character (usually a
1361newline) appended, rather than a separator placed between entries.
1362This means that the final entry of a single-line format will be properly
1363terminated with a new line, just as the "oneline" format does.
Junio C Hamanoba4b9282008-07-06 05:20:311364For example:</p></div>
Junio C Hamano6fb124c2008-06-13 10:04:011365<div class="listingblock">
1366<div class="content">
1367<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
1368 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
13694da45be
13707134973 -- NO NEWLINE
1371
1372$ git log -2 --pretty=tformat:%h 4da45bef \
1373 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
13744da45be
13757134973</tt></pre>
1376</div></div>
Junio C Hamano0a235222009-03-06 08:21:091377<div class="para"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
1378as if it has <tt>tformat:</tt> in front of it. For example, these two are
1379equivalent:</p></div>
1380<div class="listingblock">
1381<div class="content">
1382<pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
1383$ git log -2 --pretty=%h 4da45bef</tt></pre>
1384</div></div>
Junio C Hamano6fb124c2008-06-13 10:04:011385</li>
Junio C Hamanoba4b9282008-07-06 05:20:311386</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:231387</div>
Junio C Hamanoba4b9282008-07-06 05:20:311388<h2 id="_limiting_output">Limiting Output</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231389<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311390<div class="para"><p>If you're only interested in differences in a subset of files, for
1391example some architecture-specific files, you might do:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231392<div class="literalblock">
1393<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381394<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:231395</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311396<div class="para"><p>and it will only show you what changed in those two directories.</p></div>
1397<div class="para"><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:231398<div class="literalblock">
1399<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381400<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:231401</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311402<div class="para"><p>and it will ignore all differences to other files.</p></div>
1403<div class="para"><p>The pattern is always the prefix, and is matched exactly. There are no
Junio C Hamano1a4e8412005-12-27 08:17:231404wildcards. Even stricter, it has to match a complete path component.
1405I.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:311406so it can be used to name subdirectories.</p></div>
1407<div class="para"><p>An example of normal usage is:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231408<div class="literalblock">
1409<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:381410<pre><tt>torvalds@ppc970:~/git&gt; git diff-tree 5319e4......
Junio C Hamano1a4e8412005-12-27 08:17:231411*100664-&gt;100664 blob ac348b.......-&gt;a01513....... git-fsck-objects.c</tt></pre>
1412</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311413<div class="para"><p>which tells you that the last commit changed just one file (it's from
1414this one:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231415<div class="listingblock">
1416<div class="content">
1417<pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
1418tree 5319e4d609cdd282069cc4dce33c1db559539b03
1419parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
1420author Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
1421committer Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
1422
1423Make "git-fsck-objects" print out all the root commits it finds.
1424
1425Once I do the reference tracking, I'll also make it print out all the
1426HEAD commits it finds, which is even more interesting.</tt></pre>
1427</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311428<div class="para"><p>in case you care).</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231429</div>
Junio C Hamano543f8d62009-07-29 08:35:211430<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231431<div class="sectionbody">
Junio C Hamano543f8d62009-07-29 08:35:211432<div class="para"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:311433"git-diff-files" and "git diff --raw" are very similar.</p></div>
1434<div class="para"><p>These commands all compare two sets of things; what is
1435compared differs:</p></div>
1436<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:231437<dt>
1438git-diff-index &lt;tree-ish&gt;
1439</dt>
1440<dd>
1441<p>
1442 compares the &lt;tree-ish&gt; and the files on the filesystem.
1443</p>
1444</dd>
1445<dt>
1446git-diff-index --cached &lt;tree-ish&gt;
1447</dt>
1448<dd>
1449<p>
1450 compares the &lt;tree-ish&gt; and the index.
1451</p>
1452</dd>
1453<dt>
1454git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1455</dt>
1456<dd>
1457<p>
1458 compares the trees named by the two arguments.
1459</p>
1460</dd>
1461<dt>
1462git-diff-files [&lt;pattern&gt;&#8230;]
1463</dt>
1464<dd>
1465<p>
1466 compares the index and the files on the filesystem.
1467</p>
1468</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311469</dl></div>
Junio C Hamano543f8d62009-07-29 08:35:211470<div class="para"><p>The "git-diff-tree" command begins its ouput by printing the hash of
1471what is being compared. After that, all the commands print one output
1472line per changed file.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311473<div class="para"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231474<div class="listingblock">
1475<div class="content">
1476<pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1477copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1478rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1479create :000000 100644 0000000... 1234567... A file4
1480delete :100644 000000 1234567... 0000000... D file5
1481unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1482</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311483<div class="para"><p>That is, from the left to the right:</p></div>
1484<div class="olist"><ol>
Junio C Hamano1a4e8412005-12-27 08:17:231485<li>
1486<p>
1487a colon.
1488</p>
1489</li>
1490<li>
1491<p>
1492mode for "src"; 000000 if creation or unmerged.
1493</p>
1494</li>
1495<li>
1496<p>
1497a space.
1498</p>
1499</li>
1500<li>
1501<p>
1502mode for "dst"; 000000 if deletion or unmerged.
1503</p>
1504</li>
1505<li>
1506<p>
1507a space.
1508</p>
1509</li>
1510<li>
1511<p>
1512sha1 for "src"; 0{40} if creation or unmerged.
1513</p>
1514</li>
1515<li>
1516<p>
1517a space.
1518</p>
1519</li>
1520<li>
1521<p>
1522sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1523</p>
1524</li>
1525<li>
1526<p>
1527a space.
1528</p>
1529</li>
1530<li>
1531<p>
1532status, followed by optional "score" number.
1533</p>
1534</li>
1535<li>
1536<p>
1537a tab or a NUL when <em>-z</em> option is used.
1538</p>
1539</li>
1540<li>
1541<p>
1542path for "src"
1543</p>
1544</li>
1545<li>
1546<p>
1547a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1548</p>
1549</li>
1550<li>
1551<p>
1552path for "dst"; only exists for C or R.
1553</p>
1554</li>
1555<li>
1556<p>
1557an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1558</p>
1559</li>
Junio C Hamanoba4b9282008-07-06 05:20:311560</ol></div>
Junio C Hamanoaa17c7c2008-11-03 04:36:581561<div class="para"><p>Possible status letters are:</p></div>
1562<div class="ilist"><ul>
1563<li>
1564<p>
1565A: addition of a file
1566</p>
1567</li>
1568<li>
1569<p>
1570C: copy of a file into a new one
1571</p>
1572</li>
1573<li>
1574<p>
1575D: deletion of a file
1576</p>
1577</li>
1578<li>
1579<p>
1580M: modification of the contents or mode of a file
1581</p>
1582</li>
1583<li>
1584<p>
1585R: renaming of a file
1586</p>
1587</li>
1588<li>
1589<p>
1590T: change in the type of the file
1591</p>
1592</li>
1593<li>
1594<p>
1595U: file is unmerged (you must complete the merge before it can
1596be committed)
1597</p>
1598</li>
1599<li>
1600<p>
1601X: "unknown" change type (most probably a bug, please report it)
1602</p>
1603</li>
1604</ul></div>
Junio C Hamano54bf1e22008-12-20 06:30:111605<div class="para"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:581606percentage of similarity between the source and target of the move or
1607copy), and are the only ones to be so.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311608<div class="para"><p>&lt;sha1&gt; is shown as all 0's if a file is new on the filesystem
1609and it is out of sync with the index.</p></div>
1610<div class="para"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231611<div class="listingblock">
1612<div class="content">
1613<pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
1614</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311615<div class="para"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
Junio C Hamano1a4e8412005-12-27 08:17:231616in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
Junio C Hamanoba4b9282008-07-06 05:20:311617respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231618</div>
Junio C Hamanoba4b9282008-07-06 05:20:311619<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:121620<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311621<div class="para"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano7ae0ab22007-11-03 02:46:461622can take <em>-c</em> or <em>--cc</em> option
Junio C Hamano67fad6d2007-05-06 08:53:121623to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:311624from the format described above in the following way:</p></div>
1625<div class="olist"><ol>
Junio C Hamano67fad6d2007-05-06 08:53:121626<li>
1627<p>
1628there is a colon for each parent
1629</p>
1630</li>
1631<li>
1632<p>
1633there are more "src" modes and "src" sha1
1634</p>
1635</li>
1636<li>
1637<p>
1638status is concatenated status characters for each parent
1639</p>
1640</li>
1641<li>
1642<p>
1643no optional "score" number
1644</p>
1645</li>
1646<li>
1647<p>
1648single path, only for "dst"
1649</p>
1650</li>
Junio C Hamanoba4b9282008-07-06 05:20:311651</ol></div>
1652<div class="para"><p>Example:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121653<div class="listingblock">
1654<div class="content">
1655<pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
1656</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311657<div class="para"><p>Note that <em>combined diff</em> lists only files which were modified from
1658all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121659</div>
Junio C Hamanoba4b9282008-07-06 05:20:311660<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231661<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311662<div class="para"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano00b8b632007-12-07 09:50:491663with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
1664"git log" with the "-p" option, they
Junio C Hamano7ae0ab22007-11-03 02:46:461665do not produce the output described above; instead they produce a
1666patch file. You can customize the creation of such patches via the
Junio C Hamanoba4b9282008-07-06 05:20:311667GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
1668<div class="para"><p>What the -p option produces is slightly different from the traditional
1669diff format.</p></div>
1670<div class="olist"><ol>
Junio C Hamano1a4e8412005-12-27 08:17:231671<li>
1672<p>
Junio C Hamano235a91e2006-01-07 01:13:581673It is preceded with a "git diff" header, that looks like
Junio C Hamano1a4e8412005-12-27 08:17:231674 this:
1675</p>
1676<div class="literalblock">
1677<div class="content">
1678<pre><tt>diff --git a/file1 b/file2</tt></pre>
1679</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311680<div class="para"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
Junio C Hamano1a4e8412005-12-27 08:17:231681involved. Especially, even for a creation or a deletion,
Junio C Hamano5e4d8de2008-09-19 06:27:021682<tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311683<div class="para"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
Junio C Hamano1a4e8412005-12-27 08:17:231684name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:311685the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231686</li>
1687<li>
1688<p>
1689It is followed by one or more extended header lines:
1690</p>
1691<div class="literalblock">
1692<div class="content">
1693<pre><tt>old mode &lt;mode&gt;
1694new mode &lt;mode&gt;
1695deleted file mode &lt;mode&gt;
1696new file mode &lt;mode&gt;
1697copy from &lt;path&gt;
1698copy to &lt;path&gt;
1699rename from &lt;path&gt;
1700rename to &lt;path&gt;
1701similarity index &lt;number&gt;
1702dissimilarity index &lt;number&gt;
1703index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
1704</div></div>
1705</li>
1706<li>
1707<p>
Junio C Hamanoa053d542006-10-27 09:29:131708TAB, LF, double quote and backslash characters in pathnames
1709 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
1710 If there is need for such substitution then the whole
1711 pathname is put in double quotes.
Junio C Hamano1a4e8412005-12-27 08:17:231712</p>
1713</li>
Junio C Hamanoba4b9282008-07-06 05:20:311714</ol></div>
1715<div class="para"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamanod526ba92007-07-02 00:17:421716the dissimilarity index is the percentage of changed lines. It
1717is a rounded down integer, followed by a percent sign. The
1718similarity index value of 100% is thus reserved for two equal
1719files, while 100% dissimilarity means that no line from the old
Junio C Hamanoba4b9282008-07-06 05:20:311720file made it into the new one.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231721</div>
Junio C Hamanoba4b9282008-07-06 05:20:311722<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:191723<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311724<div class="para"><p>"git-diff-tree", "git-diff-files" and "git-diff" can take <em>-c</em> or
Junio C Hamano00b8b632007-12-07 09:50:491725<em>--cc</em> option to produce <em>combined diff</em>. For showing a merge commit
1726with "git log -p", this is the default format.
Junio C Hamanoba4b9282008-07-06 05:20:311727A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:191728<div class="listingblock">
1729<div class="content">
1730<pre><tt>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:291731index fabadb8,cc95eb0..4866510
1732--- a/describe.c
1733+++ b/describe.c
1734@@@ -98,20 -98,12 +98,20 @@@
1735 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:191736 }
1737
1738- static void describe(char *arg)
1739 -static void describe(struct commit *cmit, int last_one)
1740++static void describe(char *arg, int last_one)
1741 {
Junio C Hamano29f14312006-10-26 08:47:291742 + unsigned char sha1[20];
1743 + struct commit *cmit;
1744 struct commit_list *list;
1745 static int initialized = 0;
1746 struct commit_name *n;
1747
1748 + if (get_sha1(arg, sha1) &lt; 0)
1749 + usage(describe_usage);
1750 + cmit = lookup_commit_reference(sha1);
1751 + if (!cmit)
1752 + usage(describe_usage);
1753 +
1754 if (!initialized) {
1755 initialized = 1;
1756 for_each_ref(get_name);</tt></pre>
Junio C Hamanofb56a962006-01-28 10:38:191757</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311758<div class="olist"><ol>
Junio C Hamano29f14312006-10-26 08:47:291759<li>
1760<p>
1761It is preceded with a "git diff" header, that looks like
1762 this (when <em>-c</em> option is used):
1763</p>
1764<div class="literalblock">
1765<div class="content">
1766<pre><tt>diff --combined file</tt></pre>
1767</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311768<div class="para"><p>or like this (when <em>--cc</em> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:291769<div class="literalblock">
1770<div class="content">
Junio C Hamano0868a302008-07-22 09:20:441771<pre><tt>diff --cc file</tt></pre>
Junio C Hamano29f14312006-10-26 08:47:291772</div></div>
1773</li>
1774<li>
1775<p>
1776It is followed by one or more extended header lines
1777 (this example shows a merge with two parents):
1778</p>
1779<div class="literalblock">
1780<div class="content">
1781<pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
1782mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
1783new file mode &lt;mode&gt;
1784deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
1785</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311786<div class="para"><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:041787the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:291788information about detected contents movement (renames and
1789copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:311790&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291791</li>
1792<li>
1793<p>
1794It is followed by two-line from-file/to-file header
1795</p>
1796<div class="literalblock">
1797<div class="content">
1798<pre><tt>--- a/file
1799+++ b/file</tt></pre>
1800</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311801<div class="para"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamano29f14312006-10-26 08:47:291802format, <tt>/dev/null</tt> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:311803files.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291804</li>
1805<li>
1806<p>
1807Chunk header format is modified to prevent people from
1808 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
1809 was created for review of merge commit changes, and was not
1810 meant for apply. The change is similar to the change in the
1811 extended <em>index</em> header:
1812</p>
1813<div class="literalblock">
1814<div class="content">
1815<pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
1816</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311817<div class="para"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
1818header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291819</li>
Junio C Hamanoba4b9282008-07-06 05:20:311820</ol></div>
1821<div class="para"><p>Unlike the traditional <em>unified</em> diff format, which shows two
Junio C Hamanofb56a962006-01-28 10:38:191822files A and B with a single column that has <tt>-</tt> (minus &#8212;
1823appears in A but removed in B), <tt>+</tt> (plus &#8212; missing in A but
Junio C Hamano29f14312006-10-26 08:47:291824added to B), or <tt>" "</tt> (space &#8212; unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:191825compares two or more files file1, file2,&#8230; with one file X, and
1826shows how X differs from each of fileN. One column for each of
1827fileN is prepended to the output line to note how X's line is
Junio C Hamanoba4b9282008-07-06 05:20:311828different from it.</p></div>
1829<div class="para"><p>A <tt>-</tt> character in the column N means that the line appears in
Junio C Hamano29f14312006-10-26 08:47:291830fileN but it does not appear in the result. A <tt>+</tt> character
Junio C Hamano54bf1e22008-12-20 06:30:111831in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:291832and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:311833added, from the point of view of that parent).</p></div>
1834<div class="para"><p>In the above example output, the function signature was changed
Junio C Hamanofb56a962006-01-28 10:38:191835from both files (hence two <tt>-</tt> removals from both file1 and
Junio C Hamano5e4d8de2008-09-19 06:27:021836file2, plus <tt>++</tt> to mean one line that was added does not appear
Junio C Hamano54bf1e22008-12-20 06:30:111837in either file1 nor file2). Also eight other lines are the same
1838from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311839<div class="para"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
Junio C Hamanofb56a962006-01-28 10:38:191840merge commit with the merge result (i.e. file1..fileN are the
1841parents). When shown by <tt>git diff-files -c</tt>, it compares the
1842two unresolved merge parents with the working tree file
1843(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:311844"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:191845</div>
Junio C Hamanoba4b9282008-07-06 05:20:311846<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:021847<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311848<div class="para"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
Junio C Hamano3a702342007-12-12 21:34:021849copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
1850output. These options can be combined with other options, such as
Junio C Hamanoba4b9282008-07-06 05:20:311851<tt>-p</tt>, and are meant for human consumption.</p></div>
1852<div class="para"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
Junio C Hamano3a702342007-12-12 21:34:021853formats the pathnames compactly by combining common prefix and suffix of
1854the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
Junio C Hamanoba4b9282008-07-06 05:20:311855<tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:021856<div class="listingblock">
1857<div class="content">
1858<pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
1859</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311860<div class="para"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
Junio C Hamano3a702342007-12-12 21:34:021861for easier machine consumption. An entry in <tt>--numstat</tt> output looks
Junio C Hamanoba4b9282008-07-06 05:20:311862like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:021863<div class="listingblock">
1864<div class="content">
1865<pre><tt>1 2 README
18663 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
1867</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311868<div class="para"><p>That is, from left to right:</p></div>
1869<div class="olist"><ol>
Junio C Hamano3a702342007-12-12 21:34:021870<li>
1871<p>
1872the number of added lines;
1873</p>
1874</li>
1875<li>
1876<p>
1877a tab;
1878</p>
1879</li>
1880<li>
1881<p>
1882the number of deleted lines;
1883</p>
1884</li>
1885<li>
1886<p>
1887a tab;
1888</p>
1889</li>
1890<li>
1891<p>
1892pathname (possibly with rename/copy information);
1893</p>
1894</li>
1895<li>
1896<p>
1897a newline.
1898</p>
1899</li>
Junio C Hamanoba4b9282008-07-06 05:20:311900</ol></div>
1901<div class="para"><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:021902<div class="listingblock">
1903<div class="content">
1904<pre><tt>1 2 README NUL
19053 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
1906</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311907<div class="para"><p>That is:</p></div>
1908<div class="olist"><ol>
Junio C Hamano3a702342007-12-12 21:34:021909<li>
1910<p>
1911the number of added lines;
1912</p>
1913</li>
1914<li>
1915<p>
1916a tab;
1917</p>
1918</li>
1919<li>
1920<p>
1921the number of deleted lines;
1922</p>
1923</li>
1924<li>
1925<p>
1926a tab;
1927</p>
1928</li>
1929<li>
1930<p>
1931a NUL (only exists if renamed/copied);
1932</p>
1933</li>
1934<li>
1935<p>
1936pathname in preimage;
1937</p>
1938</li>
1939<li>
1940<p>
1941a NUL (only exists if renamed/copied);
1942</p>
1943</li>
1944<li>
1945<p>
1946pathname in postimage (only exists if renamed/copied);
1947</p>
1948</li>
1949<li>
1950<p>
1951a NUL.
1952</p>
1953</li>
Junio C Hamanoba4b9282008-07-06 05:20:311954</ol></div>
1955<div class="para"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
Junio C Hamano3a702342007-12-12 21:34:021956scripts that read the output to tell if the current record being read is
1957a single-path record or a rename/copy record without reading ahead.
1958After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
Junio C Hamanoba4b9282008-07-06 05:20:311959the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:021960</div>
Junio C Hamanoba4b9282008-07-06 05:20:311961<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231962<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311963<div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231964</div>
Junio C Hamanoba4b9282008-07-06 05:20:311965<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231966<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311967<div class="para"><p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231968</div>
Junio C Hamanoba4b9282008-07-06 05:20:311969<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231970<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311971<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231972</div>
1973<div id="footer">
1974<div id="footer-text">
Junio C Hamano543f8d62009-07-29 08:35:211975Last updated 2009-07-29 08:35:00 UTC
Junio C Hamano1a4e8412005-12-27 08:17:231976</div>
1977</div>
1978</body>
1979</html>