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