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