Autogenerated HTML docs for v1.7.6-rc3
[git/jnareb-git.git] / git-diff-files.html
blob06304427b7f633287570eb8b837dea6e464dc57b
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-files(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-files(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-diff-files -
411 Compares files in the working tree and the index
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="paragraph"><p><em>git diff-files</em> [-q] [-0|-1|-2|-3|-c|--cc] [&lt;common diff options&gt;] [&lt;path&gt;&#8230;]</p></div>
418 </div>
419 <h2 id="_description">DESCRIPTION</h2>
420 <div class="sectionbody">
421 <div class="paragraph"><p>Compares the files in the working tree and the index. When paths
422 are specified, compares only those named paths. Otherwise all
423 entries in the index are compared. The output format is the
424 same as for <em>git diff-index</em> and <em>git diff-tree</em>.</p></div>
425 </div>
426 <h2 id="_options">OPTIONS</h2>
427 <div class="sectionbody">
428 <div class="dlist"><dl>
429 <dt class="hdlist1">
431 </dt>
432 <dt class="hdlist1">
434 </dt>
435 <dt class="hdlist1">
436 --patch
437 </dt>
438 <dd>
440 Generate patch (see section on generating patches).
442 </p>
443 </dd>
444 <dt class="hdlist1">
445 -U&lt;n&gt;
446 </dt>
447 <dt class="hdlist1">
448 --unified=&lt;n&gt;
449 </dt>
450 <dd>
452 Generate diffs with &lt;n&gt; lines of context instead of
453 the usual three.
454 Implies <tt>-p</tt>.
455 </p>
456 </dd>
457 <dt class="hdlist1">
458 --raw
459 </dt>
460 <dd>
462 Generate the raw format.
463 This is the default.
464 </p>
465 </dd>
466 <dt class="hdlist1">
467 --patch-with-raw
468 </dt>
469 <dd>
471 Synonym for <tt>-p --raw</tt>.
472 </p>
473 </dd>
474 <dt class="hdlist1">
475 --patience
476 </dt>
477 <dd>
479 Generate a diff using the "patience diff" algorithm.
480 </p>
481 </dd>
482 <dt class="hdlist1">
483 --stat[=&lt;width&gt;[,&lt;name-width&gt;]]
484 </dt>
485 <dd>
487 Generate a diffstat. You can override the default
488 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
489 The width of the filename part can be controlled by
490 giving another width to it separated by a comma.
491 </p>
492 </dd>
493 <dt class="hdlist1">
494 --numstat
495 </dt>
496 <dd>
498 Similar to <tt>--stat</tt>, but shows number of added and
499 deleted lines in decimal notation and pathname without
500 abbreviation, to make it more machine friendly. For
501 binary files, outputs two <tt>-</tt> instead of saying
502 <tt>0 0</tt>.
503 </p>
504 </dd>
505 <dt class="hdlist1">
506 --shortstat
507 </dt>
508 <dd>
510 Output only the last line of the <tt>--stat</tt> format containing total
511 number of modified files, as well as number of added and deleted
512 lines.
513 </p>
514 </dd>
515 <dt class="hdlist1">
516 --dirstat[=&lt;param1,param2,&#8230;&gt;]
517 </dt>
518 <dd>
520 Output the distribution of relative amount of changes for each
521 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
522 passing it a comma separated list of parameters.
523 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
524 variable (see <a href="git-config.html">git-config(1)</a>).
525 The following parameters are available:
526 </p>
527 <div class="dlist"><dl>
528 <dt class="hdlist1">
529 <tt>changes</tt>
530 </dt>
531 <dd>
533 Compute the dirstat numbers by counting the lines that have been
534 removed from the source, or added to the destination. This ignores
535 the amount of pure code movements within a file. In other words,
536 rearranging lines in a file is not counted as much as other changes.
537 This is the default behavior when no parameter is given.
538 </p>
539 </dd>
540 <dt class="hdlist1">
541 <tt>lines</tt>
542 </dt>
543 <dd>
545 Compute the dirstat numbers by doing the regular line-based diff
546 analysis, and summing the removed/added line counts. (For binary
547 files, count 64-byte chunks instead, since binary files have no
548 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
549 behavior than the <tt>changes</tt> behavior, but it does count rearranged
550 lines within a file as much as other changes. The resulting output
551 is consistent with what you get from the other <tt>--*stat</tt> options.
552 </p>
553 </dd>
554 <dt class="hdlist1">
555 <tt>files</tt>
556 </dt>
557 <dd>
559 Compute the dirstat numbers by counting the number of files changed.
560 Each changed file counts equally in the dirstat analysis. This is
561 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
562 not have to look at the file contents at all.
563 </p>
564 </dd>
565 <dt class="hdlist1">
566 <tt>cumulative</tt>
567 </dt>
568 <dd>
570 Count changes in a child directory for the parent directory as well.
571 Note that when using <tt>cumulative</tt>, the sum of the percentages
572 reported may exceed 100%. The default (non-cumulative) behavior can
573 be specified with the <tt>noncumulative</tt> parameter.
574 </p>
575 </dd>
576 <dt class="hdlist1">
577 &lt;limit&gt;
578 </dt>
579 <dd>
581 An integer parameter specifies a cut-off percent (3% by default).
582 Directories contributing less than this percentage of the changes
583 are not shown in the output.
584 </p>
585 </dd>
586 </dl></div>
587 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
588 directories with less than 10% of the total amount of changed files,
589 and accumulating child directory counts in the parent directories:
590 <tt>--dirstat=files,10,cumulative</tt>.</p></div>
591 </dd>
592 <dt class="hdlist1">
593 --summary
594 </dt>
595 <dd>
597 Output a condensed summary of extended header information
598 such as creations, renames and mode changes.
599 </p>
600 </dd>
601 <dt class="hdlist1">
602 --patch-with-stat
603 </dt>
604 <dd>
606 Synonym for <tt>-p --stat</tt>.
607 </p>
608 </dd>
609 <dt class="hdlist1">
611 </dt>
612 <dd>
614 When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been
615 given, do not munge pathnames and use NULs as output field terminators.
616 </p>
617 <div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
618 and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
619 respectively, and the pathname will be enclosed in double quotes if
620 any of those replacements occurred.</p></div>
621 </dd>
622 <dt class="hdlist1">
623 --name-only
624 </dt>
625 <dd>
627 Show only names of changed files.
628 </p>
629 </dd>
630 <dt class="hdlist1">
631 --name-status
632 </dt>
633 <dd>
635 Show only names and status of changed files. See the description
636 of the <tt>--diff-filter</tt> option on what the status letters mean.
637 </p>
638 </dd>
639 <dt class="hdlist1">
640 --submodule[=&lt;format&gt;]
641 </dt>
642 <dd>
644 Chose the output format for submodule differences. &lt;format&gt; can be one of
645 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
646 is used when this option is not given. <em>log</em> is the default value for this
647 option and lists the commits in that commit range like the <em>summary</em>
648 option of <a href="git-submodule.html">git-submodule(1)</a> does.
649 </p>
650 </dd>
651 <dt class="hdlist1">
652 --color[=&lt;when&gt;]
653 </dt>
654 <dd>
656 Show colored diff.
657 The value must be <tt>always</tt> (the default for <tt>&lt;when&gt;</tt>), <tt>never</tt>, or <tt>auto</tt>.
658 The default value is <tt>never</tt>.
659 </p>
660 </dd>
661 <dt class="hdlist1">
662 --no-color
663 </dt>
664 <dd>
666 Turn off colored diff.
667 It is the same as <tt>--color=never</tt>.
668 </p>
669 </dd>
670 <dt class="hdlist1">
671 --word-diff[=&lt;mode&gt;]
672 </dt>
673 <dd>
675 Show a word diff, using the &lt;mode&gt; to delimit changed words.
676 By default, words are delimited by whitespace; see
677 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
678 must be one of:
679 </p>
680 <div class="dlist"><dl>
681 <dt class="hdlist1">
682 color
683 </dt>
684 <dd>
686 Highlight changed words using only colors. Implies <tt>--color</tt>.
687 </p>
688 </dd>
689 <dt class="hdlist1">
690 plain
691 </dt>
692 <dd>
694 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
695 attempts to escape the delimiters if they appear in the input,
696 so the output may be ambiguous.
697 </p>
698 </dd>
699 <dt class="hdlist1">
700 porcelain
701 </dt>
702 <dd>
704 Use a special line-based format intended for script
705 consumption. Added/removed/unchanged runs are printed in the
706 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
707 character at the beginning of the line and extending to the
708 end of the line. Newlines in the input are represented by a
709 tilde <tt>~</tt> on a line of its own.
710 </p>
711 </dd>
712 <dt class="hdlist1">
713 none
714 </dt>
715 <dd>
717 Disable word diff again.
718 </p>
719 </dd>
720 </dl></div>
721 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
722 highlight the changed parts in all modes if enabled.</p></div>
723 </dd>
724 <dt class="hdlist1">
725 --word-diff-regex=&lt;regex&gt;
726 </dt>
727 <dd>
729 Use &lt;regex&gt; to decide what a word is, instead of considering
730 runs of non-whitespace to be a word. Also implies
731 <tt>--word-diff</tt> unless it was already enabled.
732 </p>
733 <div class="paragraph"><p>Every non-overlapping match of the
734 &lt;regex&gt; is considered a word. Anything between these matches is
735 considered whitespace and ignored(!) for the purposes of finding
736 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
737 expression to make sure that it matches all non-whitespace characters.
738 A match that contains a newline is silently truncated(!) at the
739 newline.</p></div>
740 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
741 <a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
742 overrides any diff driver or configuration setting. Diff drivers
743 override configuration settings.</p></div>
744 </dd>
745 <dt class="hdlist1">
746 --color-words[=&lt;regex&gt;]
747 </dt>
748 <dd>
750 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
751 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
752 </p>
753 </dd>
754 <dt class="hdlist1">
755 --no-renames
756 </dt>
757 <dd>
759 Turn off rename detection, even when the configuration
760 file gives the default to do so.
761 </p>
762 </dd>
763 <dt class="hdlist1">
764 --check
765 </dt>
766 <dd>
768 Warn if changes introduce whitespace errors. What are
769 considered whitespace errors is controlled by <tt>core.whitespace</tt>
770 configuration. By default, trailing whitespaces (including
771 lines that solely consist of whitespaces) and a space character
772 that is immediately followed by a tab character inside the
773 initial indent of the line are considered whitespace errors.
774 Exits with non-zero status if problems are found. Not compatible
775 with --exit-code.
776 </p>
777 </dd>
778 <dt class="hdlist1">
779 --full-index
780 </dt>
781 <dd>
783 Instead of the first handful of characters, show the full
784 pre- and post-image blob object names on the "index"
785 line when generating patch format output.
786 </p>
787 </dd>
788 <dt class="hdlist1">
789 --binary
790 </dt>
791 <dd>
793 In addition to <tt>--full-index</tt>, output a binary diff that
794 can be applied with <tt>git-apply</tt>.
795 </p>
796 </dd>
797 <dt class="hdlist1">
798 --abbrev[=&lt;n&gt;]
799 </dt>
800 <dd>
802 Instead of showing the full 40-byte hexadecimal object
803 name in diff-raw format output and diff-tree header
804 lines, show only a partial prefix. This is
805 independent of the <tt>--full-index</tt> option above, which controls
806 the diff-patch output format. Non default number of
807 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
808 </p>
809 </dd>
810 <dt class="hdlist1">
811 -B[&lt;n&gt;][/&lt;m&gt;]
812 </dt>
813 <dt class="hdlist1">
814 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
815 </dt>
816 <dd>
818 Break complete rewrite changes into pairs of delete and
819 create. This serves two purposes:
820 </p>
821 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
822 not as a series of deletion and insertion mixed together with a very
823 few lines that happen to match textually as the context, but as a
824 single deletion of everything old followed by a single insertion of
825 everything new, and the number <tt>m</tt> controls this aspect of the -B
826 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
827 original should remain in the result for git to consider it a total
828 rewrite (i.e. otherwise the resulting patch will be a series of
829 deletion and insertion mixed together with context lines).</p></div>
830 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
831 source of a rename (usually -M only considers a file that disappeared
832 as the source of a rename), and the number <tt>n</tt> controls this aspect of
833 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
834 addition and deletion compared to 20% or more of the file&#8217;s size are
835 eligible for being picked up as a possible source of a rename to
836 another file.</p></div>
837 </dd>
838 <dt class="hdlist1">
839 -M[&lt;n&gt;]
840 </dt>
841 <dt class="hdlist1">
842 --find-renames[=&lt;n&gt;]
843 </dt>
844 <dd>
846 Detect renames.
847 If <tt>n</tt> is specified, it is a threshold on the similarity
848 index (i.e. amount of addition/deletions compared to the
849 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
850 delete/add pair to be a rename if more than 90% of the file
851 hasn&#8217;t changed.
852 </p>
853 </dd>
854 <dt class="hdlist1">
855 -C[&lt;n&gt;]
856 </dt>
857 <dt class="hdlist1">
858 --find-copies[=&lt;n&gt;]
859 </dt>
860 <dd>
862 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
863 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
864 </p>
865 </dd>
866 <dt class="hdlist1">
867 --find-copies-harder
868 </dt>
869 <dd>
871 For performance reasons, by default, <tt>-C</tt> option finds copies only
872 if the original file of the copy was modified in the same
873 changeset. This flag makes the command
874 inspect unmodified files as candidates for the source of
875 copy. This is a very expensive operation for large
876 projects, so use it with caution. Giving more than one
877 <tt>-C</tt> option has the same effect.
878 </p>
879 </dd>
880 <dt class="hdlist1">
882 </dt>
883 <dt class="hdlist1">
884 --irreversible-delete
885 </dt>
886 <dd>
888 Omit the preimage for deletes, i.e. print only the header but not
889 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
890 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
891 solely for people who want to just concentrate on reviewing the
892 text after the change. In addition, the output obviously lack
893 enough information to apply such a patch in reverse, even manually,
894 hence the name of the option.
895 </p>
896 <div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
897 of a delete/create pair.</p></div>
898 </dd>
899 <dt class="hdlist1">
900 -l&lt;num&gt;
901 </dt>
902 <dd>
904 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
905 is the number of potential rename/copy targets. This
906 option prevents rename/copy detection from running if
907 the number of rename/copy targets exceeds the specified
908 number.
909 </p>
910 </dd>
911 <dt class="hdlist1">
912 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
913 </dt>
914 <dd>
916 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
917 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
918 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
919 are Unmerged (<tt>U</tt>), are
920 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
921 Any combination of the filter characters (including none) can be used.
922 When <tt>*</tt> (All-or-none) is added to the combination, all
923 paths are selected if there is any file that matches
924 other criteria in the comparison; if there is no file
925 that matches other criteria, nothing is selected.
926 </p>
927 </dd>
928 <dt class="hdlist1">
929 -S&lt;string&gt;
930 </dt>
931 <dd>
933 Look for differences that introduce or remove an instance of
934 &lt;string&gt;. Note that this is different than the string simply
935 appearing in diff output; see the <em>pickaxe</em> entry in
936 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
937 </p>
938 </dd>
939 <dt class="hdlist1">
940 -G&lt;regex&gt;
941 </dt>
942 <dd>
944 Look for differences whose added or removed line matches
945 the given &lt;regex&gt;.
946 </p>
947 </dd>
948 <dt class="hdlist1">
949 --pickaxe-all
950 </dt>
951 <dd>
953 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
954 changeset, not just the files that contain the change
955 in &lt;string&gt;.
956 </p>
957 </dd>
958 <dt class="hdlist1">
959 --pickaxe-regex
960 </dt>
961 <dd>
963 Make the &lt;string&gt; not a plain string but an extended POSIX
964 regex to match.
965 </p>
966 </dd>
967 <dt class="hdlist1">
968 -O&lt;orderfile&gt;
969 </dt>
970 <dd>
972 Output the patch in the order specified in the
973 &lt;orderfile&gt;, which has one shell glob pattern per line.
974 </p>
975 </dd>
976 <dt class="hdlist1">
978 </dt>
979 <dd>
981 Swap two inputs; that is, show differences from index or
982 on-disk file to tree contents.
983 </p>
984 </dd>
985 <dt class="hdlist1">
986 --relative[=&lt;path&gt;]
987 </dt>
988 <dd>
990 When run from a subdirectory of the project, it can be
991 told to exclude changes outside the directory and show
992 pathnames relative to it with this option. When you are
993 not in a subdirectory (e.g. in a bare repository), you
994 can name which subdirectory to make the output relative
995 to by giving a &lt;path&gt; as an argument.
996 </p>
997 </dd>
998 <dt class="hdlist1">
1000 </dt>
1001 <dt class="hdlist1">
1002 --text
1003 </dt>
1004 <dd>
1006 Treat all files as text.
1007 </p>
1008 </dd>
1009 <dt class="hdlist1">
1010 --ignore-space-at-eol
1011 </dt>
1012 <dd>
1014 Ignore changes in whitespace at EOL.
1015 </p>
1016 </dd>
1017 <dt class="hdlist1">
1019 </dt>
1020 <dt class="hdlist1">
1021 --ignore-space-change
1022 </dt>
1023 <dd>
1025 Ignore changes in amount of whitespace. This ignores whitespace
1026 at line end, and considers all other sequences of one or
1027 more whitespace characters to be equivalent.
1028 </p>
1029 </dd>
1030 <dt class="hdlist1">
1032 </dt>
1033 <dt class="hdlist1">
1034 --ignore-all-space
1035 </dt>
1036 <dd>
1038 Ignore whitespace when comparing lines. This ignores
1039 differences even if one line has whitespace where the other
1040 line has none.
1041 </p>
1042 </dd>
1043 <dt class="hdlist1">
1044 --inter-hunk-context=&lt;lines&gt;
1045 </dt>
1046 <dd>
1048 Show the context between diff hunks, up to the specified number
1049 of lines, thereby fusing hunks that are close to each other.
1050 </p>
1051 </dd>
1052 <dt class="hdlist1">
1053 --exit-code
1054 </dt>
1055 <dd>
1057 Make the program exit with codes similar to diff(1).
1058 That is, it exits with 1 if there were differences and
1059 0 means no differences.
1060 </p>
1061 </dd>
1062 <dt class="hdlist1">
1063 --quiet
1064 </dt>
1065 <dd>
1067 Disable all output of the program. Implies <tt>--exit-code</tt>.
1068 </p>
1069 </dd>
1070 <dt class="hdlist1">
1071 --ext-diff
1072 </dt>
1073 <dd>
1075 Allow an external diff helper to be executed. If you set an
1076 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1077 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1078 </p>
1079 </dd>
1080 <dt class="hdlist1">
1081 --no-ext-diff
1082 </dt>
1083 <dd>
1085 Disallow external diff drivers.
1086 </p>
1087 </dd>
1088 <dt class="hdlist1">
1089 --ignore-submodules[=&lt;when&gt;]
1090 </dt>
1091 <dd>
1093 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1094 either "none", "untracked", "dirty" or "all", which is the default
1095 Using "none" will consider the submodule modified when it either contains
1096 untracked or modified files or its HEAD differs from the commit recorded
1097 in the superproject and can be used to override any settings of the
1098 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1099 "untracked" is used submodules are not considered dirty when they only
1100 contain untracked content (but they are still scanned for modified
1101 content). Using "dirty" ignores all changes to the work tree of submodules,
1102 only changes to the commits stored in the superproject are shown (this was
1103 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1104 </p>
1105 </dd>
1106 <dt class="hdlist1">
1107 --src-prefix=&lt;prefix&gt;
1108 </dt>
1109 <dd>
1111 Show the given source prefix instead of "a/".
1112 </p>
1113 </dd>
1114 <dt class="hdlist1">
1115 --dst-prefix=&lt;prefix&gt;
1116 </dt>
1117 <dd>
1119 Show the given destination prefix instead of "b/".
1120 </p>
1121 </dd>
1122 <dt class="hdlist1">
1123 --no-prefix
1124 </dt>
1125 <dd>
1127 Do not show any source or destination prefix.
1128 </p>
1129 </dd>
1130 </dl></div>
1131 <div class="paragraph"><p>For more detailed explanation on these common options, see also
1132 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
1133 <div class="dlist"><dl>
1134 <dt class="hdlist1">
1135 -1 --base
1136 </dt>
1137 <dt class="hdlist1">
1138 -2 --ours
1139 </dt>
1140 <dt class="hdlist1">
1141 -3 --theirs
1142 </dt>
1143 <dt class="hdlist1">
1145 </dt>
1146 <dd>
1148 Diff against the "base" version, "our branch" or "their
1149 branch" respectively. With these options, diffs for
1150 merged entries are not shown.
1151 </p>
1152 <div class="paragraph"><p>The default is to diff against our branch (-2) and the
1153 cleanly resolved paths. The option -0 can be given to
1154 omit diff output for unmerged entries and just show "Unmerged".</p></div>
1155 </dd>
1156 <dt class="hdlist1">
1158 </dt>
1159 <dt class="hdlist1">
1160 --cc
1161 </dt>
1162 <dd>
1164 This compares stage 2 (our branch), stage 3 (their
1165 branch) and the working tree file and outputs a combined
1166 diff, similar to the way <em>diff-tree</em> shows a merge
1167 commit with these flags.
1168 </p>
1169 </dd>
1170 <dt class="hdlist1">
1172 </dt>
1173 <dd>
1175 Remain silent even on nonexistent files
1176 </p>
1177 </dd>
1178 </dl></div>
1179 </div>
1180 <h2 id="_raw_output_format">Raw output format</h2>
1181 <div class="sectionbody">
1182 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
1183 "git-diff-files" and "git diff --raw" are very similar.</p></div>
1184 <div class="paragraph"><p>These commands all compare two sets of things; what is
1185 compared differs:</p></div>
1186 <div class="dlist"><dl>
1187 <dt class="hdlist1">
1188 git-diff-index &lt;tree-ish&gt;
1189 </dt>
1190 <dd>
1192 compares the &lt;tree-ish&gt; and the files on the filesystem.
1193 </p>
1194 </dd>
1195 <dt class="hdlist1">
1196 git-diff-index --cached &lt;tree-ish&gt;
1197 </dt>
1198 <dd>
1200 compares the &lt;tree-ish&gt; and the index.
1201 </p>
1202 </dd>
1203 <dt class="hdlist1">
1204 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1205 </dt>
1206 <dd>
1208 compares the trees named by the two arguments.
1209 </p>
1210 </dd>
1211 <dt class="hdlist1">
1212 git-diff-files [&lt;pattern&gt;&#8230;]
1213 </dt>
1214 <dd>
1216 compares the index and the files on the filesystem.
1217 </p>
1218 </dd>
1219 </dl></div>
1220 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
1221 what is being compared. After that, all the commands print one output
1222 line per changed file.</p></div>
1223 <div class="paragraph"><p>An output line is formatted this way:</p></div>
1224 <div class="listingblock">
1225 <div class="content">
1226 <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1227 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1228 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1229 create :000000 100644 0000000... 1234567... A file4
1230 delete :100644 000000 1234567... 0000000... D file5
1231 unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1232 </div></div>
1233 <div class="paragraph"><p>That is, from the left to the right:</p></div>
1234 <div class="olist arabic"><ol class="arabic">
1235 <li>
1237 a colon.
1238 </p>
1239 </li>
1240 <li>
1242 mode for "src"; 000000 if creation or unmerged.
1243 </p>
1244 </li>
1245 <li>
1247 a space.
1248 </p>
1249 </li>
1250 <li>
1252 mode for "dst"; 000000 if deletion or unmerged.
1253 </p>
1254 </li>
1255 <li>
1257 a space.
1258 </p>
1259 </li>
1260 <li>
1262 sha1 for "src"; 0{40} if creation or unmerged.
1263 </p>
1264 </li>
1265 <li>
1267 a space.
1268 </p>
1269 </li>
1270 <li>
1272 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1273 </p>
1274 </li>
1275 <li>
1277 a space.
1278 </p>
1279 </li>
1280 <li>
1282 status, followed by optional "score" number.
1283 </p>
1284 </li>
1285 <li>
1287 a tab or a NUL when <em>-z</em> option is used.
1288 </p>
1289 </li>
1290 <li>
1292 path for "src"
1293 </p>
1294 </li>
1295 <li>
1297 a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1298 </p>
1299 </li>
1300 <li>
1302 path for "dst"; only exists for C or R.
1303 </p>
1304 </li>
1305 <li>
1307 an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1308 </p>
1309 </li>
1310 </ol></div>
1311 <div class="paragraph"><p>Possible status letters are:</p></div>
1312 <div class="ulist"><ul>
1313 <li>
1315 A: addition of a file
1316 </p>
1317 </li>
1318 <li>
1320 C: copy of a file into a new one
1321 </p>
1322 </li>
1323 <li>
1325 D: deletion of a file
1326 </p>
1327 </li>
1328 <li>
1330 M: modification of the contents or mode of a file
1331 </p>
1332 </li>
1333 <li>
1335 R: renaming of a file
1336 </p>
1337 </li>
1338 <li>
1340 T: change in the type of the file
1341 </p>
1342 </li>
1343 <li>
1345 U: file is unmerged (you must complete the merge before it can
1346 be committed)
1347 </p>
1348 </li>
1349 <li>
1351 X: "unknown" change type (most probably a bug, please report it)
1352 </p>
1353 </li>
1354 </ul></div>
1355 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
1356 percentage of similarity between the source and target of the move or
1357 copy), and are the only ones to be so.</p></div>
1358 <div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
1359 and it is out of sync with the index.</p></div>
1360 <div class="paragraph"><p>Example:</p></div>
1361 <div class="listingblock">
1362 <div class="content">
1363 <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
1364 </div></div>
1365 <div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
1366 in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
1367 respectively.</p></div>
1368 </div>
1369 <h2 id="_diff_format_for_merges">diff format for merges</h2>
1370 <div class="sectionbody">
1371 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
1372 can take <em>-c</em> or <em>--cc</em> option
1373 to generate diff output also for merge commits. The output differs
1374 from the format described above in the following way:</p></div>
1375 <div class="olist arabic"><ol class="arabic">
1376 <li>
1378 there is a colon for each parent
1379 </p>
1380 </li>
1381 <li>
1383 there are more "src" modes and "src" sha1
1384 </p>
1385 </li>
1386 <li>
1388 status is concatenated status characters for each parent
1389 </p>
1390 </li>
1391 <li>
1393 no optional "score" number
1394 </p>
1395 </li>
1396 <li>
1398 single path, only for "dst"
1399 </p>
1400 </li>
1401 </ol></div>
1402 <div class="paragraph"><p>Example:</p></div>
1403 <div class="listingblock">
1404 <div class="content">
1405 <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
1406 </div></div>
1407 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
1408 all parents.</p></div>
1409 </div>
1410 <h2 id="_generating_patches_with_p">Generating patches with -p</h2>
1411 <div class="sectionbody">
1412 <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1413 with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
1414 "git log" with the "-p" option, they
1415 do not produce the output described above; instead they produce a
1416 patch file. You can customize the creation of such patches via the
1417 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
1418 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
1419 diff format:</p></div>
1420 <div class="olist arabic"><ol class="arabic">
1421 <li>
1423 It is preceded with a "git diff" header that looks like this:
1424 </p>
1425 <div class="literalblock">
1426 <div class="content">
1427 <pre><tt>diff --git a/file1 b/file2</tt></pre>
1428 </div></div>
1429 <div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
1430 involved. Especially, even for a creation or a deletion,
1431 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
1432 <div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
1433 name of the source file of the rename/copy and the name of
1434 the file that rename/copy produces, respectively.</p></div>
1435 </li>
1436 <li>
1438 It is followed by one or more extended header lines:
1439 </p>
1440 <div class="literalblock">
1441 <div class="content">
1442 <pre><tt>old mode &lt;mode&gt;
1443 new mode &lt;mode&gt;
1444 deleted file mode &lt;mode&gt;
1445 new file mode &lt;mode&gt;
1446 copy from &lt;path&gt;
1447 copy to &lt;path&gt;
1448 rename from &lt;path&gt;
1449 rename to &lt;path&gt;
1450 similarity index &lt;number&gt;
1451 dissimilarity index &lt;number&gt;
1452 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
1453 </div></div>
1454 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
1455 and file permission bits.</p></div>
1456 <div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
1457 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
1458 the dissimilarity index is the percentage of changed lines. It
1459 is a rounded down integer, followed by a percent sign. The
1460 similarity index value of 100% is thus reserved for two equal
1461 files, while 100% dissimilarity means that no line from the old
1462 file made it into the new one.</p></div>
1463 <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
1464 The &lt;mode&gt; is included if the file mode does not change; otherwise,
1465 separate lines indicate the old and the new mode.</p></div>
1466 </li>
1467 <li>
1469 TAB, LF, double quote and backslash characters in pathnames
1470 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
1471 If there is need for such substitution then the whole
1472 pathname is put in double quotes.
1473 </p>
1474 </li>
1475 <li>
1477 All the <tt>file1</tt> files in the output refer to files before the
1478 commit, and all the <tt>file2</tt> files refer to files after the commit.
1479 It is incorrect to apply each change to each file sequentially. For
1480 example, this patch will swap a and b:
1481 </p>
1482 <div class="literalblock">
1483 <div class="content">
1484 <pre><tt>diff --git a/a b/b
1485 rename from a
1486 rename to b
1487 diff --git a/b b/a
1488 rename from b
1489 rename to a</tt></pre>
1490 </div></div>
1491 </li>
1492 </ol></div>
1493 </div>
1494 <h2 id="_combined_diff_format">combined diff format</h2>
1495 <div class="sectionbody">
1496 <div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
1497 produce a <em>combined diff</em> when showing a merge. This is the default
1498 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
1499 <a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
1500 of these commands to force generation of diffs with individual parents
1501 of a merge.</p></div>
1502 <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
1503 <div class="listingblock">
1504 <div class="content">
1505 <pre><tt>diff --combined describe.c
1506 index fabadb8,cc95eb0..4866510
1507 --- a/describe.c
1508 +++ b/describe.c
1509 @@@ -98,20 -98,12 +98,20 @@@
1510 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1513 - static void describe(char *arg)
1514 -static void describe(struct commit *cmit, int last_one)
1515 ++static void describe(char *arg, int last_one)
1517 + unsigned char sha1[20];
1518 + struct commit *cmit;
1519 struct commit_list *list;
1520 static int initialized = 0;
1521 struct commit_name *n;
1523 + if (get_sha1(arg, sha1) &lt; 0)
1524 + usage(describe_usage);
1525 + cmit = lookup_commit_reference(sha1);
1526 + if (!cmit)
1527 + usage(describe_usage);
1529 if (!initialized) {
1530 initialized = 1;
1531 for_each_ref(get_name);</tt></pre>
1532 </div></div>
1533 <div class="olist arabic"><ol class="arabic">
1534 <li>
1536 It is preceded with a "git diff" header, that looks like
1537 this (when <em>-c</em> option is used):
1538 </p>
1539 <div class="literalblock">
1540 <div class="content">
1541 <pre><tt>diff --combined file</tt></pre>
1542 </div></div>
1543 <div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
1544 <div class="literalblock">
1545 <div class="content">
1546 <pre><tt>diff --cc file</tt></pre>
1547 </div></div>
1548 </li>
1549 <li>
1551 It is followed by one or more extended header lines
1552 (this example shows a merge with two parents):
1553 </p>
1554 <div class="literalblock">
1555 <div class="content">
1556 <pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
1557 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
1558 new file mode &lt;mode&gt;
1559 deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
1560 </div></div>
1561 <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
1562 the &lt;mode&gt; is different from the rest. Extended headers with
1563 information about detected contents movement (renames and
1564 copying detection) are designed to work with diff of two
1565 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
1566 </li>
1567 <li>
1569 It is followed by two-line from-file/to-file header
1570 </p>
1571 <div class="literalblock">
1572 <div class="content">
1573 <pre><tt>--- a/file
1574 +++ b/file</tt></pre>
1575 </div></div>
1576 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
1577 format, <tt>/dev/null</tt> is used to signal created or deleted
1578 files.</p></div>
1579 </li>
1580 <li>
1582 Chunk header format is modified to prevent people from
1583 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
1584 was created for review of merge commit changes, and was not
1585 meant for apply. The change is similar to the change in the
1586 extended <em>index</em> header:
1587 </p>
1588 <div class="literalblock">
1589 <div class="content">
1590 <pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
1591 </div></div>
1592 <div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
1593 header for combined diff format.</p></div>
1594 </li>
1595 </ol></div>
1596 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
1597 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
1598 added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
1599 compares two or more files file1, file2,&#8230; with one file X, and
1600 shows how X differs from each of fileN. One column for each of
1601 fileN is prepended to the output line to note how X&#8217;s line is
1602 different from it.</p></div>
1603 <div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
1604 fileN but it does not appear in the result. A <tt>+</tt> character
1605 in the column N means that the line appears in the result,
1606 and fileN does not have that line (in other words, the line was
1607 added, from the point of view of that parent).</p></div>
1608 <div class="paragraph"><p>In the above example output, the function signature was changed
1609 from both files (hence two <tt>-</tt> removals from both file1 and
1610 file2, plus <tt>++</tt> to mean one line that was added does not appear
1611 in either file1 nor file2). Also eight other lines are the same
1612 from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
1613 <div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
1614 merge commit with the merge result (i.e. file1..fileN are the
1615 parents). When shown by <tt>git diff-files -c</tt>, it compares the
1616 two unresolved merge parents with the working tree file
1617 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
1618 "their version").</p></div>
1619 </div>
1620 <h2 id="_other_diff_formats">other diff formats</h2>
1621 <div class="sectionbody">
1622 <div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
1623 copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
1624 output. These options can be combined with other options, such as
1625 <tt>-p</tt>, and are meant for human consumption.</p></div>
1626 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
1627 formats the pathnames compactly by combining common prefix and suffix of
1628 the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
1629 <tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
1630 <div class="listingblock">
1631 <div class="content">
1632 <pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
1633 </div></div>
1634 <div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
1635 for easier machine consumption. An entry in <tt>--numstat</tt> output looks
1636 like this:</p></div>
1637 <div class="listingblock">
1638 <div class="content">
1639 <pre><tt>1 2 README
1640 3 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
1641 </div></div>
1642 <div class="paragraph"><p>That is, from left to right:</p></div>
1643 <div class="olist arabic"><ol class="arabic">
1644 <li>
1646 the number of added lines;
1647 </p>
1648 </li>
1649 <li>
1651 a tab;
1652 </p>
1653 </li>
1654 <li>
1656 the number of deleted lines;
1657 </p>
1658 </li>
1659 <li>
1661 a tab;
1662 </p>
1663 </li>
1664 <li>
1666 pathname (possibly with rename/copy information);
1667 </p>
1668 </li>
1669 <li>
1671 a newline.
1672 </p>
1673 </li>
1674 </ol></div>
1675 <div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
1676 <div class="listingblock">
1677 <div class="content">
1678 <pre><tt>1 2 README NUL
1679 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
1680 </div></div>
1681 <div class="paragraph"><p>That is:</p></div>
1682 <div class="olist arabic"><ol class="arabic">
1683 <li>
1685 the number of added lines;
1686 </p>
1687 </li>
1688 <li>
1690 a tab;
1691 </p>
1692 </li>
1693 <li>
1695 the number of deleted lines;
1696 </p>
1697 </li>
1698 <li>
1700 a tab;
1701 </p>
1702 </li>
1703 <li>
1705 a NUL (only exists if renamed/copied);
1706 </p>
1707 </li>
1708 <li>
1710 pathname in preimage;
1711 </p>
1712 </li>
1713 <li>
1715 a NUL (only exists if renamed/copied);
1716 </p>
1717 </li>
1718 <li>
1720 pathname in postimage (only exists if renamed/copied);
1721 </p>
1722 </li>
1723 <li>
1725 a NUL.
1726 </p>
1727 </li>
1728 </ol></div>
1729 <div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
1730 scripts that read the output to tell if the current record being read is
1731 a single-path record or a rename/copy record without reading ahead.
1732 After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
1733 the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
1734 </div>
1735 <h2 id="_git">GIT</h2>
1736 <div class="sectionbody">
1737 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1738 </div>
1739 <div id="footer">
1740 <div id="footer-text">
1741 Last updated 2011-03-15 23:30:13 UTC
1742 </div>
1743 </div>
1744 </body>
1745 </html>