Autogenerated HTML docs for v1.7.6-rc1
[git/jnareb-git.git] / git-diff-tree.html
blobd4bab8dc4ca9943ce7bb88a44ac864e67ed17bb5
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-diff-tree(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-diff-tree(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-diff-tree -
411 Compares the content and mode of blobs found via two tree objects
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git diff-tree</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
419 [-t] [-r] [-c | --cc] [--root] [&lt;common diff options&gt;]
420 &lt;tree-ish&gt; [&lt;tree-ish&gt;] [&lt;path&gt;&#8230;]</div>
421 <div class="verseblock-attribution">
422 </div></div>
423 </div>
424 <h2 id="_description">DESCRIPTION</h2>
425 <div class="sectionbody">
426 <div class="paragraph"><p>Compares the content and mode of the blobs found via two tree objects.</p></div>
427 <div class="paragraph"><p>If there is only one &lt;tree-ish&gt; given, the commit is compared with its parents
428 (see --stdin below).</p></div>
429 <div class="paragraph"><p>Note that <em>git diff-tree</em> can use the tree encapsulated in a commit object.</p></div>
430 </div>
431 <h2 id="_options">OPTIONS</h2>
432 <div class="sectionbody">
433 <div class="dlist"><dl>
434 <dt class="hdlist1">
436 </dt>
437 <dt class="hdlist1">
439 </dt>
440 <dt class="hdlist1">
441 --patch
442 </dt>
443 <dd>
445 Generate patch (see section on generating patches).
447 </p>
448 </dd>
449 <dt class="hdlist1">
450 -U&lt;n&gt;
451 </dt>
452 <dt class="hdlist1">
453 --unified=&lt;n&gt;
454 </dt>
455 <dd>
457 Generate diffs with &lt;n&gt; lines of context instead of
458 the usual three.
459 Implies <tt>-p</tt>.
460 </p>
461 </dd>
462 <dt class="hdlist1">
463 --raw
464 </dt>
465 <dd>
467 Generate the raw format.
468 This is the default.
469 </p>
470 </dd>
471 <dt class="hdlist1">
472 --patch-with-raw
473 </dt>
474 <dd>
476 Synonym for <tt>-p --raw</tt>.
477 </p>
478 </dd>
479 <dt class="hdlist1">
480 --patience
481 </dt>
482 <dd>
484 Generate a diff using the "patience diff" algorithm.
485 </p>
486 </dd>
487 <dt class="hdlist1">
488 --stat[=&lt;width&gt;[,&lt;name-width&gt;]]
489 </dt>
490 <dd>
492 Generate a diffstat. You can override the default
493 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
494 The width of the filename part can be controlled by
495 giving another width to it separated by a comma.
496 </p>
497 </dd>
498 <dt class="hdlist1">
499 --numstat
500 </dt>
501 <dd>
503 Similar to <tt>--stat</tt>, but shows number of added and
504 deleted lines in decimal notation and pathname without
505 abbreviation, to make it more machine friendly. For
506 binary files, outputs two <tt>-</tt> instead of saying
507 <tt>0 0</tt>.
508 </p>
509 </dd>
510 <dt class="hdlist1">
511 --shortstat
512 </dt>
513 <dd>
515 Output only the last line of the <tt>--stat</tt> format containing total
516 number of modified files, as well as number of added and deleted
517 lines.
518 </p>
519 </dd>
520 <dt class="hdlist1">
521 --dirstat[=&lt;param1,param2,&#8230;&gt;]
522 </dt>
523 <dd>
525 Output the distribution of relative amount of changes for each
526 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
527 passing it a comma separated list of parameters.
528 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
529 variable (see <a href="git-config.html">git-config(1)</a>).
530 The following parameters are available:
531 </p>
532 <div class="dlist"><dl>
533 <dt class="hdlist1">
534 <tt>changes</tt>
535 </dt>
536 <dd>
538 Compute the dirstat numbers by counting the lines that have been
539 removed from the source, or added to the destination. This ignores
540 the amount of pure code movements within a file. In other words,
541 rearranging lines in a file is not counted as much as other changes.
542 This is the default behavior when no parameter is given.
543 </p>
544 </dd>
545 <dt class="hdlist1">
546 <tt>lines</tt>
547 </dt>
548 <dd>
550 Compute the dirstat numbers by doing the regular line-based diff
551 analysis, and summing the removed/added line counts. (For binary
552 files, count 64-byte chunks instead, since binary files have no
553 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
554 behavior than the <tt>changes</tt> behavior, but it does count rearranged
555 lines within a file as much as other changes. The resulting output
556 is consistent with what you get from the other <tt>--*stat</tt> options.
557 </p>
558 </dd>
559 <dt class="hdlist1">
560 <tt>files</tt>
561 </dt>
562 <dd>
564 Compute the dirstat numbers by counting the number of files changed.
565 Each changed file counts equally in the dirstat analysis. This is
566 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
567 not have to look at the file contents at all.
568 </p>
569 </dd>
570 <dt class="hdlist1">
571 <tt>cumulative</tt>
572 </dt>
573 <dd>
575 Count changes in a child directory for the parent directory as well.
576 Note that when using <tt>cumulative</tt>, the sum of the percentages
577 reported may exceed 100%. The default (non-cumulative) behavior can
578 be specified with the <tt>noncumulative</tt> parameter.
579 </p>
580 </dd>
581 <dt class="hdlist1">
582 &lt;limit&gt;
583 </dt>
584 <dd>
586 An integer parameter specifies a cut-off percent (3% by default).
587 Directories contributing less than this percentage of the changes
588 are not shown in the output.
589 </p>
590 </dd>
591 </dl></div>
592 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
593 directories with less than 10% of the total amount of changed files,
594 and accumulating child directory counts in the parent directories:
595 <tt>--dirstat=files,10,cumulative</tt>.</p></div>
596 </dd>
597 <dt class="hdlist1">
598 --summary
599 </dt>
600 <dd>
602 Output a condensed summary of extended header information
603 such as creations, renames and mode changes.
604 </p>
605 </dd>
606 <dt class="hdlist1">
607 --patch-with-stat
608 </dt>
609 <dd>
611 Synonym for <tt>-p --stat</tt>.
612 </p>
613 </dd>
614 <dt class="hdlist1">
616 </dt>
617 <dd>
619 When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been
620 given, do not munge pathnames and use NULs as output field terminators.
621 </p>
622 <div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
623 and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
624 respectively, and the pathname will be enclosed in double quotes if
625 any of those replacements occurred.</p></div>
626 </dd>
627 <dt class="hdlist1">
628 --name-only
629 </dt>
630 <dd>
632 Show only names of changed files.
633 </p>
634 </dd>
635 <dt class="hdlist1">
636 --name-status
637 </dt>
638 <dd>
640 Show only names and status of changed files. See the description
641 of the <tt>--diff-filter</tt> option on what the status letters mean.
642 </p>
643 </dd>
644 <dt class="hdlist1">
645 --submodule[=&lt;format&gt;]
646 </dt>
647 <dd>
649 Chose the output format for submodule differences. &lt;format&gt; can be one of
650 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
651 is used when this option is not given. <em>log</em> is the default value for this
652 option and lists the commits in that commit range like the <em>summary</em>
653 option of <a href="git-submodule.html">git-submodule(1)</a> does.
654 </p>
655 </dd>
656 <dt class="hdlist1">
657 --color[=&lt;when&gt;]
658 </dt>
659 <dd>
661 Show colored diff.
662 The value must be <tt>always</tt> (the default for <tt>&lt;when&gt;</tt>), <tt>never</tt>, or <tt>auto</tt>.
663 The default value is <tt>never</tt>.
664 </p>
665 </dd>
666 <dt class="hdlist1">
667 --no-color
668 </dt>
669 <dd>
671 Turn off colored diff.
672 It is the same as <tt>--color=never</tt>.
673 </p>
674 </dd>
675 <dt class="hdlist1">
676 --word-diff[=&lt;mode&gt;]
677 </dt>
678 <dd>
680 Show a word diff, using the &lt;mode&gt; to delimit changed words.
681 By default, words are delimited by whitespace; see
682 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
683 must be one of:
684 </p>
685 <div class="dlist"><dl>
686 <dt class="hdlist1">
687 color
688 </dt>
689 <dd>
691 Highlight changed words using only colors. Implies <tt>--color</tt>.
692 </p>
693 </dd>
694 <dt class="hdlist1">
695 plain
696 </dt>
697 <dd>
699 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
700 attempts to escape the delimiters if they appear in the input,
701 so the output may be ambiguous.
702 </p>
703 </dd>
704 <dt class="hdlist1">
705 porcelain
706 </dt>
707 <dd>
709 Use a special line-based format intended for script
710 consumption. Added/removed/unchanged runs are printed in the
711 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
712 character at the beginning of the line and extending to the
713 end of the line. Newlines in the input are represented by a
714 tilde <tt>~</tt> on a line of its own.
715 </p>
716 </dd>
717 <dt class="hdlist1">
718 none
719 </dt>
720 <dd>
722 Disable word diff again.
723 </p>
724 </dd>
725 </dl></div>
726 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
727 highlight the changed parts in all modes if enabled.</p></div>
728 </dd>
729 <dt class="hdlist1">
730 --word-diff-regex=&lt;regex&gt;
731 </dt>
732 <dd>
734 Use &lt;regex&gt; to decide what a word is, instead of considering
735 runs of non-whitespace to be a word. Also implies
736 <tt>--word-diff</tt> unless it was already enabled.
737 </p>
738 <div class="paragraph"><p>Every non-overlapping match of the
739 &lt;regex&gt; is considered a word. Anything between these matches is
740 considered whitespace and ignored(!) for the purposes of finding
741 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
742 expression to make sure that it matches all non-whitespace characters.
743 A match that contains a newline is silently truncated(!) at the
744 newline.</p></div>
745 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
746 <a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
747 overrides any diff driver or configuration setting. Diff drivers
748 override configuration settings.</p></div>
749 </dd>
750 <dt class="hdlist1">
751 --color-words[=&lt;regex&gt;]
752 </dt>
753 <dd>
755 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
756 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
757 </p>
758 </dd>
759 <dt class="hdlist1">
760 --no-renames
761 </dt>
762 <dd>
764 Turn off rename detection, even when the configuration
765 file gives the default to do so.
766 </p>
767 </dd>
768 <dt class="hdlist1">
769 --check
770 </dt>
771 <dd>
773 Warn if changes introduce trailing whitespace
774 or an indent that uses a space before a tab. Exits with
775 non-zero status if problems are found. Not compatible with
776 --exit-code.
777 </p>
778 </dd>
779 <dt class="hdlist1">
780 --full-index
781 </dt>
782 <dd>
784 Instead of the first handful of characters, show the full
785 pre- and post-image blob object names on the "index"
786 line when generating patch format output.
787 </p>
788 </dd>
789 <dt class="hdlist1">
790 --binary
791 </dt>
792 <dd>
794 In addition to <tt>--full-index</tt>, output a binary diff that
795 can be applied with <tt>git-apply</tt>.
796 </p>
797 </dd>
798 <dt class="hdlist1">
799 --abbrev[=&lt;n&gt;]
800 </dt>
801 <dd>
803 Instead of showing the full 40-byte hexadecimal object
804 name in diff-raw format output and diff-tree header
805 lines, show only a partial prefix. This is
806 independent of the <tt>--full-index</tt> option above, which controls
807 the diff-patch output format. Non default number of
808 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
809 </p>
810 </dd>
811 <dt class="hdlist1">
812 -B[&lt;n&gt;][/&lt;m&gt;]
813 </dt>
814 <dt class="hdlist1">
815 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
816 </dt>
817 <dd>
819 Break complete rewrite changes into pairs of delete and
820 create. This serves two purposes:
821 </p>
822 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
823 not as a series of deletion and insertion mixed together with a very
824 few lines that happen to match textually as the context, but as a
825 single deletion of everything old followed by a single insertion of
826 everything new, and the number <tt>m</tt> controls this aspect of the -B
827 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
828 original should remain in the result for git to consider it a total
829 rewrite (i.e. otherwise the resulting patch will be a series of
830 deletion and insertion mixed together with context lines).</p></div>
831 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
832 source of a rename (usually -M only considers a file that disappeared
833 as the source of a rename), and the number <tt>n</tt> controls this aspect of
834 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
835 addition and deletion compared to 20% or more of the file&#8217;s size are
836 eligible for being picked up as a possible source of a rename to
837 another file.</p></div>
838 </dd>
839 <dt class="hdlist1">
840 -M[&lt;n&gt;]
841 </dt>
842 <dt class="hdlist1">
843 --find-renames[=&lt;n&gt;]
844 </dt>
845 <dd>
847 Detect renames.
848 If <tt>n</tt> is specified, it is a threshold on the similarity
849 index (i.e. amount of addition/deletions compared to the
850 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
851 delete/add pair to be a rename if more than 90% of the file
852 hasn&#8217;t changed.
853 </p>
854 </dd>
855 <dt class="hdlist1">
856 -C[&lt;n&gt;]
857 </dt>
858 <dt class="hdlist1">
859 --find-copies[=&lt;n&gt;]
860 </dt>
861 <dd>
863 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
864 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
865 </p>
866 </dd>
867 <dt class="hdlist1">
868 --find-copies-harder
869 </dt>
870 <dd>
872 For performance reasons, by default, <tt>-C</tt> option finds copies only
873 if the original file of the copy was modified in the same
874 changeset. This flag makes the command
875 inspect unmodified files as candidates for the source of
876 copy. This is a very expensive operation for large
877 projects, so use it with caution. Giving more than one
878 <tt>-C</tt> option has the same effect.
879 </p>
880 </dd>
881 <dt class="hdlist1">
883 </dt>
884 <dt class="hdlist1">
885 --irreversible-delete
886 </dt>
887 <dd>
889 Omit the preimage for deletes, i.e. print only the header but not
890 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
891 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
892 solely for people who want to just concentrate on reviewing the
893 text after the change. In addition, the output obviously lack
894 enough information to apply such a patch in reverse, even manually,
895 hence the name of the option.
896 </p>
897 <div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
898 of a delete/create pair.</p></div>
899 </dd>
900 <dt class="hdlist1">
901 -l&lt;num&gt;
902 </dt>
903 <dd>
905 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
906 is the number of potential rename/copy targets. This
907 option prevents rename/copy detection from running if
908 the number of rename/copy targets exceeds the specified
909 number.
910 </p>
911 </dd>
912 <dt class="hdlist1">
913 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
914 </dt>
915 <dd>
917 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
918 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
919 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
920 are Unmerged (<tt>U</tt>), are
921 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
922 Any combination of the filter characters (including none) can be used.
923 When <tt>*</tt> (All-or-none) is added to the combination, all
924 paths are selected if there is any file that matches
925 other criteria in the comparison; if there is no file
926 that matches other criteria, nothing is selected.
927 </p>
928 </dd>
929 <dt class="hdlist1">
930 -S&lt;string&gt;
931 </dt>
932 <dd>
934 Look for differences that introduce or remove an instance of
935 &lt;string&gt;. Note that this is different than the string simply
936 appearing in diff output; see the <em>pickaxe</em> entry in
937 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
938 </p>
939 </dd>
940 <dt class="hdlist1">
941 -G&lt;regex&gt;
942 </dt>
943 <dd>
945 Look for differences whose added or removed line matches
946 the given &lt;regex&gt;.
947 </p>
948 </dd>
949 <dt class="hdlist1">
950 --pickaxe-all
951 </dt>
952 <dd>
954 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
955 changeset, not just the files that contain the change
956 in &lt;string&gt;.
957 </p>
958 </dd>
959 <dt class="hdlist1">
960 --pickaxe-regex
961 </dt>
962 <dd>
964 Make the &lt;string&gt; not a plain string but an extended POSIX
965 regex to match.
966 </p>
967 </dd>
968 <dt class="hdlist1">
969 -O&lt;orderfile&gt;
970 </dt>
971 <dd>
973 Output the patch in the order specified in the
974 &lt;orderfile&gt;, which has one shell glob pattern per line.
975 </p>
976 </dd>
977 <dt class="hdlist1">
979 </dt>
980 <dd>
982 Swap two inputs; that is, show differences from index or
983 on-disk file to tree contents.
984 </p>
985 </dd>
986 <dt class="hdlist1">
987 --relative[=&lt;path&gt;]
988 </dt>
989 <dd>
991 When run from a subdirectory of the project, it can be
992 told to exclude changes outside the directory and show
993 pathnames relative to it with this option. When you are
994 not in a subdirectory (e.g. in a bare repository), you
995 can name which subdirectory to make the output relative
996 to by giving a &lt;path&gt; as an argument.
997 </p>
998 </dd>
999 <dt class="hdlist1">
1001 </dt>
1002 <dt class="hdlist1">
1003 --text
1004 </dt>
1005 <dd>
1007 Treat all files as text.
1008 </p>
1009 </dd>
1010 <dt class="hdlist1">
1011 --ignore-space-at-eol
1012 </dt>
1013 <dd>
1015 Ignore changes in whitespace at EOL.
1016 </p>
1017 </dd>
1018 <dt class="hdlist1">
1020 </dt>
1021 <dt class="hdlist1">
1022 --ignore-space-change
1023 </dt>
1024 <dd>
1026 Ignore changes in amount of whitespace. This ignores whitespace
1027 at line end, and considers all other sequences of one or
1028 more whitespace characters to be equivalent.
1029 </p>
1030 </dd>
1031 <dt class="hdlist1">
1033 </dt>
1034 <dt class="hdlist1">
1035 --ignore-all-space
1036 </dt>
1037 <dd>
1039 Ignore whitespace when comparing lines. This ignores
1040 differences even if one line has whitespace where the other
1041 line has none.
1042 </p>
1043 </dd>
1044 <dt class="hdlist1">
1045 --inter-hunk-context=&lt;lines&gt;
1046 </dt>
1047 <dd>
1049 Show the context between diff hunks, up to the specified number
1050 of lines, thereby fusing hunks that are close to each other.
1051 </p>
1052 </dd>
1053 <dt class="hdlist1">
1054 --exit-code
1055 </dt>
1056 <dd>
1058 Make the program exit with codes similar to diff(1).
1059 That is, it exits with 1 if there were differences and
1060 0 means no differences.
1061 </p>
1062 </dd>
1063 <dt class="hdlist1">
1064 --quiet
1065 </dt>
1066 <dd>
1068 Disable all output of the program. Implies <tt>--exit-code</tt>.
1069 </p>
1070 </dd>
1071 <dt class="hdlist1">
1072 --ext-diff
1073 </dt>
1074 <dd>
1076 Allow an external diff helper to be executed. If you set an
1077 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1078 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1079 </p>
1080 </dd>
1081 <dt class="hdlist1">
1082 --no-ext-diff
1083 </dt>
1084 <dd>
1086 Disallow external diff drivers.
1087 </p>
1088 </dd>
1089 <dt class="hdlist1">
1090 --ignore-submodules[=&lt;when&gt;]
1091 </dt>
1092 <dd>
1094 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1095 either "none", "untracked", "dirty" or "all", which is the default
1096 Using "none" will consider the submodule modified when it either contains
1097 untracked or modified files or its HEAD differs from the commit recorded
1098 in the superproject and can be used to override any settings of the
1099 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1100 "untracked" is used submodules are not considered dirty when they only
1101 contain untracked content (but they are still scanned for modified
1102 content). Using "dirty" ignores all changes to the work tree of submodules,
1103 only changes to the commits stored in the superproject are shown (this was
1104 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1105 </p>
1106 </dd>
1107 <dt class="hdlist1">
1108 --src-prefix=&lt;prefix&gt;
1109 </dt>
1110 <dd>
1112 Show the given source prefix instead of "a/".
1113 </p>
1114 </dd>
1115 <dt class="hdlist1">
1116 --dst-prefix=&lt;prefix&gt;
1117 </dt>
1118 <dd>
1120 Show the given destination prefix instead of "b/".
1121 </p>
1122 </dd>
1123 <dt class="hdlist1">
1124 --no-prefix
1125 </dt>
1126 <dd>
1128 Do not show any source or destination prefix.
1129 </p>
1130 </dd>
1131 </dl></div>
1132 <div class="paragraph"><p>For more detailed explanation on these common options, see also
1133 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
1134 <div class="dlist"><dl>
1135 <dt class="hdlist1">
1136 &lt;tree-ish&gt;
1137 </dt>
1138 <dd>
1140 The id of a tree object.
1141 </p>
1142 </dd>
1143 <dt class="hdlist1">
1144 &lt;path&gt;&#8230;
1145 </dt>
1146 <dd>
1148 If provided, the results are limited to a subset of files
1149 matching one of these prefix strings.
1150 i.e., file matches <tt>/^&lt;pattern1&gt;|&lt;pattern2&gt;|&#8230;/</tt>
1151 Note that this parameter does not provide any wildcard or regexp
1152 features.
1153 </p>
1154 </dd>
1155 <dt class="hdlist1">
1157 </dt>
1158 <dd>
1160 recurse into sub-trees
1161 </p>
1162 </dd>
1163 <dt class="hdlist1">
1165 </dt>
1166 <dd>
1168 show tree entry itself as well as subtrees. Implies -r.
1169 </p>
1170 </dd>
1171 <dt class="hdlist1">
1172 --root
1173 </dt>
1174 <dd>
1176 When <em>--root</em> is specified the initial commit will be shown as a big
1177 creation event. This is equivalent to a diff against the NULL tree.
1178 </p>
1179 </dd>
1180 <dt class="hdlist1">
1181 --stdin
1182 </dt>
1183 <dd>
1185 When <em>--stdin</em> is specified, the command does not take
1186 &lt;tree-ish&gt; arguments from the command line. Instead, it
1187 reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a
1188 list of &lt;commit&gt; from its standard input. (Use a single space
1189 as separator.)
1190 </p>
1191 <div class="paragraph"><p>When two trees are given, it compares the first tree with the second.
1192 When a single commit is given, it compares the commit with its
1193 parents. The remaining commits, when given, are used as if they are
1194 parents of the first commit.</p></div>
1195 <div class="paragraph"><p>When comparing two trees, the ID of both trees (separated by a space
1196 and terminated by a newline) is printed before the difference. When
1197 comparing commits, the ID of the first (or only) commit, followed by a
1198 newline, is printed.</p></div>
1199 <div class="paragraph"><p>The following flags further affect the behavior when comparing
1200 commits (but not trees).</p></div>
1201 </dd>
1202 <dt class="hdlist1">
1204 </dt>
1205 <dd>
1207 By default, <em>git diff-tree --stdin</em> does not show
1208 differences for merge commits. With this flag, it shows
1209 differences to that commit from all of its parents. See
1210 also <em>-c</em>.
1211 </p>
1212 </dd>
1213 <dt class="hdlist1">
1215 </dt>
1216 <dd>
1218 By default, <em>git diff-tree --stdin</em> shows differences,
1219 either in machine-readable form (without <em>-p</em>) or in patch
1220 form (with <em>-p</em>). This output can be suppressed. It is
1221 only useful with <em>-v</em> flag.
1222 </p>
1223 </dd>
1224 <dt class="hdlist1">
1226 </dt>
1227 <dd>
1229 This flag causes <em>git diff-tree --stdin</em> to also show
1230 the commit message before the differences.
1231 </p>
1232 </dd>
1233 <dt class="hdlist1">
1234 --pretty[=&lt;format&gt;]
1235 </dt>
1236 <dt class="hdlist1">
1237 --format=&lt;format&gt;
1238 </dt>
1239 <dd>
1241 Pretty-print the contents of the commit logs in a given format,
1242 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
1243 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>. See
1244 the "PRETTY FORMATS" section for some additional details for each
1245 format. When omitted, the format defaults to <em>medium</em>.
1246 </p>
1247 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
1248 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
1249 </dd>
1250 <dt class="hdlist1">
1251 --abbrev-commit
1252 </dt>
1253 <dd>
1255 Instead of showing the full 40-byte hexadecimal commit object
1256 name, show only a partial prefix. Non default number of
1257 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
1258 diff output, if it is displayed).
1259 </p>
1260 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
1261 people using 80-column terminals.</p></div>
1262 </dd>
1263 <dt class="hdlist1">
1264 --no-abbrev-commit
1265 </dt>
1266 <dd>
1268 Show the full 40-byte hexadecimal commit object name. This negates
1269 <tt>--abbrev-commit</tt> and those options which imply it such as
1270 "--oneline". It also overrides the <em>log.abbrevCommit</em> variable.
1271 </p>
1272 </dd>
1273 <dt class="hdlist1">
1274 --oneline
1275 </dt>
1276 <dd>
1278 This is a shorthand for "--pretty=oneline --abbrev-commit"
1279 used together.
1280 </p>
1281 </dd>
1282 <dt class="hdlist1">
1283 --encoding[=&lt;encoding&gt;]
1284 </dt>
1285 <dd>
1287 The commit objects record the encoding used for the log message
1288 in their encoding header; this option can be used to tell the
1289 command to re-code the commit log message in the encoding
1290 preferred by the user. For non plumbing commands this
1291 defaults to UTF-8.
1292 </p>
1293 </dd>
1294 <dt class="hdlist1">
1295 --notes[=&lt;ref&gt;]
1296 </dt>
1297 <dd>
1299 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
1300 commit, when showing the commit log message. This is the default
1301 for <tt>git log</tt>, <tt>git show</tt> and <tt>git whatchanged</tt> commands when
1302 there is no <tt>--pretty</tt>, <tt>--format</tt> nor <tt>--oneline</tt> option given
1303 on the command line.
1304 </p>
1305 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
1306 <em>core.notesRef</em> and <em>notes.displayRef</em> variables (or corresponding
1307 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
1308 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, show this notes ref instead of the
1309 default notes ref(s). The ref is taken to be in <tt>refs/notes/</tt> if it
1310 is not qualified.</p></div>
1311 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
1312 being displayed. Examples: "--notes=foo" will show only notes from
1313 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
1314 "refs/notes/foo" and from the default notes ref(s).</p></div>
1315 </dd>
1316 <dt class="hdlist1">
1317 --no-notes
1318 </dt>
1319 <dd>
1321 Do not show notes. This negates the above <tt>--notes</tt> option, by
1322 resetting the list of notes refs from which notes are shown.
1323 Options are parsed in the order given on the command line, so e.g.
1324 "--notes --notes=foo --no-notes --notes=bar" will only show notes
1325 from "refs/notes/bar".
1326 </p>
1327 </dd>
1328 <dt class="hdlist1">
1329 --show-notes[=&lt;ref&gt;]
1330 </dt>
1331 <dt class="hdlist1">
1332 --[no-]standard-notes
1333 </dt>
1334 <dd>
1336 These options are deprecated. Use the above --notes/--no-notes
1337 options instead.
1338 </p>
1339 </dd>
1340 <dt class="hdlist1">
1341 --no-commit-id
1342 </dt>
1343 <dd>
1345 <em>git diff-tree</em> outputs a line with the commit ID when
1346 applicable. This flag suppressed the commit ID output.
1347 </p>
1348 </dd>
1349 <dt class="hdlist1">
1351 </dt>
1352 <dd>
1354 This flag changes the way a merge commit is displayed
1355 (which means it is useful only when the command is given
1356 one &lt;tree-ish&gt;, or <em>--stdin</em>). It shows the differences
1357 from each of the parents to the merge result simultaneously
1358 instead of showing pairwise diff between a parent and the
1359 result one at a time (which is what the <em>-m</em> option does).
1360 Furthermore, it lists only files which were modified
1361 from all parents.
1362 </p>
1363 </dd>
1364 <dt class="hdlist1">
1365 --cc
1366 </dt>
1367 <dd>
1369 This flag changes the way a merge commit patch is displayed,
1370 in a similar way to the <em>-c</em> option. It implies the <em>-c</em>
1371 and <em>-p</em> options and further compresses the patch output
1372 by omitting uninteresting hunks whose the contents in the parents
1373 have only two variants and the merge result picks one of them
1374 without modification. When all hunks are uninteresting, the commit
1375 itself and the commit log message is not shown, just like in any other
1376 "empty diff" case.
1377 </p>
1378 </dd>
1379 <dt class="hdlist1">
1380 --always
1381 </dt>
1382 <dd>
1384 Show the commit itself and the commit log message even
1385 if the diff itself is empty.
1386 </p>
1387 </dd>
1388 </dl></div>
1389 </div>
1390 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
1391 <div class="sectionbody">
1392 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
1393 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1394 inserted before the <em>Author:</em> line. This line begins with
1395 "Merge: " and the sha1s of ancestral commits are printed,
1396 separated by spaces. Note that the listed commits may not
1397 necessarily be the list of the <strong>direct</strong> parent commits if you
1398 have limited your view of history: for example, if you are
1399 only interested in changes related to a certain directory or
1400 file.</p></div>
1401 <div class="paragraph"><p>There are several built-in formats, and you can define
1402 additional formats by setting a pretty.&lt;name&gt;
1403 config option to either another format name, or a
1404 <em>format:</em> string, as described below (see
1405 <a href="git-config.html">git-config(1)</a>). Here are the details of the
1406 built-in formats:</p></div>
1407 <div class="ulist"><ul>
1408 <li>
1410 <em>oneline</em>
1411 </p>
1412 <div class="literalblock">
1413 <div class="content">
1414 <pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
1415 </div></div>
1416 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
1417 </li>
1418 <li>
1420 <em>short</em>
1421 </p>
1422 <div class="literalblock">
1423 <div class="content">
1424 <pre><tt>commit &lt;sha1&gt;
1425 Author: &lt;author&gt;</tt></pre>
1426 </div></div>
1427 <div class="literalblock">
1428 <div class="content">
1429 <pre><tt>&lt;title line&gt;</tt></pre>
1430 </div></div>
1431 </li>
1432 <li>
1434 <em>medium</em>
1435 </p>
1436 <div class="literalblock">
1437 <div class="content">
1438 <pre><tt>commit &lt;sha1&gt;
1439 Author: &lt;author&gt;
1440 Date: &lt;author date&gt;</tt></pre>
1441 </div></div>
1442 <div class="literalblock">
1443 <div class="content">
1444 <pre><tt>&lt;title line&gt;</tt></pre>
1445 </div></div>
1446 <div class="literalblock">
1447 <div class="content">
1448 <pre><tt>&lt;full commit message&gt;</tt></pre>
1449 </div></div>
1450 </li>
1451 <li>
1453 <em>full</em>
1454 </p>
1455 <div class="literalblock">
1456 <div class="content">
1457 <pre><tt>commit &lt;sha1&gt;
1458 Author: &lt;author&gt;
1459 Commit: &lt;committer&gt;</tt></pre>
1460 </div></div>
1461 <div class="literalblock">
1462 <div class="content">
1463 <pre><tt>&lt;title line&gt;</tt></pre>
1464 </div></div>
1465 <div class="literalblock">
1466 <div class="content">
1467 <pre><tt>&lt;full commit message&gt;</tt></pre>
1468 </div></div>
1469 </li>
1470 <li>
1472 <em>fuller</em>
1473 </p>
1474 <div class="literalblock">
1475 <div class="content">
1476 <pre><tt>commit &lt;sha1&gt;
1477 Author: &lt;author&gt;
1478 AuthorDate: &lt;author date&gt;
1479 Commit: &lt;committer&gt;
1480 CommitDate: &lt;committer date&gt;</tt></pre>
1481 </div></div>
1482 <div class="literalblock">
1483 <div class="content">
1484 <pre><tt>&lt;title line&gt;</tt></pre>
1485 </div></div>
1486 <div class="literalblock">
1487 <div class="content">
1488 <pre><tt>&lt;full commit message&gt;</tt></pre>
1489 </div></div>
1490 </li>
1491 <li>
1493 <em>email</em>
1494 </p>
1495 <div class="literalblock">
1496 <div class="content">
1497 <pre><tt>From &lt;sha1&gt; &lt;date&gt;
1498 From: &lt;author&gt;
1499 Date: &lt;author date&gt;
1500 Subject: [PATCH] &lt;title line&gt;</tt></pre>
1501 </div></div>
1502 <div class="literalblock">
1503 <div class="content">
1504 <pre><tt>&lt;full commit message&gt;</tt></pre>
1505 </div></div>
1506 </li>
1507 <li>
1509 <em>raw</em>
1510 </p>
1511 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
1512 stored in the commit object. Notably, the SHA1s are
1513 displayed in full, regardless of whether --abbrev or
1514 --no-abbrev are used, and <em>parents</em> information show the
1515 true parent commits, without taking grafts nor history
1516 simplification into account.</p></div>
1517 </li>
1518 <li>
1520 <em>format:&lt;string&gt;</em>
1521 </p>
1522 <div class="paragraph"><p>The <em>format:&lt;string&gt;</em> format allows you to specify which information
1523 you want to show. It works a little bit like printf format,
1524 with the notable exception that you get a newline with <em>%n</em>
1525 instead of <em>\n</em>.</p></div>
1526 <div class="paragraph"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
1527 would show something like this:</p></div>
1528 <div class="listingblock">
1529 <div class="content">
1530 <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
1531 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</tt></pre>
1532 </div></div>
1533 <div class="paragraph"><p>The placeholders are:</p></div>
1534 <div class="ulist"><ul>
1535 <li>
1537 <em>%H</em>: commit hash
1538 </p>
1539 </li>
1540 <li>
1542 <em>%h</em>: abbreviated commit hash
1543 </p>
1544 </li>
1545 <li>
1547 <em>%T</em>: tree hash
1548 </p>
1549 </li>
1550 <li>
1552 <em>%t</em>: abbreviated tree hash
1553 </p>
1554 </li>
1555 <li>
1557 <em>%P</em>: parent hashes
1558 </p>
1559 </li>
1560 <li>
1562 <em>%p</em>: abbreviated parent hashes
1563 </p>
1564 </li>
1565 <li>
1567 <em>%an</em>: author name
1568 </p>
1569 </li>
1570 <li>
1572 <em>%aN</em>: author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1573 </p>
1574 </li>
1575 <li>
1577 <em>%ae</em>: author email
1578 </p>
1579 </li>
1580 <li>
1582 <em>%aE</em>: author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1583 </p>
1584 </li>
1585 <li>
1587 <em>%ad</em>: author date (format respects --date= option)
1588 </p>
1589 </li>
1590 <li>
1592 <em>%aD</em>: author date, RFC2822 style
1593 </p>
1594 </li>
1595 <li>
1597 <em>%ar</em>: author date, relative
1598 </p>
1599 </li>
1600 <li>
1602 <em>%at</em>: author date, UNIX timestamp
1603 </p>
1604 </li>
1605 <li>
1607 <em>%ai</em>: author date, ISO 8601 format
1608 </p>
1609 </li>
1610 <li>
1612 <em>%cn</em>: committer name
1613 </p>
1614 </li>
1615 <li>
1617 <em>%cN</em>: committer name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1618 </p>
1619 </li>
1620 <li>
1622 <em>%ce</em>: committer email
1623 </p>
1624 </li>
1625 <li>
1627 <em>%cE</em>: committer email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1628 </p>
1629 </li>
1630 <li>
1632 <em>%cd</em>: committer date
1633 </p>
1634 </li>
1635 <li>
1637 <em>%cD</em>: committer date, RFC2822 style
1638 </p>
1639 </li>
1640 <li>
1642 <em>%cr</em>: committer date, relative
1643 </p>
1644 </li>
1645 <li>
1647 <em>%ct</em>: committer date, UNIX timestamp
1648 </p>
1649 </li>
1650 <li>
1652 <em>%ci</em>: committer date, ISO 8601 format
1653 </p>
1654 </li>
1655 <li>
1657 <em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
1658 </p>
1659 </li>
1660 <li>
1662 <em>%e</em>: encoding
1663 </p>
1664 </li>
1665 <li>
1667 <em>%s</em>: subject
1668 </p>
1669 </li>
1670 <li>
1672 <em>%f</em>: sanitized subject line, suitable for a filename
1673 </p>
1674 </li>
1675 <li>
1677 <em>%b</em>: body
1678 </p>
1679 </li>
1680 <li>
1682 <em>%B</em>: raw body (unwrapped subject and body)
1683 </p>
1684 </li>
1685 <li>
1687 <em>%N</em>: commit notes
1688 </p>
1689 </li>
1690 <li>
1692 <em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
1693 </p>
1694 </li>
1695 <li>
1697 <em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
1698 </p>
1699 </li>
1700 <li>
1702 <em>%gs</em>: reflog subject
1703 </p>
1704 </li>
1705 <li>
1707 <em>%Cred</em>: switch color to red
1708 </p>
1709 </li>
1710 <li>
1712 <em>%Cgreen</em>: switch color to green
1713 </p>
1714 </li>
1715 <li>
1717 <em>%Cblue</em>: switch color to blue
1718 </p>
1719 </li>
1720 <li>
1722 <em>%Creset</em>: reset color
1723 </p>
1724 </li>
1725 <li>
1727 <em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
1728 </p>
1729 </li>
1730 <li>
1732 <em>%m</em>: left, right or boundary mark
1733 </p>
1734 </li>
1735 <li>
1737 <em>%n</em>: newline
1738 </p>
1739 </li>
1740 <li>
1742 <em>%%</em>: a raw <em>%</em>
1743 </p>
1744 </li>
1745 <li>
1747 <em>%x00</em>: print a byte from a hex code
1748 </p>
1749 </li>
1750 <li>
1752 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
1753 <a href="git-shortlog.html">git-shortlog(1)</a>.
1754 </p>
1755 </li>
1756 </ul></div>
1757 </li>
1758 </ul></div>
1759 <div class="admonitionblock">
1760 <table><tr>
1761 <td class="icon">
1762 <div class="title">Note</div>
1763 </td>
1764 <td class="content">Some placeholders may depend on other options given to the
1765 revision traversal engine. For example, the <tt>%g*</tt> reflog options will
1766 insert an empty string unless we are traversing reflog entries (e.g., by
1767 <tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
1768 format if <tt>--decorate</tt> was not already provided on the command line.</td>
1769 </tr></table>
1770 </div>
1771 <div class="paragraph"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
1772 is inserted immediately before the expansion if and only if the
1773 placeholder expands to a non-empty string.</p></div>
1774 <div class="paragraph"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
1775 immediately precede the expansion are deleted if and only if the
1776 placeholder expands to an empty string.</p></div>
1777 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
1778 is inserted immediately before the expansion if and only if the
1779 placeholder expands to a non-empty string.</p></div>
1780 <div class="ulist"><ul>
1781 <li>
1783 <em>tformat:</em>
1784 </p>
1785 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
1786 provides "terminator" semantics instead of "separator" semantics. In
1787 other words, each commit has the message terminator character (usually a
1788 newline) appended, rather than a separator placed between entries.
1789 This means that the final entry of a single-line format will be properly
1790 terminated with a new line, just as the "oneline" format does.
1791 For example:</p></div>
1792 <div class="listingblock">
1793 <div class="content">
1794 <pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
1795 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1796 4da45be
1797 7134973 -- NO NEWLINE
1799 $ git log -2 --pretty=tformat:%h 4da45bef \
1800 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1801 4da45be
1802 7134973</tt></pre>
1803 </div></div>
1804 <div class="paragraph"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
1805 as if it has <tt>tformat:</tt> in front of it. For example, these two are
1806 equivalent:</p></div>
1807 <div class="listingblock">
1808 <div class="content">
1809 <pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
1810 $ git log -2 --pretty=%h 4da45bef</tt></pre>
1811 </div></div>
1812 </li>
1813 </ul></div>
1814 </div>
1815 <h2 id="_limiting_output">Limiting Output</h2>
1816 <div class="sectionbody">
1817 <div class="paragraph"><p>If you&#8217;re only interested in differences in a subset of files, for
1818 example some architecture-specific files, you might do:</p></div>
1819 <div class="literalblock">
1820 <div class="content">
1821 <pre><tt>git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; arch/ia64 include/asm-ia64</tt></pre>
1822 </div></div>
1823 <div class="paragraph"><p>and it will only show you what changed in those two directories.</p></div>
1824 <div class="paragraph"><p>Or if you are searching for what changed in just <tt>kernel/sched.c</tt>, just do</p></div>
1825 <div class="literalblock">
1826 <div class="content">
1827 <pre><tt>git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; kernel/sched.c</tt></pre>
1828 </div></div>
1829 <div class="paragraph"><p>and it will ignore all differences to other files.</p></div>
1830 <div class="paragraph"><p>The pattern is always the prefix, and is matched exactly. There are no
1831 wildcards. Even stricter, it has to match a complete path component.
1832 I.e. "foo" does not pick up <tt>foobar.h</tt>. "foo" does match <tt>foo/bar.h</tt>
1833 so it can be used to name subdirectories.</p></div>
1834 <div class="paragraph"><p>An example of normal usage is:</p></div>
1835 <div class="literalblock">
1836 <div class="content">
1837 <pre><tt>torvalds@ppc970:~/git&gt; git diff-tree --abbrev 5319e4
1838 :100664 100664 ac348b... a01513... git-fsck-objects.c</tt></pre>
1839 </div></div>
1840 <div class="paragraph"><p>which tells you that the last commit changed just one file (it&#8217;s from
1841 this one:</p></div>
1842 <div class="listingblock">
1843 <div class="content">
1844 <pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
1845 tree 5319e4d609cdd282069cc4dce33c1db559539b03
1846 parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
1847 author Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
1848 committer Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
1850 Make "git-fsck-objects" print out all the root commits it finds.
1852 Once I do the reference tracking, I'll also make it print out all the
1853 HEAD commits it finds, which is even more interesting.</tt></pre>
1854 </div></div>
1855 <div class="paragraph"><p>in case you care).</p></div>
1856 </div>
1857 <h2 id="_raw_output_format">Raw output format</h2>
1858 <div class="sectionbody">
1859 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
1860 "git-diff-files" and "git diff --raw" are very similar.</p></div>
1861 <div class="paragraph"><p>These commands all compare two sets of things; what is
1862 compared differs:</p></div>
1863 <div class="dlist"><dl>
1864 <dt class="hdlist1">
1865 git-diff-index &lt;tree-ish&gt;
1866 </dt>
1867 <dd>
1869 compares the &lt;tree-ish&gt; and the files on the filesystem.
1870 </p>
1871 </dd>
1872 <dt class="hdlist1">
1873 git-diff-index --cached &lt;tree-ish&gt;
1874 </dt>
1875 <dd>
1877 compares the &lt;tree-ish&gt; and the index.
1878 </p>
1879 </dd>
1880 <dt class="hdlist1">
1881 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1882 </dt>
1883 <dd>
1885 compares the trees named by the two arguments.
1886 </p>
1887 </dd>
1888 <dt class="hdlist1">
1889 git-diff-files [&lt;pattern&gt;&#8230;]
1890 </dt>
1891 <dd>
1893 compares the index and the files on the filesystem.
1894 </p>
1895 </dd>
1896 </dl></div>
1897 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
1898 what is being compared. After that, all the commands print one output
1899 line per changed file.</p></div>
1900 <div class="paragraph"><p>An output line is formatted this way:</p></div>
1901 <div class="listingblock">
1902 <div class="content">
1903 <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1904 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1905 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1906 create :000000 100644 0000000... 1234567... A file4
1907 delete :100644 000000 1234567... 0000000... D file5
1908 unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1909 </div></div>
1910 <div class="paragraph"><p>That is, from the left to the right:</p></div>
1911 <div class="olist arabic"><ol class="arabic">
1912 <li>
1914 a colon.
1915 </p>
1916 </li>
1917 <li>
1919 mode for "src"; 000000 if creation or unmerged.
1920 </p>
1921 </li>
1922 <li>
1924 a space.
1925 </p>
1926 </li>
1927 <li>
1929 mode for "dst"; 000000 if deletion or unmerged.
1930 </p>
1931 </li>
1932 <li>
1934 a space.
1935 </p>
1936 </li>
1937 <li>
1939 sha1 for "src"; 0{40} if creation or unmerged.
1940 </p>
1941 </li>
1942 <li>
1944 a space.
1945 </p>
1946 </li>
1947 <li>
1949 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1950 </p>
1951 </li>
1952 <li>
1954 a space.
1955 </p>
1956 </li>
1957 <li>
1959 status, followed by optional "score" number.
1960 </p>
1961 </li>
1962 <li>
1964 a tab or a NUL when <em>-z</em> option is used.
1965 </p>
1966 </li>
1967 <li>
1969 path for "src"
1970 </p>
1971 </li>
1972 <li>
1974 a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1975 </p>
1976 </li>
1977 <li>
1979 path for "dst"; only exists for C or R.
1980 </p>
1981 </li>
1982 <li>
1984 an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1985 </p>
1986 </li>
1987 </ol></div>
1988 <div class="paragraph"><p>Possible status letters are:</p></div>
1989 <div class="ulist"><ul>
1990 <li>
1992 A: addition of a file
1993 </p>
1994 </li>
1995 <li>
1997 C: copy of a file into a new one
1998 </p>
1999 </li>
2000 <li>
2002 D: deletion of a file
2003 </p>
2004 </li>
2005 <li>
2007 M: modification of the contents or mode of a file
2008 </p>
2009 </li>
2010 <li>
2012 R: renaming of a file
2013 </p>
2014 </li>
2015 <li>
2017 T: change in the type of the file
2018 </p>
2019 </li>
2020 <li>
2022 U: file is unmerged (you must complete the merge before it can
2023 be committed)
2024 </p>
2025 </li>
2026 <li>
2028 X: "unknown" change type (most probably a bug, please report it)
2029 </p>
2030 </li>
2031 </ul></div>
2032 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
2033 percentage of similarity between the source and target of the move or
2034 copy), and are the only ones to be so.</p></div>
2035 <div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
2036 and it is out of sync with the index.</p></div>
2037 <div class="paragraph"><p>Example:</p></div>
2038 <div class="listingblock">
2039 <div class="content">
2040 <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
2041 </div></div>
2042 <div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
2043 in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
2044 respectively.</p></div>
2045 </div>
2046 <h2 id="_diff_format_for_merges">diff format for merges</h2>
2047 <div class="sectionbody">
2048 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
2049 can take <em>-c</em> or <em>--cc</em> option
2050 to generate diff output also for merge commits. The output differs
2051 from the format described above in the following way:</p></div>
2052 <div class="olist arabic"><ol class="arabic">
2053 <li>
2055 there is a colon for each parent
2056 </p>
2057 </li>
2058 <li>
2060 there are more "src" modes and "src" sha1
2061 </p>
2062 </li>
2063 <li>
2065 status is concatenated status characters for each parent
2066 </p>
2067 </li>
2068 <li>
2070 no optional "score" number
2071 </p>
2072 </li>
2073 <li>
2075 single path, only for "dst"
2076 </p>
2077 </li>
2078 </ol></div>
2079 <div class="paragraph"><p>Example:</p></div>
2080 <div class="listingblock">
2081 <div class="content">
2082 <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
2083 </div></div>
2084 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
2085 all parents.</p></div>
2086 </div>
2087 <h2 id="_generating_patches_with_p">Generating patches with -p</h2>
2088 <div class="sectionbody">
2089 <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
2090 with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
2091 "git log" with the "-p" option, they
2092 do not produce the output described above; instead they produce a
2093 patch file. You can customize the creation of such patches via the
2094 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2095 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
2096 diff format:</p></div>
2097 <div class="olist arabic"><ol class="arabic">
2098 <li>
2100 It is preceded with a "git diff" header that looks like this:
2101 </p>
2102 <div class="literalblock">
2103 <div class="content">
2104 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2105 </div></div>
2106 <div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2107 involved. Especially, even for a creation or a deletion,
2108 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2109 <div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2110 name of the source file of the rename/copy and the name of
2111 the file that rename/copy produces, respectively.</p></div>
2112 </li>
2113 <li>
2115 It is followed by one or more extended header lines:
2116 </p>
2117 <div class="literalblock">
2118 <div class="content">
2119 <pre><tt>old mode &lt;mode&gt;
2120 new mode &lt;mode&gt;
2121 deleted file mode &lt;mode&gt;
2122 new file mode &lt;mode&gt;
2123 copy from &lt;path&gt;
2124 copy to &lt;path&gt;
2125 rename from &lt;path&gt;
2126 rename to &lt;path&gt;
2127 similarity index &lt;number&gt;
2128 dissimilarity index &lt;number&gt;
2129 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
2130 </div></div>
2131 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
2132 and file permission bits.</p></div>
2133 <div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2134 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
2135 the dissimilarity index is the percentage of changed lines. It
2136 is a rounded down integer, followed by a percent sign. The
2137 similarity index value of 100% is thus reserved for two equal
2138 files, while 100% dissimilarity means that no line from the old
2139 file made it into the new one.</p></div>
2140 <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
2141 The &lt;mode&gt; is included if the file mode does not change; otherwise,
2142 separate lines indicate the old and the new mode.</p></div>
2143 </li>
2144 <li>
2146 TAB, LF, double quote and backslash characters in pathnames
2147 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
2148 If there is need for such substitution then the whole
2149 pathname is put in double quotes.
2150 </p>
2151 </li>
2152 <li>
2154 All the <tt>file1</tt> files in the output refer to files before the
2155 commit, and all the <tt>file2</tt> files refer to files after the commit.
2156 It is incorrect to apply each change to each file sequentially. For
2157 example, this patch will swap a and b:
2158 </p>
2159 <div class="literalblock">
2160 <div class="content">
2161 <pre><tt>diff --git a/a b/b
2162 rename from a
2163 rename to b
2164 diff --git a/b b/a
2165 rename from b
2166 rename to a</tt></pre>
2167 </div></div>
2168 </li>
2169 </ol></div>
2170 </div>
2171 <h2 id="_combined_diff_format">combined diff format</h2>
2172 <div class="sectionbody">
2173 <div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
2174 produce a <em>combined diff</em> when showing a merge. This is the default
2175 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
2176 <a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
2177 of these commands to force generation of diffs with individual parents
2178 of a merge.</p></div>
2179 <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
2180 <div class="listingblock">
2181 <div class="content">
2182 <pre><tt>diff --combined describe.c
2183 index fabadb8,cc95eb0..4866510
2184 --- a/describe.c
2185 +++ b/describe.c
2186 @@@ -98,20 -98,12 +98,20 @@@
2187 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
2190 - static void describe(char *arg)
2191 -static void describe(struct commit *cmit, int last_one)
2192 ++static void describe(char *arg, int last_one)
2194 + unsigned char sha1[20];
2195 + struct commit *cmit;
2196 struct commit_list *list;
2197 static int initialized = 0;
2198 struct commit_name *n;
2200 + if (get_sha1(arg, sha1) &lt; 0)
2201 + usage(describe_usage);
2202 + cmit = lookup_commit_reference(sha1);
2203 + if (!cmit)
2204 + usage(describe_usage);
2206 if (!initialized) {
2207 initialized = 1;
2208 for_each_ref(get_name);</tt></pre>
2209 </div></div>
2210 <div class="olist arabic"><ol class="arabic">
2211 <li>
2213 It is preceded with a "git diff" header, that looks like
2214 this (when <em>-c</em> option is used):
2215 </p>
2216 <div class="literalblock">
2217 <div class="content">
2218 <pre><tt>diff --combined file</tt></pre>
2219 </div></div>
2220 <div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
2221 <div class="literalblock">
2222 <div class="content">
2223 <pre><tt>diff --cc file</tt></pre>
2224 </div></div>
2225 </li>
2226 <li>
2228 It is followed by one or more extended header lines
2229 (this example shows a merge with two parents):
2230 </p>
2231 <div class="literalblock">
2232 <div class="content">
2233 <pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
2234 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2235 new file mode &lt;mode&gt;
2236 deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
2237 </div></div>
2238 <div class="paragraph"><p>The <tt>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</tt> line appears only if at least one of
2239 the &lt;mode&gt; is different from the rest. Extended headers with
2240 information about detected contents movement (renames and
2241 copying detection) are designed to work with diff of two
2242 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
2243 </li>
2244 <li>
2246 It is followed by two-line from-file/to-file header
2247 </p>
2248 <div class="literalblock">
2249 <div class="content">
2250 <pre><tt>--- a/file
2251 +++ b/file</tt></pre>
2252 </div></div>
2253 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
2254 format, <tt>/dev/null</tt> is used to signal created or deleted
2255 files.</p></div>
2256 </li>
2257 <li>
2259 Chunk header format is modified to prevent people from
2260 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
2261 was created for review of merge commit changes, and was not
2262 meant for apply. The change is similar to the change in the
2263 extended <em>index</em> header:
2264 </p>
2265 <div class="literalblock">
2266 <div class="content">
2267 <pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
2268 </div></div>
2269 <div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
2270 header for combined diff format.</p></div>
2271 </li>
2272 </ol></div>
2273 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
2274 files A and B with a single column that has <tt>-</tt> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <tt>+</tt> (plus&#8201;&#8212;&#8201;missing in A but
2275 added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
2276 compares two or more files file1, file2,&#8230; with one file X, and
2277 shows how X differs from each of fileN. One column for each of
2278 fileN is prepended to the output line to note how X&#8217;s line is
2279 different from it.</p></div>
2280 <div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
2281 fileN but it does not appear in the result. A <tt>+</tt> character
2282 in the column N means that the line appears in the result,
2283 and fileN does not have that line (in other words, the line was
2284 added, from the point of view of that parent).</p></div>
2285 <div class="paragraph"><p>In the above example output, the function signature was changed
2286 from both files (hence two <tt>-</tt> removals from both file1 and
2287 file2, plus <tt>++</tt> to mean one line that was added does not appear
2288 in either file1 nor file2). Also eight other lines are the same
2289 from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
2290 <div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
2291 merge commit with the merge result (i.e. file1..fileN are the
2292 parents). When shown by <tt>git diff-files -c</tt>, it compares the
2293 two unresolved merge parents with the working tree file
2294 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
2295 "their version").</p></div>
2296 </div>
2297 <h2 id="_other_diff_formats">other diff formats</h2>
2298 <div class="sectionbody">
2299 <div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
2300 copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
2301 output. These options can be combined with other options, such as
2302 <tt>-p</tt>, and are meant for human consumption.</p></div>
2303 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
2304 formats the pathnames compactly by combining common prefix and suffix of
2305 the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
2306 <tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
2307 <div class="listingblock">
2308 <div class="content">
2309 <pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
2310 </div></div>
2311 <div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
2312 for easier machine consumption. An entry in <tt>--numstat</tt> output looks
2313 like this:</p></div>
2314 <div class="listingblock">
2315 <div class="content">
2316 <pre><tt>1 2 README
2317 3 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
2318 </div></div>
2319 <div class="paragraph"><p>That is, from left to right:</p></div>
2320 <div class="olist arabic"><ol class="arabic">
2321 <li>
2323 the number of added lines;
2324 </p>
2325 </li>
2326 <li>
2328 a tab;
2329 </p>
2330 </li>
2331 <li>
2333 the number of deleted lines;
2334 </p>
2335 </li>
2336 <li>
2338 a tab;
2339 </p>
2340 </li>
2341 <li>
2343 pathname (possibly with rename/copy information);
2344 </p>
2345 </li>
2346 <li>
2348 a newline.
2349 </p>
2350 </li>
2351 </ol></div>
2352 <div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
2353 <div class="listingblock">
2354 <div class="content">
2355 <pre><tt>1 2 README NUL
2356 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
2357 </div></div>
2358 <div class="paragraph"><p>That is:</p></div>
2359 <div class="olist arabic"><ol class="arabic">
2360 <li>
2362 the number of added lines;
2363 </p>
2364 </li>
2365 <li>
2367 a tab;
2368 </p>
2369 </li>
2370 <li>
2372 the number of deleted lines;
2373 </p>
2374 </li>
2375 <li>
2377 a tab;
2378 </p>
2379 </li>
2380 <li>
2382 a NUL (only exists if renamed/copied);
2383 </p>
2384 </li>
2385 <li>
2387 pathname in preimage;
2388 </p>
2389 </li>
2390 <li>
2392 a NUL (only exists if renamed/copied);
2393 </p>
2394 </li>
2395 <li>
2397 pathname in postimage (only exists if renamed/copied);
2398 </p>
2399 </li>
2400 <li>
2402 a NUL.
2403 </p>
2404 </li>
2405 </ol></div>
2406 <div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
2407 scripts that read the output to tell if the current record being read is
2408 a single-path record or a rename/copy record without reading ahead.
2409 After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
2410 the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
2411 </div>
2412 <h2 id="_git">GIT</h2>
2413 <div class="sectionbody">
2414 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2415 </div>
2416 <div id="footer">
2417 <div id="footer-text">
2418 Last updated 2011-05-31 19:53:01 UTC
2419 </div>
2420 </div>
2421 </body>
2422 </html>