Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-diff-tree.xml
blob31a7973572c75956f7e0d99acad312e00c8ad90a
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-diff-tree(1)">\r
5     <title>git-diff-tree(1)</title>\r
6 <indexterm>\r
7 <primary>git-diff-tree(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-diff-tree(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-diff-tree - Compares the content and mode of blobs found via two tree objects</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-diff-tree(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git diff-tree</emphasis> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]\r
17               [-t] [-r] [-c | --cc] [--root] [&lt;common diff options&gt;]\r
18               &lt;tree-ish&gt; [&lt;tree-ish&gt;] [&lt;path&gt;&#8230;]</literallayout>\r
19 </blockquote>\r
20 </simplesect>\r
21 <simplesect id="git-diff-tree(1)__description">\r
22 <title>DESCRIPTION</title>\r
23 <simpara>Compares the content and mode of the blobs found via two tree objects.</simpara>\r
24 <simpara>If there is only one &lt;tree-ish&gt; given, the commit is compared with its parents\r
25 (see --stdin below).</simpara>\r
26 <simpara>Note that <emphasis>git diff-tree</emphasis> can use the tree encapsulated in a commit object.</simpara>\r
27 </simplesect>\r
28 <simplesect id="git-diff-tree(1)__options">\r
29 <title>OPTIONS</title>\r
30 <variablelist>\r
31 <varlistentry>\r
32 <term>\r
33 -p\r
34 </term>\r
35 <term>\r
36 -u\r
37 </term>\r
38 <term>\r
39 --patch\r
40 </term>\r
41 <listitem>\r
42 <simpara>\r
43         Generate patch (see section on generating patches).\r
44         \r
45 </simpara>\r
46 </listitem>\r
47 </varlistentry>\r
48 <varlistentry>\r
49 <term>\r
50 -U&lt;n&gt;\r
51 </term>\r
52 <term>\r
53 --unified=&lt;n&gt;\r
54 </term>\r
55 <listitem>\r
56 <simpara>\r
57         Generate diffs with &lt;n&gt; lines of context instead of\r
58         the usual three.\r
59         Implies <emphasis>-p</emphasis>.\r
60 </simpara>\r
61 </listitem>\r
62 </varlistentry>\r
63 <varlistentry>\r
64 <term>\r
65 --raw\r
66 </term>\r
67 <listitem>\r
68 <simpara>\r
69         Generate the raw format.\r
70          This is the default.\r
71 </simpara>\r
72 </listitem>\r
73 </varlistentry>\r
74 <varlistentry>\r
75 <term>\r
76 --patch-with-raw\r
77 </term>\r
78 <listitem>\r
79 <simpara>\r
80         Synonym for <emphasis>-p --raw</emphasis>.\r
81 </simpara>\r
82 </listitem>\r
83 </varlistentry>\r
84 <varlistentry>\r
85 <term>\r
86 --minimal\r
87 </term>\r
88 <listitem>\r
89 <simpara>\r
90         Spend extra time to make sure the smallest possible\r
91         diff is produced.\r
92 </simpara>\r
93 </listitem>\r
94 </varlistentry>\r
95 <varlistentry>\r
96 <term>\r
97 --patience\r
98 </term>\r
99 <listitem>\r
100 <simpara>\r
101         Generate a diff using the "patience diff" algorithm.\r
102 </simpara>\r
103 </listitem>\r
104 </varlistentry>\r
105 <varlistentry>\r
106 <term>\r
107 --histogram\r
108 </term>\r
109 <listitem>\r
110 <simpara>\r
111         Generate a diff using the "histogram diff" algorithm.\r
112 </simpara>\r
113 </listitem>\r
114 </varlistentry>\r
115 <varlistentry>\r
116 <term>\r
117 --stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]\r
118 </term>\r
119 <listitem>\r
120 <simpara>\r
121         Generate a diffstat. By default, as much space as necessary\r
122         will be used for the filename part, and the rest for the graph\r
123         part. Maximum width defaults to terminal width, or 80 columns\r
124         if not connected to a terminal, and can be overridden by\r
125         <emphasis>&lt;width&gt;</emphasis>. The width of the filename part can be limited by\r
126         giving another width <emphasis>&lt;name-width&gt;</emphasis> after a comma. The width\r
127         of the graph part can be limited by using\r
128         <emphasis>--stat-graph-width=&lt;width&gt;</emphasis> (affects all commands generating\r
129         a stat graph) or by setting <emphasis>diff.statGraphWidth=&lt;width&gt;</emphasis>\r
130         (does not affect <emphasis>git format-patch</emphasis>).\r
131         By giving a third parameter <emphasis>&lt;count&gt;</emphasis>, you can limit the\r
132         output to the first <emphasis>&lt;count&gt;</emphasis> lines, followed by <emphasis>...</emphasis> if\r
133         there are more.\r
134 </simpara>\r
135 <simpara>These parameters can also be set individually with <emphasis>--stat-width=&lt;width&gt;</emphasis>,\r
136 <emphasis>--stat-name-width=&lt;name-width&gt;</emphasis> and <emphasis>--stat-count=&lt;count&gt;</emphasis>.</simpara>\r
137 </listitem>\r
138 </varlistentry>\r
139 <varlistentry>\r
140 <term>\r
141 --numstat\r
142 </term>\r
143 <listitem>\r
144 <simpara>\r
145         Similar to <emphasis>--stat</emphasis>, but shows number of added and\r
146         deleted lines in decimal notation and pathname without\r
147         abbreviation, to make it more machine friendly.  For\r
148         binary files, outputs two <emphasis>-</emphasis> instead of saying\r
149         <emphasis>0 0</emphasis>.\r
150 </simpara>\r
151 </listitem>\r
152 </varlistentry>\r
153 <varlistentry>\r
154 <term>\r
155 --shortstat\r
156 </term>\r
157 <listitem>\r
158 <simpara>\r
159         Output only the last line of the <emphasis>--stat</emphasis> format containing total\r
160         number of modified files, as well as number of added and deleted\r
161         lines.\r
162 </simpara>\r
163 </listitem>\r
164 </varlistentry>\r
165 <varlistentry>\r
166 <term>\r
167 --dirstat[=&lt;param1,param2,&#8230;&gt;]\r
168 </term>\r
169 <listitem>\r
170 <simpara>\r
171         Output the distribution of relative amount of changes for each\r
172         sub-directory. The behavior of <emphasis>--dirstat</emphasis> can be customized by\r
173         passing it a comma separated list of parameters.\r
174         The defaults are controlled by the <emphasis>diff.dirstat</emphasis> configuration\r
175         variable (see <xref linkend="git-config(1)" />).\r
176         The following parameters are available:\r
177 </simpara>\r
178 <variablelist>\r
179 <varlistentry>\r
180 <term>\r
181 <emphasis>changes</emphasis>\r
182 </term>\r
183 <listitem>\r
184 <simpara>\r
185         Compute the dirstat numbers by counting the lines that have been\r
186         removed from the source, or added to the destination. This ignores\r
187         the amount of pure code movements within a file.  In other words,\r
188         rearranging lines in a file is not counted as much as other changes.\r
189         This is the default behavior when no parameter is given.\r
190 </simpara>\r
191 </listitem>\r
192 </varlistentry>\r
193 <varlistentry>\r
194 <term>\r
195 <emphasis>lines</emphasis>\r
196 </term>\r
197 <listitem>\r
198 <simpara>\r
199         Compute the dirstat numbers by doing the regular line-based diff\r
200         analysis, and summing the removed/added line counts. (For binary\r
201         files, count 64-byte chunks instead, since binary files have no\r
202         natural concept of lines). This is a more expensive <emphasis>--dirstat</emphasis>\r
203         behavior than the <emphasis>changes</emphasis> behavior, but it does count rearranged\r
204         lines within a file as much as other changes. The resulting output\r
205         is consistent with what you get from the other <emphasis>--*stat</emphasis> options.\r
206 </simpara>\r
207 </listitem>\r
208 </varlistentry>\r
209 <varlistentry>\r
210 <term>\r
211 <emphasis>files</emphasis>\r
212 </term>\r
213 <listitem>\r
214 <simpara>\r
215         Compute the dirstat numbers by counting the number of files changed.\r
216         Each changed file counts equally in the dirstat analysis. This is\r
217         the computationally cheapest <emphasis>--dirstat</emphasis> behavior, since it does\r
218         not have to look at the file contents at all.\r
219 </simpara>\r
220 </listitem>\r
221 </varlistentry>\r
222 <varlistentry>\r
223 <term>\r
224 <emphasis>cumulative</emphasis>\r
225 </term>\r
226 <listitem>\r
227 <simpara>\r
228         Count changes in a child directory for the parent directory as well.\r
229         Note that when using <emphasis>cumulative</emphasis>, the sum of the percentages\r
230         reported may exceed 100%. The default (non-cumulative) behavior can\r
231         be specified with the <emphasis>noncumulative</emphasis> parameter.\r
232 </simpara>\r
233 </listitem>\r
234 </varlistentry>\r
235 <varlistentry>\r
236 <term>\r
237 &lt;limit&gt;\r
238 </term>\r
239 <listitem>\r
240 <simpara>\r
241         An integer parameter specifies a cut-off percent (3% by default).\r
242         Directories contributing less than this percentage of the changes\r
243         are not shown in the output.\r
244 </simpara>\r
245 </listitem>\r
246 </varlistentry>\r
247 </variablelist>\r
248 <simpara>Example: The following will count changed files, while ignoring\r
249 directories with less than 10% of the total amount of changed files,\r
250 and accumulating child directory counts in the parent directories:\r
251 <emphasis>--dirstat=files,10,cumulative</emphasis>.</simpara>\r
252 </listitem>\r
253 </varlistentry>\r
254 <varlistentry>\r
255 <term>\r
256 --summary\r
257 </term>\r
258 <listitem>\r
259 <simpara>\r
260         Output a condensed summary of extended header information\r
261         such as creations, renames and mode changes.\r
262 </simpara>\r
263 </listitem>\r
264 </varlistentry>\r
265 <varlistentry>\r
266 <term>\r
267 --patch-with-stat\r
268 </term>\r
269 <listitem>\r
270 <simpara>\r
271         Synonym for <emphasis>-p --stat</emphasis>.\r
272 </simpara>\r
273 </listitem>\r
274 </varlistentry>\r
275 <varlistentry>\r
276 <term>\r
277 -z\r
278 </term>\r
279 <listitem>\r
280 <simpara>\r
281         When <emphasis>--raw</emphasis>, <emphasis>--numstat</emphasis>, <emphasis>--name-only</emphasis> or <emphasis>--name-status</emphasis> has been\r
282         given, do not munge pathnames and use NULs as output field terminators.\r
283 </simpara>\r
284 <simpara>Without this option, each pathname output will have TAB, LF, double quotes,\r
285 and backslash characters replaced with <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, <emphasis>\"</emphasis>, and <emphasis>\\</emphasis>,\r
286 respectively, and the pathname will be enclosed in double quotes if\r
287 any of those replacements occurred.</simpara>\r
288 </listitem>\r
289 </varlistentry>\r
290 <varlistentry>\r
291 <term>\r
292 --name-only\r
293 </term>\r
294 <listitem>\r
295 <simpara>\r
296         Show only names of changed files.\r
297 </simpara>\r
298 </listitem>\r
299 </varlistentry>\r
300 <varlistentry>\r
301 <term>\r
302 --name-status\r
303 </term>\r
304 <listitem>\r
305 <simpara>\r
306         Show only names and status of changed files. See the description\r
307         of the <emphasis>--diff-filter</emphasis> option on what the status letters mean.\r
308 </simpara>\r
309 </listitem>\r
310 </varlistentry>\r
311 <varlistentry>\r
312 <term>\r
313 --submodule[=&lt;format&gt;]\r
314 </term>\r
315 <listitem>\r
316 <simpara>\r
317         Specify how differences in submodules are shown.  When <emphasis>--submodule</emphasis>\r
318         or <emphasis>--submodule=log</emphasis> is given, the <emphasis>log</emphasis> format is used.  This format lists\r
319         the commits in the range like <xref linkend="git-submodule(1)" /> <emphasis>summary</emphasis> does.\r
320         Omitting the <emphasis>--submodule</emphasis> option or specifying <emphasis>--submodule=short</emphasis>,\r
321         uses the <emphasis>short</emphasis> format. This format just shows the names of the commits\r
322         at the beginning and end of the range.  Can be tweaked via the\r
323         <emphasis>diff.submodule</emphasis> configuration variable.\r
324 </simpara>\r
325 </listitem>\r
326 </varlistentry>\r
327 <varlistentry>\r
328 <term>\r
329 --color[=&lt;when&gt;]\r
330 </term>\r
331 <listitem>\r
332 <simpara>\r
333         Show colored diff.\r
334         The value must be <emphasis>always</emphasis> (the default for <emphasis>&lt;when&gt;</emphasis>), <emphasis>never</emphasis>, or <emphasis>auto</emphasis>.\r
335         The default value is <emphasis>never</emphasis>.\r
336 </simpara>\r
337 </listitem>\r
338 </varlistentry>\r
339 <varlistentry>\r
340 <term>\r
341 --no-color\r
342 </term>\r
343 <listitem>\r
344 <simpara>\r
345         Turn off colored diff.\r
346         It is the same as <emphasis>--color=never</emphasis>.\r
347 </simpara>\r
348 </listitem>\r
349 </varlistentry>\r
350 <varlistentry>\r
351 <term>\r
352 --word-diff[=&lt;mode&gt;]\r
353 </term>\r
354 <listitem>\r
355 <simpara>\r
356         Show a word diff, using the &lt;mode&gt; to delimit changed words.\r
357         By default, words are delimited by whitespace; see\r
358         <emphasis>--word-diff-regex</emphasis> below.  The &lt;mode&gt; defaults to <emphasis>plain</emphasis>, and\r
359         must be one of:\r
360 </simpara>\r
361 <variablelist>\r
362 <varlistentry>\r
363 <term>\r
364 color\r
365 </term>\r
366 <listitem>\r
367 <simpara>\r
368         Highlight changed words using only colors.  Implies <emphasis>--color</emphasis>.\r
369 </simpara>\r
370 </listitem>\r
371 </varlistentry>\r
372 <varlistentry>\r
373 <term>\r
374 plain\r
375 </term>\r
376 <listitem>\r
377 <simpara>\r
378         Show words as <emphasis>[-removed-]</emphasis> and <emphasis>{+added+}</emphasis>.  Makes no\r
379         attempts to escape the delimiters if they appear in the input,\r
380         so the output may be ambiguous.\r
381 </simpara>\r
382 </listitem>\r
383 </varlistentry>\r
384 <varlistentry>\r
385 <term>\r
386 porcelain\r
387 </term>\r
388 <listitem>\r
389 <simpara>\r
390         Use a special line-based format intended for script\r
391         consumption.  Added/removed/unchanged runs are printed in the\r
392         usual unified diff format, starting with a <emphasis>+</emphasis>/<emphasis>-</emphasis>/` `\r
393         character at the beginning of the line and extending to the\r
394         end of the line.  Newlines in the input are represented by a\r
395         tilde <emphasis>~</emphasis> on a line of its own.\r
396 </simpara>\r
397 </listitem>\r
398 </varlistentry>\r
399 <varlistentry>\r
400 <term>\r
401 none\r
402 </term>\r
403 <listitem>\r
404 <simpara>\r
405         Disable word diff again.\r
406 </simpara>\r
407 </listitem>\r
408 </varlistentry>\r
409 </variablelist>\r
410 <simpara>Note that despite the name of the first mode, color is used to\r
411 highlight the changed parts in all modes if enabled.</simpara>\r
412 </listitem>\r
413 </varlistentry>\r
414 <varlistentry>\r
415 <term>\r
416 --word-diff-regex=&lt;regex&gt;\r
417 </term>\r
418 <listitem>\r
419 <simpara>\r
420         Use &lt;regex&gt; to decide what a word is, instead of considering\r
421         runs of non-whitespace to be a word.  Also implies\r
422         <emphasis>--word-diff</emphasis> unless it was already enabled.\r
423 </simpara>\r
424 <simpara>Every non-overlapping match of the\r
425 &lt;regex&gt; is considered a word.  Anything between these matches is\r
426 considered whitespace and ignored(!) for the purposes of finding\r
427 differences.  You may want to append <emphasis>|[^[:space:]]</emphasis> to your regular\r
428 expression to make sure that it matches all non-whitespace characters.\r
429 A match that contains a newline is silently truncated(!) at the\r
430 newline.</simpara>\r
431 <simpara>The regex can also be set via a diff driver or configuration option, see\r
432 <xref linkend="gitattributes(1)" /> or <xref linkend="git-config(1)" />.  Giving it explicitly\r
433 overrides any diff driver or configuration setting.  Diff drivers\r
434 override configuration settings.</simpara>\r
435 </listitem>\r
436 </varlistentry>\r
437 <varlistentry>\r
438 <term>\r
439 --color-words[=&lt;regex&gt;]\r
440 </term>\r
441 <listitem>\r
442 <simpara>\r
443         Equivalent to <emphasis>--word-diff=color</emphasis> plus (if a regex was\r
444         specified) <emphasis>--word-diff-regex=&lt;regex&gt;</emphasis>.\r
445 </simpara>\r
446 </listitem>\r
447 </varlistentry>\r
448 <varlistentry>\r
449 <term>\r
450 --no-renames\r
451 </term>\r
452 <listitem>\r
453 <simpara>\r
454         Turn off rename detection, even when the configuration\r
455         file gives the default to do so.\r
456 </simpara>\r
457 </listitem>\r
458 </varlistentry>\r
459 <varlistentry>\r
460 <term>\r
461 --check\r
462 </term>\r
463 <listitem>\r
464 <simpara>\r
465         Warn if changes introduce whitespace errors.  What are\r
466         considered whitespace errors is controlled by <emphasis>core.whitespace</emphasis>\r
467         configuration.  By default, trailing whitespaces (including\r
468         lines that solely consist of whitespaces) and a space character\r
469         that is immediately followed by a tab character inside the\r
470         initial indent of the line are considered whitespace errors.\r
471         Exits with non-zero status if problems are found. Not compatible\r
472         with --exit-code.\r
473 </simpara>\r
474 </listitem>\r
475 </varlistentry>\r
476 <varlistentry>\r
477 <term>\r
478 --full-index\r
479 </term>\r
480 <listitem>\r
481 <simpara>\r
482         Instead of the first handful of characters, show the full\r
483         pre- and post-image blob object names on the "index"\r
484         line when generating patch format output.\r
485 </simpara>\r
486 </listitem>\r
487 </varlistentry>\r
488 <varlistentry>\r
489 <term>\r
490 --binary\r
491 </term>\r
492 <listitem>\r
493 <simpara>\r
494         In addition to <emphasis>--full-index</emphasis>, output a binary diff that\r
495         can be applied with <emphasis>git-apply</emphasis>.\r
496 </simpara>\r
497 </listitem>\r
498 </varlistentry>\r
499 <varlistentry>\r
500 <term>\r
501 --abbrev[=&lt;n&gt;]\r
502 </term>\r
503 <listitem>\r
504 <simpara>\r
505         Instead of showing the full 40-byte hexadecimal object\r
506         name in diff-raw format output and diff-tree header\r
507         lines, show only a partial prefix.  This is\r
508         independent of the <emphasis>--full-index</emphasis> option above, which controls\r
509         the diff-patch output format.  Non default number of\r
510         digits can be specified with <emphasis>--abbrev=&lt;n&gt;</emphasis>.\r
511 </simpara>\r
512 </listitem>\r
513 </varlistentry>\r
514 <varlistentry>\r
515 <term>\r
516 -B[&lt;n&gt;][/&lt;m&gt;]\r
517 </term>\r
518 <term>\r
519 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]\r
520 </term>\r
521 <listitem>\r
522 <simpara>\r
523         Break complete rewrite changes into pairs of delete and\r
524         create. This serves two purposes:\r
525 </simpara>\r
526 <simpara>It affects the way a change that amounts to a total rewrite of a file\r
527 not as a series of deletion and insertion mixed together with a very\r
528 few lines that happen to match textually as the context, but as a\r
529 single deletion of everything old followed by a single insertion of\r
530 everything new, and the number <emphasis>m</emphasis> controls this aspect of the -B\r
531 option (defaults to 60%). <emphasis>-B/70%</emphasis> specifies that less than 30% of the\r
532 original should remain in the result for git to consider it a total\r
533 rewrite (i.e. otherwise the resulting patch will be a series of\r
534 deletion and insertion mixed together with context lines).</simpara>\r
535 <simpara>When used with -M, a totally-rewritten file is also considered as the\r
536 source of a rename (usually -M only considers a file that disappeared\r
537 as the source of a rename), and the number <emphasis>n</emphasis> controls this aspect of\r
538 the -B option (defaults to 50%). <emphasis>-B20%</emphasis> specifies that a change with\r
539 addition and deletion compared to 20% or more of the file's size are\r
540 eligible for being picked up as a possible source of a rename to\r
541 another file.</simpara>\r
542 </listitem>\r
543 </varlistentry>\r
544 <varlistentry>\r
545 <term>\r
546 -M[&lt;n&gt;]\r
547 </term>\r
548 <term>\r
549 --find-renames[=&lt;n&gt;]\r
550 </term>\r
551 <listitem>\r
552 <simpara>\r
553         Detect renames.\r
554         If <emphasis>n</emphasis> is specified, it is a threshold on the similarity\r
555         index (i.e. amount of addition/deletions compared to the\r
556         file's size). For example, <emphasis>-M90%</emphasis> means git should consider a\r
557         delete/add pair to be a rename if more than 90% of the file\r
558         hasn't changed.  Without a <emphasis>%</emphasis> sign, the number is to be read as\r
559         a fraction, with a decimal point before it.  I.e., <emphasis>-M5</emphasis> becomes\r
560         0.5, and is thus the same as <emphasis>-M50%</emphasis>.  Similarly, <emphasis>-M05</emphasis> is\r
561         the same as <emphasis>-M5%</emphasis>.  To limit detection to exact renames, use\r
562         <emphasis>-M100%</emphasis>.\r
563 </simpara>\r
564 </listitem>\r
565 </varlistentry>\r
566 <varlistentry>\r
567 <term>\r
568 -C[&lt;n&gt;]\r
569 </term>\r
570 <term>\r
571 --find-copies[=&lt;n&gt;]\r
572 </term>\r
573 <listitem>\r
574 <simpara>\r
575         Detect copies as well as renames.  See also <emphasis>--find-copies-harder</emphasis>.\r
576         If <emphasis>n</emphasis> is specified, it has the same meaning as for <emphasis>-M&lt;n&gt;</emphasis>.\r
577 </simpara>\r
578 </listitem>\r
579 </varlistentry>\r
580 <varlistentry>\r
581 <term>\r
582 --find-copies-harder\r
583 </term>\r
584 <listitem>\r
585 <simpara>\r
586         For performance reasons, by default, <emphasis>-C</emphasis> option finds copies only\r
587         if the original file of the copy was modified in the same\r
588         changeset.  This flag makes the command\r
589         inspect unmodified files as candidates for the source of\r
590         copy.  This is a very expensive operation for large\r
591         projects, so use it with caution.  Giving more than one\r
592         <emphasis>-C</emphasis> option has the same effect.\r
593 </simpara>\r
594 </listitem>\r
595 </varlistentry>\r
596 <varlistentry>\r
597 <term>\r
598 -D\r
599 </term>\r
600 <term>\r
601 --irreversible-delete\r
602 </term>\r
603 <listitem>\r
604 <simpara>\r
605         Omit the preimage for deletes, i.e. print only the header but not\r
606         the diff between the preimage and <emphasis>/dev/null</emphasis>. The resulting patch\r
607         is not meant to be applied with <emphasis>patch</emphasis> nor <emphasis>git apply</emphasis>; this is\r
608         solely for people who want to just concentrate on reviewing the\r
609         text after the change. In addition, the output obviously lack\r
610         enough information to apply such a patch in reverse, even manually,\r
611         hence the name of the option.\r
612 </simpara>\r
613 <simpara>When used together with <emphasis>-B</emphasis>, omit also the preimage in the deletion part\r
614 of a delete/create pair.</simpara>\r
615 </listitem>\r
616 </varlistentry>\r
617 <varlistentry>\r
618 <term>\r
619 -l&lt;num&gt;\r
620 </term>\r
621 <listitem>\r
622 <simpara>\r
623         The <emphasis>-M</emphasis> and <emphasis>-C</emphasis> options require O(n^2) processing time where n\r
624         is the number of potential rename/copy targets.  This\r
625         option prevents rename/copy detection from running if\r
626         the number of rename/copy targets exceeds the specified\r
627         number.\r
628 </simpara>\r
629 </listitem>\r
630 </varlistentry>\r
631 <varlistentry>\r
632 <term>\r
633 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]\r
634 </term>\r
635 <listitem>\r
636 <simpara>\r
637         Select only files that are Added (<emphasis>A</emphasis>), Copied (<emphasis>C</emphasis>),\r
638         Deleted (<emphasis>D</emphasis>), Modified (<emphasis>M</emphasis>), Renamed (<emphasis>R</emphasis>), have their\r
639         type (i.e. regular file, symlink, submodule, &#8230;) changed (<emphasis>T</emphasis>),\r
640         are Unmerged (<emphasis>U</emphasis>), are\r
641         Unknown (<emphasis>X</emphasis>), or have had their pairing Broken (<emphasis>B</emphasis>).\r
642         Any combination of the filter characters (including none) can be used.\r
643         When <emphasis>*</emphasis> (All-or-none) is added to the combination, all\r
644         paths are selected if there is any file that matches\r
645         other criteria in the comparison; if there is no file\r
646         that matches other criteria, nothing is selected.\r
647 </simpara>\r
648 </listitem>\r
649 </varlistentry>\r
650 <varlistentry>\r
651 <term>\r
652 -S&lt;string&gt;\r
653 </term>\r
654 <listitem>\r
655 <simpara>\r
656         Look for differences that introduce or remove an instance of\r
657         &lt;string&gt;. Note that this is different than the string simply\r
658         appearing in diff output; see the <emphasis>pickaxe</emphasis> entry in\r
659         <xref linkend="gitdiffcore(7)" /> for more details.\r
660 </simpara>\r
661 </listitem>\r
662 </varlistentry>\r
663 <varlistentry>\r
664 <term>\r
665 -G&lt;regex&gt;\r
666 </term>\r
667 <listitem>\r
668 <simpara>\r
669         Look for differences whose added or removed line matches\r
670         the given &lt;regex&gt;.\r
671 </simpara>\r
672 </listitem>\r
673 </varlistentry>\r
674 <varlistentry>\r
675 <term>\r
676 --pickaxe-all\r
677 </term>\r
678 <listitem>\r
679 <simpara>\r
680         When <emphasis>-S</emphasis> or <emphasis>-G</emphasis> finds a change, show all the changes in that\r
681         changeset, not just the files that contain the change\r
682         in &lt;string&gt;.\r
683 </simpara>\r
684 </listitem>\r
685 </varlistentry>\r
686 <varlistentry>\r
687 <term>\r
688 --pickaxe-regex\r
689 </term>\r
690 <listitem>\r
691 <simpara>\r
692         Make the &lt;string&gt; not a plain string but an extended POSIX\r
693         regex to match.\r
694 </simpara>\r
695 </listitem>\r
696 </varlistentry>\r
697 <varlistentry>\r
698 <term>\r
699 -O&lt;orderfile&gt;\r
700 </term>\r
701 <listitem>\r
702 <simpara>\r
703         Output the patch in the order specified in the\r
704         &lt;orderfile&gt;, which has one shell glob pattern per line.\r
705 </simpara>\r
706 </listitem>\r
707 </varlistentry>\r
708 <varlistentry>\r
709 <term>\r
710 -R\r
711 </term>\r
712 <listitem>\r
713 <simpara>\r
714         Swap two inputs; that is, show differences from index or\r
715         on-disk file to tree contents.\r
716 </simpara>\r
717 </listitem>\r
718 </varlistentry>\r
719 <varlistentry>\r
720 <term>\r
721 --relative[=&lt;path&gt;]\r
722 </term>\r
723 <listitem>\r
724 <simpara>\r
725         When run from a subdirectory of the project, it can be\r
726         told to exclude changes outside the directory and show\r
727         pathnames relative to it with this option.  When you are\r
728         not in a subdirectory (e.g. in a bare repository), you\r
729         can name which subdirectory to make the output relative\r
730         to by giving a &lt;path&gt; as an argument.\r
731 </simpara>\r
732 </listitem>\r
733 </varlistentry>\r
734 <varlistentry>\r
735 <term>\r
736 -a\r
737 </term>\r
738 <term>\r
739 --text\r
740 </term>\r
741 <listitem>\r
742 <simpara>\r
743         Treat all files as text.\r
744 </simpara>\r
745 </listitem>\r
746 </varlistentry>\r
747 <varlistentry>\r
748 <term>\r
749 --ignore-space-at-eol\r
750 </term>\r
751 <listitem>\r
752 <simpara>\r
753         Ignore changes in whitespace at EOL.\r
754 </simpara>\r
755 </listitem>\r
756 </varlistentry>\r
757 <varlistentry>\r
758 <term>\r
759 -b\r
760 </term>\r
761 <term>\r
762 --ignore-space-change\r
763 </term>\r
764 <listitem>\r
765 <simpara>\r
766         Ignore changes in amount of whitespace.  This ignores whitespace\r
767         at line end, and considers all other sequences of one or\r
768         more whitespace characters to be equivalent.\r
769 </simpara>\r
770 </listitem>\r
771 </varlistentry>\r
772 <varlistentry>\r
773 <term>\r
774 -w\r
775 </term>\r
776 <term>\r
777 --ignore-all-space\r
778 </term>\r
779 <listitem>\r
780 <simpara>\r
781         Ignore whitespace when comparing lines.  This ignores\r
782         differences even if one line has whitespace where the other\r
783         line has none.\r
784 </simpara>\r
785 </listitem>\r
786 </varlistentry>\r
787 <varlistentry>\r
788 <term>\r
789 --inter-hunk-context=&lt;lines&gt;\r
790 </term>\r
791 <listitem>\r
792 <simpara>\r
793         Show the context between diff hunks, up to the specified number\r
794         of lines, thereby fusing hunks that are close to each other.\r
795 </simpara>\r
796 </listitem>\r
797 </varlistentry>\r
798 <varlistentry>\r
799 <term>\r
800 -W\r
801 </term>\r
802 <term>\r
803 --function-context\r
804 </term>\r
805 <listitem>\r
806 <simpara>\r
807         Show whole surrounding functions of changes.\r
808 </simpara>\r
809 </listitem>\r
810 </varlistentry>\r
811 <varlistentry>\r
812 <term>\r
813 --exit-code\r
814 </term>\r
815 <listitem>\r
816 <simpara>\r
817         Make the program exit with codes similar to diff(1).\r
818         That is, it exits with 1 if there were differences and\r
819         0 means no differences.\r
820 </simpara>\r
821 </listitem>\r
822 </varlistentry>\r
823 <varlistentry>\r
824 <term>\r
825 --quiet\r
826 </term>\r
827 <listitem>\r
828 <simpara>\r
829         Disable all output of the program. Implies <emphasis>--exit-code</emphasis>.\r
830 </simpara>\r
831 </listitem>\r
832 </varlistentry>\r
833 <varlistentry>\r
834 <term>\r
835 --ext-diff\r
836 </term>\r
837 <listitem>\r
838 <simpara>\r
839         Allow an external diff helper to be executed. If you set an\r
840         external diff driver with <xref linkend="gitattributes(5)" />, you need\r
841         to use this option with <xref linkend="git-log(1)" /> and friends.\r
842 </simpara>\r
843 </listitem>\r
844 </varlistentry>\r
845 <varlistentry>\r
846 <term>\r
847 --no-ext-diff\r
848 </term>\r
849 <listitem>\r
850 <simpara>\r
851         Disallow external diff drivers.\r
852 </simpara>\r
853 </listitem>\r
854 </varlistentry>\r
855 <varlistentry>\r
856 <term>\r
857 --textconv\r
858 </term>\r
859 <term>\r
860 --no-textconv\r
861 </term>\r
862 <listitem>\r
863 <simpara>\r
864         Allow (or disallow) external text conversion filters to be run\r
865         when comparing binary files. See <xref linkend="gitattributes(5)" /> for\r
866         details. Because textconv filters are typically a one-way\r
867         conversion, the resulting diff is suitable for human\r
868         consumption, but cannot be applied. For this reason, textconv\r
869         filters are enabled by default only for <xref linkend="git-diff(1)" /> and\r
870         <xref linkend="git-log(1)" />, but not for <xref linkend="git-format-patch(1)" /> or\r
871         diff plumbing commands.\r
872 </simpara>\r
873 </listitem>\r
874 </varlistentry>\r
875 <varlistentry>\r
876 <term>\r
877 --ignore-submodules[=&lt;when&gt;]\r
878 </term>\r
879 <listitem>\r
880 <simpara>\r
881         Ignore changes to submodules in the diff generation. &lt;when&gt; can be\r
882         either "none", "untracked", "dirty" or "all", which is the default\r
883         Using "none" will consider the submodule modified when it either contains\r
884         untracked or modified files or its HEAD differs from the commit recorded\r
885         in the superproject and can be used to override any settings of the\r
886         <emphasis>ignore</emphasis> option in <xref linkend="git-config(1)" /> or <xref linkend="gitmodules(5)" />. When\r
887         "untracked" is used submodules are not considered dirty when they only\r
888         contain untracked content (but they are still scanned for modified\r
889         content). Using "dirty" ignores all changes to the work tree of submodules,\r
890         only changes to the commits stored in the superproject are shown (this was\r
891         the behavior until 1.7.0). Using "all" hides all changes to submodules.\r
892 </simpara>\r
893 </listitem>\r
894 </varlistentry>\r
895 <varlistentry>\r
896 <term>\r
897 --src-prefix=&lt;prefix&gt;\r
898 </term>\r
899 <listitem>\r
900 <simpara>\r
901         Show the given source prefix instead of "a/".\r
902 </simpara>\r
903 </listitem>\r
904 </varlistentry>\r
905 <varlistentry>\r
906 <term>\r
907 --dst-prefix=&lt;prefix&gt;\r
908 </term>\r
909 <listitem>\r
910 <simpara>\r
911         Show the given destination prefix instead of "b/".\r
912 </simpara>\r
913 </listitem>\r
914 </varlistentry>\r
915 <varlistentry>\r
916 <term>\r
917 --no-prefix\r
918 </term>\r
919 <listitem>\r
920 <simpara>\r
921         Do not show any source or destination prefix.\r
922 </simpara>\r
923 </listitem>\r
924 </varlistentry>\r
925 </variablelist>\r
926 <simpara>For more detailed explanation on these common options, see also\r
927 <xref linkend="gitdiffcore(7)" />.</simpara>\r
928 <variablelist>\r
929 <varlistentry>\r
930 <term>\r
931 &lt;tree-ish&gt;\r
932 </term>\r
933 <listitem>\r
934 <simpara>\r
935         The id of a tree object.\r
936 </simpara>\r
937 </listitem>\r
938 </varlistentry>\r
939 <varlistentry>\r
940 <term>\r
941 &lt;path&gt;&#8230;\r
942 </term>\r
943 <listitem>\r
944 <simpara>\r
945         If provided, the results are limited to a subset of files\r
946         matching one of these prefix strings.\r
947         i.e., file matches <emphasis>/^&lt;pattern1&gt;|&lt;pattern2&gt;|.../</emphasis>\r
948         Note that this parameter does not provide any wildcard or regexp\r
949         features.\r
950 </simpara>\r
951 </listitem>\r
952 </varlistentry>\r
953 <varlistentry>\r
954 <term>\r
955 -r\r
956 </term>\r
957 <listitem>\r
958 <simpara>\r
959         recurse into sub-trees\r
960 </simpara>\r
961 </listitem>\r
962 </varlistentry>\r
963 <varlistentry>\r
964 <term>\r
965 -t\r
966 </term>\r
967 <listitem>\r
968 <simpara>\r
969         show tree entry itself as well as subtrees.  Implies -r.\r
970 </simpara>\r
971 </listitem>\r
972 </varlistentry>\r
973 <varlistentry>\r
974 <term>\r
975 --root\r
976 </term>\r
977 <listitem>\r
978 <simpara>\r
979         When <emphasis>--root</emphasis> is specified the initial commit will be shown as a big\r
980         creation event. This is equivalent to a diff against the NULL tree.\r
981 </simpara>\r
982 </listitem>\r
983 </varlistentry>\r
984 <varlistentry>\r
985 <term>\r
986 --stdin\r
987 </term>\r
988 <listitem>\r
989 <simpara>\r
990         When <emphasis>--stdin</emphasis> is specified, the command does not take\r
991         &lt;tree-ish&gt; arguments from the command line.  Instead, it\r
992         reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a\r
993         list of &lt;commit&gt; from its standard input.  (Use a single space\r
994         as separator.)\r
995 </simpara>\r
996 <simpara>When two trees are given, it compares the first tree with the second.\r
997 When a single commit is given, it compares the commit with its\r
998 parents.  The remaining commits, when given, are used as if they are\r
999 parents of the first commit.</simpara>\r
1000 <simpara>When comparing two trees, the ID of both trees (separated by a space\r
1001 and terminated by a newline) is printed before the difference.  When\r
1002 comparing commits, the ID of the first (or only) commit, followed by a\r
1003 newline, is printed.</simpara>\r
1004 <simpara>The following flags further affect the behavior when comparing\r
1005 commits (but not trees).</simpara>\r
1006 </listitem>\r
1007 </varlistentry>\r
1008 <varlistentry>\r
1009 <term>\r
1010 -m\r
1011 </term>\r
1012 <listitem>\r
1013 <simpara>\r
1014         By default, <emphasis>git diff-tree --stdin</emphasis> does not show\r
1015         differences for merge commits.  With this flag, it shows\r
1016         differences to that commit from all of its parents. See\r
1017         also <emphasis>-c</emphasis>.\r
1018 </simpara>\r
1019 </listitem>\r
1020 </varlistentry>\r
1021 <varlistentry>\r
1022 <term>\r
1023 -s\r
1024 </term>\r
1025 <listitem>\r
1026 <simpara>\r
1027         By default, <emphasis>git diff-tree --stdin</emphasis> shows differences,\r
1028         either in machine-readable form (without <emphasis>-p</emphasis>) or in patch\r
1029         form (with <emphasis>-p</emphasis>).  This output can be suppressed.  It is\r
1030         only useful with <emphasis>-v</emphasis> flag.\r
1031 </simpara>\r
1032 </listitem>\r
1033 </varlistentry>\r
1034 <varlistentry>\r
1035 <term>\r
1036 -v\r
1037 </term>\r
1038 <listitem>\r
1039 <simpara>\r
1040         This flag causes <emphasis>git diff-tree --stdin</emphasis> to also show\r
1041         the commit message before the differences.\r
1042 </simpara>\r
1043 </listitem>\r
1044 </varlistentry>\r
1045 <varlistentry>\r
1046 <term>\r
1047 --pretty[=&lt;format&gt;]\r
1048 </term>\r
1049 <term>\r
1050 --format=&lt;format&gt;\r
1051 </term>\r
1052 <listitem>\r
1053 <simpara>\r
1054         Pretty-print the contents of the commit logs in a given format,\r
1055         where <emphasis>&lt;format&gt;</emphasis> can be one of <emphasis>oneline</emphasis>, <emphasis>short</emphasis>, <emphasis>medium</emphasis>,\r
1056         <emphasis>full</emphasis>, <emphasis>fuller</emphasis>, <emphasis>email</emphasis>, <emphasis>raw</emphasis> and <emphasis>format:&lt;string&gt;</emphasis>.  See\r
1057         the "PRETTY FORMATS" section for some additional details for each\r
1058         format.  When omitted, the format defaults to <emphasis>medium</emphasis>.\r
1059 </simpara>\r
1060 <simpara>Note: you can specify the default pretty format in the repository\r
1061 configuration (see <xref linkend="git-config(1)" />).</simpara>\r
1062 </listitem>\r
1063 </varlistentry>\r
1064 <varlistentry>\r
1065 <term>\r
1066 --abbrev-commit\r
1067 </term>\r
1068 <listitem>\r
1069 <simpara>\r
1070         Instead of showing the full 40-byte hexadecimal commit object\r
1071         name, show only a partial prefix.  Non default number of\r
1072         digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies\r
1073         diff output, if it is displayed).\r
1074 </simpara>\r
1075 <simpara>This should make "--pretty=oneline" a whole lot more readable for\r
1076 people using 80-column terminals.</simpara>\r
1077 </listitem>\r
1078 </varlistentry>\r
1079 <varlistentry>\r
1080 <term>\r
1081 --no-abbrev-commit\r
1082 </term>\r
1083 <listitem>\r
1084 <simpara>\r
1085         Show the full 40-byte hexadecimal commit object name. This negates\r
1086         <emphasis>--abbrev-commit</emphasis> and those options which imply it such as\r
1087         "--oneline". It also overrides the <emphasis>log.abbrevCommit</emphasis> variable.\r
1088 </simpara>\r
1089 </listitem>\r
1090 </varlistentry>\r
1091 <varlistentry>\r
1092 <term>\r
1093 --oneline\r
1094 </term>\r
1095 <listitem>\r
1096 <simpara>\r
1097         This is a shorthand for "--pretty=oneline --abbrev-commit"\r
1098         used together.\r
1099 </simpara>\r
1100 </listitem>\r
1101 </varlistentry>\r
1102 <varlistentry>\r
1103 <term>\r
1104 --encoding[=&lt;encoding&gt;]\r
1105 </term>\r
1106 <listitem>\r
1107 <simpara>\r
1108         The commit objects record the encoding used for the log message\r
1109         in their encoding header; this option can be used to tell the\r
1110         command to re-code the commit log message in the encoding\r
1111         preferred by the user.  For non plumbing commands this\r
1112         defaults to UTF-8.\r
1113 </simpara>\r
1114 </listitem>\r
1115 </varlistentry>\r
1116 <varlistentry>\r
1117 <term>\r
1118 --notes[=&lt;ref&gt;]\r
1119 </term>\r
1120 <listitem>\r
1121 <simpara>\r
1122         Show the notes (see <xref linkend="git-notes(1)" />) that annotate the\r
1123         commit, when showing the commit log message.  This is the default\r
1124         for <emphasis>git log</emphasis>, <emphasis>git show</emphasis> and <emphasis>git whatchanged</emphasis> commands when\r
1125         there is no <emphasis>--pretty</emphasis>, <emphasis>--format</emphasis> nor <emphasis>--oneline</emphasis> option given\r
1126         on the command line.\r
1127 </simpara>\r
1128 <simpara>By default, the notes shown are from the notes refs listed in the\r
1129 <emphasis>core.notesRef</emphasis> and <emphasis>notes.displayRef</emphasis> variables (or corresponding\r
1130 environment overrides). See <xref linkend="git-config(1)" /> for more details.</simpara>\r
1131 <simpara>With an optional <emphasis>&lt;ref&gt;</emphasis> argument, show this notes ref instead of the\r
1132 default notes ref(s). The ref is taken to be in <emphasis>refs/notes/</emphasis> if it\r
1133 is not qualified.</simpara>\r
1134 <simpara>Multiple --notes options can be combined to control which notes are\r
1135 being displayed. Examples: "--notes=foo" will show only notes from\r
1136 "refs/notes/foo"; "--notes=foo --notes" will show both notes from\r
1137 "refs/notes/foo" and from the default notes ref(s).</simpara>\r
1138 </listitem>\r
1139 </varlistentry>\r
1140 <varlistentry>\r
1141 <term>\r
1142 --no-notes\r
1143 </term>\r
1144 <listitem>\r
1145 <simpara>\r
1146         Do not show notes. This negates the above <emphasis>--notes</emphasis> option, by\r
1147         resetting the list of notes refs from which notes are shown.\r
1148         Options are parsed in the order given on the command line, so e.g.\r
1149         "--notes --notes=foo --no-notes --notes=bar" will only show notes\r
1150         from "refs/notes/bar".\r
1151 </simpara>\r
1152 </listitem>\r
1153 </varlistentry>\r
1154 <varlistentry>\r
1155 <term>\r
1156 --show-notes[=&lt;ref&gt;]\r
1157 </term>\r
1158 <term>\r
1159 --[no-]standard-notes\r
1160 </term>\r
1161 <listitem>\r
1162 <simpara>\r
1163         These options are deprecated. Use the above --notes/--no-notes\r
1164         options instead.\r
1165 </simpara>\r
1166 </listitem>\r
1167 </varlistentry>\r
1168 <varlistentry>\r
1169 <term>\r
1170 --show-signature\r
1171 </term>\r
1172 <listitem>\r
1173 <simpara>\r
1174         Check the validity of a signed commit object by passing the signature\r
1175         to <emphasis>gpg --verify</emphasis> and show the output.\r
1176 </simpara>\r
1177 </listitem>\r
1178 </varlistentry>\r
1179 <varlistentry>\r
1180 <term>\r
1181 --no-commit-id\r
1182 </term>\r
1183 <listitem>\r
1184 <simpara>\r
1185         <emphasis>git diff-tree</emphasis> outputs a line with the commit ID when\r
1186         applicable.  This flag suppressed the commit ID output.\r
1187 </simpara>\r
1188 </listitem>\r
1189 </varlistentry>\r
1190 <varlistentry>\r
1191 <term>\r
1192 -c\r
1193 </term>\r
1194 <listitem>\r
1195 <simpara>\r
1196         This flag changes the way a merge commit is displayed\r
1197         (which means it is useful only when the command is given\r
1198         one &lt;tree-ish&gt;, or <emphasis>--stdin</emphasis>).  It shows the differences\r
1199         from each of the parents to the merge result simultaneously\r
1200         instead of showing pairwise diff between a parent and the\r
1201         result one at a time (which is what the <emphasis>-m</emphasis> option does).\r
1202         Furthermore, it lists only files which were modified\r
1203         from all parents.\r
1204 </simpara>\r
1205 </listitem>\r
1206 </varlistentry>\r
1207 <varlistentry>\r
1208 <term>\r
1209 --cc\r
1210 </term>\r
1211 <listitem>\r
1212 <simpara>\r
1213         This flag changes the way a merge commit patch is displayed,\r
1214         in a similar way to the <emphasis>-c</emphasis> option. It implies the <emphasis>-c</emphasis>\r
1215         and <emphasis>-p</emphasis> options and further compresses the patch output\r
1216         by omitting uninteresting hunks whose the contents in the parents\r
1217         have only two variants and the merge result picks one of them\r
1218         without modification.  When all hunks are uninteresting, the commit\r
1219         itself and the commit log message is not shown, just like in any other\r
1220         "empty diff" case.\r
1221 </simpara>\r
1222 </listitem>\r
1223 </varlistentry>\r
1224 <varlistentry>\r
1225 <term>\r
1226 --always\r
1227 </term>\r
1228 <listitem>\r
1229 <simpara>\r
1230         Show the commit itself and the commit log message even\r
1231         if the diff itself is empty.\r
1232 </simpara>\r
1233 </listitem>\r
1234 </varlistentry>\r
1235 </variablelist>\r
1236 </simplesect>\r
1237 <simplesect id="git-diff-tree(1)__pretty_formats">\r
1238 <title>PRETTY FORMATS</title>\r
1239 <simpara>If the commit is a merge, and if the pretty-format\r
1240 is not <emphasis>oneline</emphasis>, <emphasis>email</emphasis> or <emphasis>raw</emphasis>, an additional line is\r
1241 inserted before the <emphasis>Author:</emphasis> line.  This line begins with\r
1242 "Merge: " and the sha1s of ancestral commits are printed,\r
1243 separated by spaces.  Note that the listed commits may not\r
1244 necessarily be the list of the <emphasis role="strong">direct</emphasis> parent commits if you\r
1245 have limited your view of history: for example, if you are\r
1246 only interested in changes related to a certain directory or\r
1247 file.</simpara>\r
1248 <simpara>There are several built-in formats, and you can define\r
1249 additional formats by setting a pretty.&lt;name&gt;\r
1250 config option to either another format name, or a\r
1251 <emphasis>format:</emphasis> string, as described below (see\r
1252 <xref linkend="git-config(1)" />). Here are the details of the\r
1253 built-in formats:</simpara>\r
1254 <itemizedlist>\r
1255 <listitem>\r
1256 <simpara>\r
1257 <emphasis>oneline</emphasis>\r
1258 </simpara>\r
1259 <literallayout class="monospaced">&lt;sha1&gt; &lt;title line&gt;</literallayout>\r
1260 <simpara>This is designed to be as compact as possible.</simpara>\r
1261 </listitem>\r
1262 <listitem>\r
1263 <simpara>\r
1264 <emphasis>short</emphasis>\r
1265 </simpara>\r
1266 <literallayout class="monospaced">commit &lt;sha1&gt;\r
1267 Author: &lt;author&gt;</literallayout>\r
1268 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
1269 </listitem>\r
1270 <listitem>\r
1271 <simpara>\r
1272 <emphasis>medium</emphasis>\r
1273 </simpara>\r
1274 <literallayout class="monospaced">commit &lt;sha1&gt;\r
1275 Author: &lt;author&gt;\r
1276 Date:   &lt;author date&gt;</literallayout>\r
1277 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
1278 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
1279 </listitem>\r
1280 <listitem>\r
1281 <simpara>\r
1282 <emphasis>full</emphasis>\r
1283 </simpara>\r
1284 <literallayout class="monospaced">commit &lt;sha1&gt;\r
1285 Author: &lt;author&gt;\r
1286 Commit: &lt;committer&gt;</literallayout>\r
1287 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
1288 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
1289 </listitem>\r
1290 <listitem>\r
1291 <simpara>\r
1292 <emphasis>fuller</emphasis>\r
1293 </simpara>\r
1294 <literallayout class="monospaced">commit &lt;sha1&gt;\r
1295 Author:     &lt;author&gt;\r
1296 AuthorDate: &lt;author date&gt;\r
1297 Commit:     &lt;committer&gt;\r
1298 CommitDate: &lt;committer date&gt;</literallayout>\r
1299 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
1300 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
1301 </listitem>\r
1302 <listitem>\r
1303 <simpara>\r
1304 <emphasis>email</emphasis>\r
1305 </simpara>\r
1306 <literallayout class="monospaced">From &lt;sha1&gt; &lt;date&gt;\r
1307 From: &lt;author&gt;\r
1308 Date: &lt;author date&gt;\r
1309 Subject: [PATCH] &lt;title line&gt;</literallayout>\r
1310 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
1311 </listitem>\r
1312 <listitem>\r
1313 <simpara>\r
1314 <emphasis>raw</emphasis>\r
1315 </simpara>\r
1316 <simpara>The <emphasis>raw</emphasis> format shows the entire commit exactly as\r
1317 stored in the commit object.  Notably, the SHA1s are\r
1318 displayed in full, regardless of whether --abbrev or\r
1319 --no-abbrev are used, and <emphasis>parents</emphasis> information show the\r
1320 true parent commits, without taking grafts nor history\r
1321 simplification into account.</simpara>\r
1322 </listitem>\r
1323 <listitem>\r
1324 <simpara>\r
1325 <emphasis>format:&lt;string&gt;</emphasis>\r
1326 </simpara>\r
1327 <simpara>The <emphasis>format:&lt;string&gt;</emphasis> format allows you to specify which information\r
1328 you want to show. It works a little bit like printf format,\r
1329 with the notable exception that you get a newline with <emphasis>%n</emphasis>\r
1330 instead of <emphasis>\n</emphasis>.</simpara>\r
1331 <simpara>E.g, <emphasis>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</emphasis>\r
1332 would show something like this:</simpara>\r
1333 <screen>The author of fe6e0ee was Junio C Hamano, 23 hours ago\r
1334 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</screen>\r
1335 <simpara>The placeholders are:</simpara>\r
1336 <itemizedlist>\r
1337 <listitem>\r
1338 <simpara>\r
1339 <emphasis>%H</emphasis>: commit hash\r
1340 </simpara>\r
1341 </listitem>\r
1342 <listitem>\r
1343 <simpara>\r
1344 <emphasis>%h</emphasis>: abbreviated commit hash\r
1345 </simpara>\r
1346 </listitem>\r
1347 <listitem>\r
1348 <simpara>\r
1349 <emphasis>%T</emphasis>: tree hash\r
1350 </simpara>\r
1351 </listitem>\r
1352 <listitem>\r
1353 <simpara>\r
1354 <emphasis>%t</emphasis>: abbreviated tree hash\r
1355 </simpara>\r
1356 </listitem>\r
1357 <listitem>\r
1358 <simpara>\r
1359 <emphasis>%P</emphasis>: parent hashes\r
1360 </simpara>\r
1361 </listitem>\r
1362 <listitem>\r
1363 <simpara>\r
1364 <emphasis>%p</emphasis>: abbreviated parent hashes\r
1365 </simpara>\r
1366 </listitem>\r
1367 <listitem>\r
1368 <simpara>\r
1369 <emphasis>%an</emphasis>: author name\r
1370 </simpara>\r
1371 </listitem>\r
1372 <listitem>\r
1373 <simpara>\r
1374 <emphasis>%aN</emphasis>: author name (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
1375 </simpara>\r
1376 </listitem>\r
1377 <listitem>\r
1378 <simpara>\r
1379 <emphasis>%ae</emphasis>: author email\r
1380 </simpara>\r
1381 </listitem>\r
1382 <listitem>\r
1383 <simpara>\r
1384 <emphasis>%aE</emphasis>: author email (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
1385 </simpara>\r
1386 </listitem>\r
1387 <listitem>\r
1388 <simpara>\r
1389 <emphasis>%ad</emphasis>: author date (format respects --date= option)\r
1390 </simpara>\r
1391 </listitem>\r
1392 <listitem>\r
1393 <simpara>\r
1394 <emphasis>%aD</emphasis>: author date, RFC2822 style\r
1395 </simpara>\r
1396 </listitem>\r
1397 <listitem>\r
1398 <simpara>\r
1399 <emphasis>%ar</emphasis>: author date, relative\r
1400 </simpara>\r
1401 </listitem>\r
1402 <listitem>\r
1403 <simpara>\r
1404 <emphasis>%at</emphasis>: author date, UNIX timestamp\r
1405 </simpara>\r
1406 </listitem>\r
1407 <listitem>\r
1408 <simpara>\r
1409 <emphasis>%ai</emphasis>: author date, ISO 8601 format\r
1410 </simpara>\r
1411 </listitem>\r
1412 <listitem>\r
1413 <simpara>\r
1414 <emphasis>%cn</emphasis>: committer name\r
1415 </simpara>\r
1416 </listitem>\r
1417 <listitem>\r
1418 <simpara>\r
1419 <emphasis>%cN</emphasis>: committer name (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
1420 </simpara>\r
1421 </listitem>\r
1422 <listitem>\r
1423 <simpara>\r
1424 <emphasis>%ce</emphasis>: committer email\r
1425 </simpara>\r
1426 </listitem>\r
1427 <listitem>\r
1428 <simpara>\r
1429 <emphasis>%cE</emphasis>: committer email (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
1430 </simpara>\r
1431 </listitem>\r
1432 <listitem>\r
1433 <simpara>\r
1434 <emphasis>%cd</emphasis>: committer date\r
1435 </simpara>\r
1436 </listitem>\r
1437 <listitem>\r
1438 <simpara>\r
1439 <emphasis>%cD</emphasis>: committer date, RFC2822 style\r
1440 </simpara>\r
1441 </listitem>\r
1442 <listitem>\r
1443 <simpara>\r
1444 <emphasis>%cr</emphasis>: committer date, relative\r
1445 </simpara>\r
1446 </listitem>\r
1447 <listitem>\r
1448 <simpara>\r
1449 <emphasis>%ct</emphasis>: committer date, UNIX timestamp\r
1450 </simpara>\r
1451 </listitem>\r
1452 <listitem>\r
1453 <simpara>\r
1454 <emphasis>%ci</emphasis>: committer date, ISO 8601 format\r
1455 </simpara>\r
1456 </listitem>\r
1457 <listitem>\r
1458 <simpara>\r
1459 <emphasis>%d</emphasis>: ref names, like the --decorate option of <xref linkend="git-log(1)" />\r
1460 </simpara>\r
1461 </listitem>\r
1462 <listitem>\r
1463 <simpara>\r
1464 <emphasis>%e</emphasis>: encoding\r
1465 </simpara>\r
1466 </listitem>\r
1467 <listitem>\r
1468 <simpara>\r
1469 <emphasis>%s</emphasis>: subject\r
1470 </simpara>\r
1471 </listitem>\r
1472 <listitem>\r
1473 <simpara>\r
1474 <emphasis>%f</emphasis>: sanitized subject line, suitable for a filename\r
1475 </simpara>\r
1476 </listitem>\r
1477 <listitem>\r
1478 <simpara>\r
1479 <emphasis>%b</emphasis>: body\r
1480 </simpara>\r
1481 </listitem>\r
1482 <listitem>\r
1483 <simpara>\r
1484 <emphasis>%B</emphasis>: raw body (unwrapped subject and body)\r
1485 </simpara>\r
1486 </listitem>\r
1487 <listitem>\r
1488 <simpara>\r
1489 <emphasis>%N</emphasis>: commit notes\r
1490 </simpara>\r
1491 </listitem>\r
1492 <listitem>\r
1493 <simpara>\r
1494 <emphasis>%GG</emphasis>: raw verification message from GPG for a signed commit\r
1495 </simpara>\r
1496 </listitem>\r
1497 <listitem>\r
1498 <simpara>\r
1499 <emphasis>%G?</emphasis>: show either "G" for Good or "B" for Bad for a signed commit\r
1500 </simpara>\r
1501 </listitem>\r
1502 <listitem>\r
1503 <simpara>\r
1504 <emphasis>%GS</emphasis>: show the name of the signer for a signed commit\r
1505 </simpara>\r
1506 </listitem>\r
1507 <listitem>\r
1508 <simpara>\r
1509 <emphasis>%gD</emphasis>: reflog selector, e.g., <emphasis>refs/stash@{1}</emphasis>\r
1510 </simpara>\r
1511 </listitem>\r
1512 <listitem>\r
1513 <simpara>\r
1514 <emphasis>%gd</emphasis>: shortened reflog selector, e.g., <emphasis>stash@{1}</emphasis>\r
1515 </simpara>\r
1516 </listitem>\r
1517 <listitem>\r
1518 <simpara>\r
1519 <emphasis>%gn</emphasis>: reflog identity name\r
1520 </simpara>\r
1521 </listitem>\r
1522 <listitem>\r
1523 <simpara>\r
1524 <emphasis>%gN</emphasis>: reflog identity name (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
1525 </simpara>\r
1526 </listitem>\r
1527 <listitem>\r
1528 <simpara>\r
1529 <emphasis>%ge</emphasis>: reflog identity email\r
1530 </simpara>\r
1531 </listitem>\r
1532 <listitem>\r
1533 <simpara>\r
1534 <emphasis>%gE</emphasis>: reflog identity email (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
1535 </simpara>\r
1536 </listitem>\r
1537 <listitem>\r
1538 <simpara>\r
1539 <emphasis>%gs</emphasis>: reflog subject\r
1540 </simpara>\r
1541 </listitem>\r
1542 <listitem>\r
1543 <simpara>\r
1544 <emphasis>%Cred</emphasis>: switch color to red\r
1545 </simpara>\r
1546 </listitem>\r
1547 <listitem>\r
1548 <simpara>\r
1549 <emphasis>%Cgreen</emphasis>: switch color to green\r
1550 </simpara>\r
1551 </listitem>\r
1552 <listitem>\r
1553 <simpara>\r
1554 <emphasis>%Cblue</emphasis>: switch color to blue\r
1555 </simpara>\r
1556 </listitem>\r
1557 <listitem>\r
1558 <simpara>\r
1559 <emphasis>%Creset</emphasis>: reset color\r
1560 </simpara>\r
1561 </listitem>\r
1562 <listitem>\r
1563 <simpara>\r
1564 <emphasis>%C(&#8230;)</emphasis>: color specification, as described in color.branch.* config option\r
1565 </simpara>\r
1566 </listitem>\r
1567 <listitem>\r
1568 <simpara>\r
1569 <emphasis>%m</emphasis>: left, right or boundary mark\r
1570 </simpara>\r
1571 </listitem>\r
1572 <listitem>\r
1573 <simpara>\r
1574 <emphasis>%n</emphasis>: newline\r
1575 </simpara>\r
1576 </listitem>\r
1577 <listitem>\r
1578 <simpara>\r
1579 <emphasis>%%</emphasis>: a raw <emphasis>%</emphasis>\r
1580 </simpara>\r
1581 </listitem>\r
1582 <listitem>\r
1583 <simpara>\r
1584 <emphasis>%x00</emphasis>: print a byte from a hex code\r
1585 </simpara>\r
1586 </listitem>\r
1587 <listitem>\r
1588 <simpara>\r
1589 <emphasis>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</emphasis>: switch line wrapping, like the -w option of\r
1590   <xref linkend="git-shortlog(1)" />.\r
1591 </simpara>\r
1592 </listitem>\r
1593 </itemizedlist>\r
1594 </listitem>\r
1595 </itemizedlist>\r
1596 <note><simpara>Some placeholders may depend on other options given to the\r
1597 revision traversal engine. For example, the <emphasis>%g*</emphasis> reflog options will\r
1598 insert an empty string unless we are traversing reflog entries (e.g., by\r
1599 <emphasis>git log -g</emphasis>). The <emphasis>%d</emphasis> placeholder will use the "short" decoration\r
1600 format if <emphasis>--decorate</emphasis> was not already provided on the command line.</simpara></note>\r
1601 <simpara>If you add a <emphasis>+</emphasis> (plus sign) after <emphasis>%</emphasis> of a placeholder, a line-feed\r
1602 is inserted immediately before the expansion if and only if the\r
1603 placeholder expands to a non-empty string.</simpara>\r
1604 <simpara>If you add a <emphasis>-</emphasis> (minus sign) after <emphasis>%</emphasis> of a placeholder, line-feeds that\r
1605 immediately precede the expansion are deleted if and only if the\r
1606 placeholder expands to an empty string.</simpara>\r
1607 <simpara>If you add a ` ` (space) after <emphasis>%</emphasis> of a placeholder, a space\r
1608 is inserted immediately before the expansion if and only if the\r
1609 placeholder expands to a non-empty string.</simpara>\r
1610 <itemizedlist>\r
1611 <listitem>\r
1612 <simpara>\r
1613 <emphasis>tformat:</emphasis>\r
1614 </simpara>\r
1615 <simpara>The <emphasis>tformat:</emphasis> format works exactly like <emphasis>format:</emphasis>, except that it\r
1616 provides "terminator" semantics instead of "separator" semantics. In\r
1617 other words, each commit has the message terminator character (usually a\r
1618 newline) appended, rather than a separator placed between entries.\r
1619 This means that the final entry of a single-line format will be properly\r
1620 terminated with a new line, just as the "oneline" format does.\r
1621 For example:</simpara>\r
1622 <screen>$ git log -2 --pretty=format:%h 4da45bef \\r
1623   | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
1624 4da45be\r
1625 7134973 -- NO NEWLINE\r
1627 $ git log -2 --pretty=tformat:%h 4da45bef \\r
1628   | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
1629 4da45be\r
1630 7134973</screen>\r
1631 <simpara>In addition, any unrecognized string that has a <emphasis>%</emphasis> in it is interpreted\r
1632 as if it has <emphasis>tformat:</emphasis> in front of it.  For example, these two are\r
1633 equivalent:</simpara>\r
1634 <screen>$ git log -2 --pretty=tformat:%h 4da45bef\r
1635 $ git log -2 --pretty=%h 4da45bef</screen>\r
1636 </listitem>\r
1637 </itemizedlist>\r
1638 </simplesect>\r
1639 <simplesect id="git-diff-tree(1)__limiting_output">\r
1640 <title>Limiting Output</title>\r
1641 <simpara>If you're only interested in differences in a subset of files, for\r
1642 example some architecture-specific files, you might do:</simpara>\r
1643 <literallayout class="monospaced">git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; arch/ia64 include/asm-ia64</literallayout>\r
1644 <simpara>and it will only show you what changed in those two directories.</simpara>\r
1645 <simpara>Or if you are searching for what changed in just <emphasis>kernel/sched.c</emphasis>, just do</simpara>\r
1646 <literallayout class="monospaced">git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; kernel/sched.c</literallayout>\r
1647 <simpara>and it will ignore all differences to other files.</simpara>\r
1648 <simpara>The pattern is always the prefix, and is matched exactly.  There are no\r
1649 wildcards.  Even stricter, it has to match a complete path component.\r
1650 I.e. "foo" does not pick up <emphasis>foobar.h</emphasis>.  "foo" does match <emphasis>foo/bar.h</emphasis>\r
1651 so it can be used to name subdirectories.</simpara>\r
1652 <simpara>An example of normal usage is:</simpara>\r
1653 <literallayout class="monospaced">torvalds@ppc970:~/git&gt; git diff-tree --abbrev 5319e4\r
1654 :100664 100664 ac348b... a01513...    git-fsck-objects.c</literallayout>\r
1655 <simpara>which tells you that the last commit changed just one file (it's from\r
1656 this one:</simpara>\r
1657 <screen>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8\r
1658 tree 5319e4d609cdd282069cc4dce33c1db559539b03\r
1659 parent b4e628ea30d5ab3606119d2ea5caeab141d38df7\r
1660 author Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005\r
1661 committer Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005\r
1663 Make "git-fsck-objects" print out all the root commits it finds.\r
1665 Once I do the reference tracking, I'll also make it print out all the\r
1666 HEAD commits it finds, which is even more interesting.</screen>\r
1667 <simpara>in case you care).</simpara>\r
1668 </simplesect>\r
1669 <simplesect id="git-diff-tree(1)__raw_output_format">\r
1670 <title>Raw output format</title>\r
1671 <simpara>The raw output format from "git-diff-index", "git-diff-tree",\r
1672 "git-diff-files" and "git diff --raw" are very similar.</simpara>\r
1673 <simpara>These commands all compare two sets of things; what is\r
1674 compared differs:</simpara>\r
1675 <variablelist>\r
1676 <varlistentry>\r
1677 <term>\r
1678 git-diff-index &lt;tree-ish&gt;\r
1679 </term>\r
1680 <listitem>\r
1681 <simpara>\r
1682         compares the &lt;tree-ish&gt; and the files on the filesystem.\r
1683 </simpara>\r
1684 </listitem>\r
1685 </varlistentry>\r
1686 <varlistentry>\r
1687 <term>\r
1688 git-diff-index --cached &lt;tree-ish&gt;\r
1689 </term>\r
1690 <listitem>\r
1691 <simpara>\r
1692         compares the &lt;tree-ish&gt; and the index.\r
1693 </simpara>\r
1694 </listitem>\r
1695 </varlistentry>\r
1696 <varlistentry>\r
1697 <term>\r
1698 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]\r
1699 </term>\r
1700 <listitem>\r
1701 <simpara>\r
1702         compares the trees named by the two arguments.\r
1703 </simpara>\r
1704 </listitem>\r
1705 </varlistentry>\r
1706 <varlistentry>\r
1707 <term>\r
1708 git-diff-files [&lt;pattern&gt;&#8230;]\r
1709 </term>\r
1710 <listitem>\r
1711 <simpara>\r
1712         compares the index and the files on the filesystem.\r
1713 </simpara>\r
1714 </listitem>\r
1715 </varlistentry>\r
1716 </variablelist>\r
1717 <simpara>The "git-diff-tree" command begins its output by printing the hash of\r
1718 what is being compared. After that, all the commands print one output\r
1719 line per changed file.</simpara>\r
1720 <simpara>An output line is formatted this way:</simpara>\r
1721 <screen>in-place edit  :100644 100644 bcd1234... 0123456... M file0\r
1722 copy-edit      :100644 100644 abcd123... 1234567... C68 file1 file2\r
1723 rename-edit    :100644 100644 abcd123... 1234567... R86 file1 file3\r
1724 create         :000000 100644 0000000... 1234567... A file4\r
1725 delete         :100644 000000 1234567... 0000000... D file5\r
1726 unmerged       :000000 000000 0000000... 0000000... U file6</screen>\r
1727 <simpara>That is, from the left to the right:</simpara>\r
1728 <orderedlist numeration="arabic">\r
1729 <listitem>\r
1730 <simpara>\r
1731 a colon.\r
1732 </simpara>\r
1733 </listitem>\r
1734 <listitem>\r
1735 <simpara>\r
1736 mode for "src"; 000000 if creation or unmerged.\r
1737 </simpara>\r
1738 </listitem>\r
1739 <listitem>\r
1740 <simpara>\r
1741 a space.\r
1742 </simpara>\r
1743 </listitem>\r
1744 <listitem>\r
1745 <simpara>\r
1746 mode for "dst"; 000000 if deletion or unmerged.\r
1747 </simpara>\r
1748 </listitem>\r
1749 <listitem>\r
1750 <simpara>\r
1751 a space.\r
1752 </simpara>\r
1753 </listitem>\r
1754 <listitem>\r
1755 <simpara>\r
1756 sha1 for "src"; 0{40} if creation or unmerged.\r
1757 </simpara>\r
1758 </listitem>\r
1759 <listitem>\r
1760 <simpara>\r
1761 a space.\r
1762 </simpara>\r
1763 </listitem>\r
1764 <listitem>\r
1765 <simpara>\r
1766 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".\r
1767 </simpara>\r
1768 </listitem>\r
1769 <listitem>\r
1770 <simpara>\r
1771 a space.\r
1772 </simpara>\r
1773 </listitem>\r
1774 <listitem>\r
1775 <simpara>\r
1776 status, followed by optional "score" number.\r
1777 </simpara>\r
1778 </listitem>\r
1779 <listitem>\r
1780 <simpara>\r
1781 a tab or a NUL when <emphasis>-z</emphasis> option is used.\r
1782 </simpara>\r
1783 </listitem>\r
1784 <listitem>\r
1785 <simpara>\r
1786 path for "src"\r
1787 </simpara>\r
1788 </listitem>\r
1789 <listitem>\r
1790 <simpara>\r
1791 a tab or a NUL when <emphasis>-z</emphasis> option is used; only exists for C or R.\r
1792 </simpara>\r
1793 </listitem>\r
1794 <listitem>\r
1795 <simpara>\r
1796 path for "dst"; only exists for C or R.\r
1797 </simpara>\r
1798 </listitem>\r
1799 <listitem>\r
1800 <simpara>\r
1801 an LF or a NUL when <emphasis>-z</emphasis> option is used, to terminate the record.\r
1802 </simpara>\r
1803 </listitem>\r
1804 </orderedlist>\r
1805 <simpara>Possible status letters are:</simpara>\r
1806 <itemizedlist>\r
1807 <listitem>\r
1808 <simpara>\r
1809 A: addition of a file\r
1810 </simpara>\r
1811 </listitem>\r
1812 <listitem>\r
1813 <simpara>\r
1814 C: copy of a file into a new one\r
1815 </simpara>\r
1816 </listitem>\r
1817 <listitem>\r
1818 <simpara>\r
1819 D: deletion of a file\r
1820 </simpara>\r
1821 </listitem>\r
1822 <listitem>\r
1823 <simpara>\r
1824 M: modification of the contents or mode of a file\r
1825 </simpara>\r
1826 </listitem>\r
1827 <listitem>\r
1828 <simpara>\r
1829 R: renaming of a file\r
1830 </simpara>\r
1831 </listitem>\r
1832 <listitem>\r
1833 <simpara>\r
1834 T: change in the type of the file\r
1835 </simpara>\r
1836 </listitem>\r
1837 <listitem>\r
1838 <simpara>\r
1839 U: file is unmerged (you must complete the merge before it can\r
1840 be committed)\r
1841 </simpara>\r
1842 </listitem>\r
1843 <listitem>\r
1844 <simpara>\r
1845 X: "unknown" change type (most probably a bug, please report it)\r
1846 </simpara>\r
1847 </listitem>\r
1848 </itemizedlist>\r
1849 <simpara>Status letters C and R are always followed by a score (denoting the\r
1850 percentage of similarity between the source and target of the move or\r
1851 copy), and are the only ones to be so.</simpara>\r
1852 <simpara>&lt;sha1&gt; is shown as all 0's if a file is new on the filesystem\r
1853 and it is out of sync with the index.</simpara>\r
1854 <simpara>Example:</simpara>\r
1855 <screen>:100644 100644 5be4a4...... 000000...... M file.c</screen>\r
1856 <simpara>When <emphasis>-z</emphasis> option is not used, TAB, LF, and backslash characters\r
1857 in pathnames are represented as <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, and <emphasis>\\</emphasis>,\r
1858 respectively.</simpara>\r
1859 </simplesect>\r
1860 <simplesect id="git-diff-tree(1)__diff_format_for_merges">\r
1861 <title>diff format for merges</title>\r
1862 <simpara>"git-diff-tree", "git-diff-files" and "git-diff --raw"\r
1863 can take <emphasis>-c</emphasis> or <emphasis>--cc</emphasis> option\r
1864 to generate diff output also for merge commits.  The output differs\r
1865 from the format described above in the following way:</simpara>\r
1866 <orderedlist numeration="arabic">\r
1867 <listitem>\r
1868 <simpara>\r
1869 there is a colon for each parent\r
1870 </simpara>\r
1871 </listitem>\r
1872 <listitem>\r
1873 <simpara>\r
1874 there are more "src" modes and "src" sha1\r
1875 </simpara>\r
1876 </listitem>\r
1877 <listitem>\r
1878 <simpara>\r
1879 status is concatenated status characters for each parent\r
1880 </simpara>\r
1881 </listitem>\r
1882 <listitem>\r
1883 <simpara>\r
1884 no optional "score" number\r
1885 </simpara>\r
1886 </listitem>\r
1887 <listitem>\r
1888 <simpara>\r
1889 single path, only for "dst"\r
1890 </simpara>\r
1891 </listitem>\r
1892 </orderedlist>\r
1893 <simpara>Example:</simpara>\r
1894 <screen>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c</screen>\r
1895 <simpara>Note that <emphasis>combined diff</emphasis> lists only files which were modified from\r
1896 all parents.</simpara>\r
1897 </simplesect>\r
1898 <simplesect id="git-diff-tree(1)__generating_patches_with_p">\r
1899 <title>Generating patches with -p</title>\r
1900 <simpara>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run\r
1901 with a <emphasis>-p</emphasis> option, "git diff" without the <emphasis>--raw</emphasis> option, or\r
1902 "git log" with the "-p" option, they\r
1903 do not produce the output described above; instead they produce a\r
1904 patch file.  You can customize the creation of such patches via the\r
1905 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</simpara>\r
1906 <simpara>What the -p option produces is slightly different from the traditional\r
1907 diff format:</simpara>\r
1908 <orderedlist numeration="arabic">\r
1909 <listitem>\r
1910 <simpara>\r
1911 It is preceded with a "git diff" header that looks like this:\r
1912 </simpara>\r
1913 <literallayout class="monospaced">diff --git a/file1 b/file2</literallayout>\r
1914 <simpara>The <emphasis>a/</emphasis> and <emphasis>b/</emphasis> filenames are the same unless rename/copy is\r
1915 involved.  Especially, even for a creation or a deletion,\r
1916 <emphasis>/dev/null</emphasis> is <emphasis>not</emphasis> used in place of the <emphasis>a/</emphasis> or <emphasis>b/</emphasis> filenames.</simpara>\r
1917 <simpara>When rename/copy is involved, <emphasis>file1</emphasis> and <emphasis>file2</emphasis> show the\r
1918 name of the source file of the rename/copy and the name of\r
1919 the file that rename/copy produces, respectively.</simpara>\r
1920 </listitem>\r
1921 <listitem>\r
1922 <simpara>\r
1923 It is followed by one or more extended header lines:\r
1924 </simpara>\r
1925 <literallayout class="monospaced">old mode &lt;mode&gt;\r
1926 new mode &lt;mode&gt;\r
1927 deleted file mode &lt;mode&gt;\r
1928 new file mode &lt;mode&gt;\r
1929 copy from &lt;path&gt;\r
1930 copy to &lt;path&gt;\r
1931 rename from &lt;path&gt;\r
1932 rename to &lt;path&gt;\r
1933 similarity index &lt;number&gt;\r
1934 dissimilarity index &lt;number&gt;\r
1935 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</literallayout>\r
1936 <simpara>File modes are printed as 6-digit octal numbers including the file type\r
1937 and file permission bits.</simpara>\r
1938 <simpara>Path names in extended headers do not include the <emphasis>a/</emphasis> and <emphasis>b/</emphasis> prefixes.</simpara>\r
1939 <simpara>The similarity index is the percentage of unchanged lines, and\r
1940 the dissimilarity index is the percentage of changed lines.  It\r
1941 is a rounded down integer, followed by a percent sign.  The\r
1942 similarity index value of 100% is thus reserved for two equal\r
1943 files, while 100% dissimilarity means that no line from the old\r
1944 file made it into the new one.</simpara>\r
1945 <simpara>The index line includes the SHA-1 checksum before and after the change.\r
1946 The &lt;mode&gt; is included if the file mode does not change; otherwise,\r
1947 separate lines indicate the old and the new mode.</simpara>\r
1948 </listitem>\r
1949 <listitem>\r
1950 <simpara>\r
1951 TAB, LF, double quote and backslash characters in pathnames\r
1952     are represented as <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, <emphasis>\"</emphasis> and <emphasis>\\</emphasis>, respectively.\r
1953     If there is need for such substitution then the whole\r
1954     pathname is put in double quotes.\r
1955 </simpara>\r
1956 </listitem>\r
1957 <listitem>\r
1958 <simpara>\r
1959 All the <emphasis>file1</emphasis> files in the output refer to files before the\r
1960     commit, and all the <emphasis>file2</emphasis> files refer to files after the commit.\r
1961     It is incorrect to apply each change to each file sequentially.  For\r
1962     example, this patch will swap a and b:\r
1963 </simpara>\r
1964 <literallayout class="monospaced">diff --git a/a b/b\r
1965 rename from a\r
1966 rename to b\r
1967 diff --git a/b b/a\r
1968 rename from b\r
1969 rename to a</literallayout>\r
1970 </listitem>\r
1971 </orderedlist>\r
1972 </simplesect>\r
1973 <simplesect id="git-diff-tree(1)__combined_diff_format">\r
1974 <title>combined diff format</title>\r
1975 <simpara>Any diff-generating command can take the -c` or <emphasis>--cc</emphasis> option to\r
1976 produce a <emphasis>combined diff</emphasis> when showing a merge. This is the default\r
1977 format when showing merges with <xref linkend="git-diff(1)" /> or\r
1978 <xref linkend="git-show(1)" />. Note also that you can give the `-m option to any\r
1979 of these commands to force generation of diffs with individual parents\r
1980 of a merge.</simpara>\r
1981 <simpara>A <emphasis>combined diff</emphasis> format looks like this:</simpara>\r
1982 <screen>diff --combined describe.c\r
1983 index fabadb8,cc95eb0..4866510\r
1984 --- a/describe.c\r
1985 +++ b/describe.c\r
1986 @@@ -98,20 -98,12 +98,20 @@@\r
1987         return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;\r
1988   }\r
1990 - static void describe(char *arg)\r
1991  -static void describe(struct commit *cmit, int last_one)\r
1992 ++static void describe(char *arg, int last_one)\r
1993   {\r
1994  +      unsigned char sha1[20];\r
1995  +      struct commit *cmit;\r
1996         struct commit_list *list;\r
1997         static int initialized = 0;\r
1998         struct commit_name *n;\r
2000  +      if (get_sha1(arg, sha1) &lt; 0)\r
2001  +              usage(describe_usage);\r
2002  +      cmit = lookup_commit_reference(sha1);\r
2003  +      if (!cmit)\r
2004  +              usage(describe_usage);\r
2005  +\r
2006         if (!initialized) {\r
2007                 initialized = 1;\r
2008                 for_each_ref(get_name);</screen>\r
2009 <orderedlist numeration="arabic">\r
2010 <listitem>\r
2011 <simpara>\r
2012 It is preceded with a "git diff" header, that looks like\r
2013      this (when <emphasis>-c</emphasis> option is used):\r
2014 </simpara>\r
2015 <literallayout class="monospaced">diff --combined file</literallayout>\r
2016 <simpara>or like this (when <emphasis>--cc</emphasis> option is used):</simpara>\r
2017 <literallayout class="monospaced">diff --cc file</literallayout>\r
2018 </listitem>\r
2019 <listitem>\r
2020 <simpara>\r
2021 It is followed by one or more extended header lines\r
2022      (this example shows a merge with two parents):\r
2023 </simpara>\r
2024 <literallayout class="monospaced">index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;\r
2025 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;\r
2026 new file mode &lt;mode&gt;\r
2027 deleted file mode &lt;mode&gt;,&lt;mode&gt;</literallayout>\r
2028 <simpara>The <emphasis>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</emphasis> line appears only if at least one of\r
2029 the &lt;mode&gt; is different from the rest. Extended headers with\r
2030 information about detected contents movement (renames and\r
2031 copying detection) are designed to work with diff of two\r
2032 &lt;tree-ish&gt; and are not used by combined diff format.</simpara>\r
2033 </listitem>\r
2034 <listitem>\r
2035 <simpara>\r
2036 It is followed by two-line from-file/to-file header\r
2037 </simpara>\r
2038 <literallayout class="monospaced">--- a/file\r
2039 +++ b/file</literallayout>\r
2040 <simpara>Similar to two-line header for traditional <emphasis>unified</emphasis> diff\r
2041 format, <emphasis>/dev/null</emphasis> is used to signal created or deleted\r
2042 files.</simpara>\r
2043 </listitem>\r
2044 <listitem>\r
2045 <simpara>\r
2046 Chunk header format is modified to prevent people from\r
2047      accidentally feeding it to <emphasis>patch -p1</emphasis>. Combined diff format\r
2048      was created for review of merge commit changes, and was not\r
2049      meant for apply. The change is similar to the change in the\r
2050      extended <emphasis>index</emphasis> header:\r
2051 </simpara>\r
2052 <literallayout class="monospaced">@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</literallayout>\r
2053 <simpara>There are (number of parents + 1) <emphasis>@</emphasis> characters in the chunk\r
2054 header for combined diff format.</simpara>\r
2055 </listitem>\r
2056 </orderedlist>\r
2057 <simpara>Unlike the traditional <emphasis>unified</emphasis> diff format, which shows two\r
2058 files A and B with a single column that has <emphasis>-</emphasis> (minus --\r
2059 appears in A but removed in B), <emphasis>+</emphasis> (plus -- missing in A but\r
2060 added to B), or <emphasis>" "</emphasis> (space -- unchanged) prefix, this format\r
2061 compares two or more files file1, file2,&#8230; with one file X, and\r
2062 shows how X differs from each of fileN.  One column for each of\r
2063 fileN is prepended to the output line to note how X's line is\r
2064 different from it.</simpara>\r
2065 <simpara>A <emphasis>-</emphasis> character in the column N means that the line appears in\r
2066 fileN but it does not appear in the result.  A <emphasis>+</emphasis> character\r
2067 in the column N means that the line appears in the result,\r
2068 and fileN does not have that line (in other words, the line was\r
2069 added, from the point of view of that parent).</simpara>\r
2070 <simpara>In the above example output, the function signature was changed\r
2071 from both files (hence two <emphasis>-</emphasis> removals from both file1 and\r
2072 file2, plus <emphasis>++</emphasis> to mean one line that was added does not appear\r
2073 in either file1 nor file2).  Also eight other lines are the same\r
2074 from file1 but do not appear in file2 (hence prefixed with <emphasis>+</emphasis>).</simpara>\r
2075 <simpara>When shown by <emphasis>git diff-tree -c</emphasis>, it compares the parents of a\r
2076 merge commit with the merge result (i.e. file1..fileN are the\r
2077 parents).  When shown by <emphasis>git diff-files -c</emphasis>, it compares the\r
2078 two unresolved merge parents with the working tree file\r
2079 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka\r
2080 "their version").</simpara>\r
2081 </simplesect>\r
2082 <simplesect id="git-diff-tree(1)__other_diff_formats">\r
2083 <title>other diff formats</title>\r
2084 <simpara>The <emphasis>--summary</emphasis> option describes newly added, deleted, renamed and\r
2085 copied files.  The <emphasis>--stat</emphasis> option adds diffstat(1) graph to the\r
2086 output.  These options can be combined with other options, such as\r
2087 <emphasis>-p</emphasis>, and are meant for human consumption.</simpara>\r
2088 <simpara>When showing a change that involves a rename or a copy, <emphasis>--stat</emphasis> output\r
2089 formats the pathnames compactly by combining common prefix and suffix of\r
2090 the pathnames.  For example, a change that moves <emphasis>arch/i386/Makefile</emphasis> to\r
2091 <emphasis>arch/x86/Makefile</emphasis> while modifying 4 lines will be shown like this:</simpara>\r
2092 <screen>arch/{i386 =&gt; x86}/Makefile    |   4 +--</screen>\r
2093 <simpara>The <emphasis>--numstat</emphasis> option gives the diffstat(1) information but is designed\r
2094 for easier machine consumption.  An entry in <emphasis>--numstat</emphasis> output looks\r
2095 like this:</simpara>\r
2096 <screen>1       2       README\r
2097 3       1       arch/{i386 =&gt; x86}/Makefile</screen>\r
2098 <simpara>That is, from left to right:</simpara>\r
2099 <orderedlist numeration="arabic">\r
2100 <listitem>\r
2101 <simpara>\r
2102 the number of added lines;\r
2103 </simpara>\r
2104 </listitem>\r
2105 <listitem>\r
2106 <simpara>\r
2107 a tab;\r
2108 </simpara>\r
2109 </listitem>\r
2110 <listitem>\r
2111 <simpara>\r
2112 the number of deleted lines;\r
2113 </simpara>\r
2114 </listitem>\r
2115 <listitem>\r
2116 <simpara>\r
2117 a tab;\r
2118 </simpara>\r
2119 </listitem>\r
2120 <listitem>\r
2121 <simpara>\r
2122 pathname (possibly with rename/copy information);\r
2123 </simpara>\r
2124 </listitem>\r
2125 <listitem>\r
2126 <simpara>\r
2127 a newline.\r
2128 </simpara>\r
2129 </listitem>\r
2130 </orderedlist>\r
2131 <simpara>When <emphasis>-z</emphasis> output option is in effect, the output is formatted this way:</simpara>\r
2132 <screen>1       2       README NUL\r
2133 3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</screen>\r
2134 <simpara>That is:</simpara>\r
2135 <orderedlist numeration="arabic">\r
2136 <listitem>\r
2137 <simpara>\r
2138 the number of added lines;\r
2139 </simpara>\r
2140 </listitem>\r
2141 <listitem>\r
2142 <simpara>\r
2143 a tab;\r
2144 </simpara>\r
2145 </listitem>\r
2146 <listitem>\r
2147 <simpara>\r
2148 the number of deleted lines;\r
2149 </simpara>\r
2150 </listitem>\r
2151 <listitem>\r
2152 <simpara>\r
2153 a tab;\r
2154 </simpara>\r
2155 </listitem>\r
2156 <listitem>\r
2157 <simpara>\r
2158 a NUL (only exists if renamed/copied);\r
2159 </simpara>\r
2160 </listitem>\r
2161 <listitem>\r
2162 <simpara>\r
2163 pathname in preimage;\r
2164 </simpara>\r
2165 </listitem>\r
2166 <listitem>\r
2167 <simpara>\r
2168 a NUL (only exists if renamed/copied);\r
2169 </simpara>\r
2170 </listitem>\r
2171 <listitem>\r
2172 <simpara>\r
2173 pathname in postimage (only exists if renamed/copied);\r
2174 </simpara>\r
2175 </listitem>\r
2176 <listitem>\r
2177 <simpara>\r
2178 a NUL.\r
2179 </simpara>\r
2180 </listitem>\r
2181 </orderedlist>\r
2182 <simpara>The extra <emphasis>NUL</emphasis> before the preimage path in renamed case is to allow\r
2183 scripts that read the output to tell if the current record being read is\r
2184 a single-path record or a rename/copy record without reading ahead.\r
2185 After reading added and deleted lines, reading up to <emphasis>NUL</emphasis> would yield\r
2186 the pathname, but if that is <emphasis>NUL</emphasis>, the record will show two paths.</simpara>\r
2187 </simplesect>\r
2188 <simplesect id="git-diff-tree(1)__git">\r
2189 <title>GIT</title>\r
2190 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
2191 </simplesect>\r
2192 </sect2>\r