Autogenerated HTML docs for v1.7.7-325-g05f6ed
[git/jnareb-git.git] / git-diff-files.html
blob7a233bb9b8afbe02a2695cb896e775b8262f3066
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.5.2" />
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.0em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
131 div.content { /* Block element content. */
132 padding: 0;
135 /* Block element titles. */
136 div.title, caption.title {
137 color: #527bbd;
138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
144 div.title + * {
145 margin-top: 0;
148 td div.title:first-child {
149 margin-top: 0.0em;
151 div.content div.title:first-child {
152 margin-top: 0.0em;
154 div.content + div.title {
155 margin-top: 0.0em;
158 div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
164 div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
170 div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
173 margin-right: 10%;
174 border-left: 5px solid #dddddd;
175 color: #777777;
178 div.quoteblock > div.attribution {
179 padding-top: 0.5em;
180 text-align: right;
183 div.verseblock > div.content {
184 white-space: pre;
186 div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div.verseblock + div.attribution {
192 text-align: left;
195 div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
203 div.admonitionblock td.content {
204 padding-left: 0.5em;
205 border-left: 3px solid #dddddd;
208 div.exampleblock > div.content {
209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
213 div.imageblock div.content { padding-left: 0; }
214 span.image img { border-style: none; }
215 a.image:visited { color: white; }
217 dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
221 dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
224 font-style: normal;
225 color: navy;
227 dd > *:first-child {
228 margin-top: 0.1em;
231 ul, ol {
232 list-style-position: outside;
234 ol.arabic {
235 list-style-type: decimal;
237 ol.loweralpha {
238 list-style-type: lower-alpha;
240 ol.upperalpha {
241 list-style-type: upper-alpha;
243 ol.lowerroman {
244 list-style-type: lower-roman;
246 ol.upperroman {
247 list-style-type: upper-roman;
250 div.compact ul, div.compact ol,
251 div.compact p, div.compact p,
252 div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
257 div.tableblock > table {
258 border: 3px solid #527bbd;
260 thead, p.table.header {
261 font-family: sans-serif;
262 font-weight: bold;
264 tfoot {
265 font-weight: bold;
267 td > div.verse {
268 white-space: pre;
270 p.table {
271 margin-top: 0;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div.tableblock > table[frame="void"] {
275 border-style: none;
277 div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
281 div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
287 div.hdlist {
288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
291 div.hdlist tr {
292 padding-bottom: 15px;
294 dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
297 td.hdlist1 {
298 vertical-align: top;
299 font-style: normal;
300 padding-right: 0.8em;
301 color: navy;
303 td.hdlist2 {
304 vertical-align: top;
306 div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
311 .comment {
312 background: yellow;
315 .footnote, .footnoteref {
316 font-size: 0.8em;
319 span.footnote, span.footnoteref {
320 vertical-align: super;
323 #footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
328 #footnotes div.footnote {
329 margin: 0 0 5px 0;
332 #footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
343 @media print {
344 div#footer-badges { display: none; }
347 div#toc {
348 margin-bottom: 2.5em;
351 div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
376 /* Overrides for manpage documents */
377 h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
383 h2 {
384 border-style: none;
386 div.sectionbody {
387 margin-left: 5%;
390 @media print {
391 div#toc { display: none; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
401 div.sidebar-title, div.image-title {
402 color: #527bbd;
403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
409 div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
415 div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
420 div.verseblock-content {
421 white-space: pre;
423 div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
428 div.exampleblock-content {
429 border-left: 3px solid #dddddd;
430 padding-left: 0.5em;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc a:visited { color: blue; }
435 </style>
436 <script type="text/javascript">
437 /*<![CDATA[*/
438 window.onload = function(){asciidoc.footnotes();}
439 var asciidoc = { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
449 * Version: 0.4
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
458 // toclevels = 1..4.
459 toc: function (toclevels) {
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
469 return text;
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
491 iterate(i);
495 iterate(el);
496 return result;
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
567 /*]]>*/
568 </script>
569 </head>
570 <body>
571 <div id="header">
572 <h1>
573 git-diff-files(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-diff-files -
578 Compares files in the working tree and the index
579 </p>
580 </div>
581 </div>
582 <div id="content">
583 <h2 id="_synopsis">SYNOPSIS</h2>
584 <div class="sectionbody">
585 <div class="verseblock">
586 <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>
587 <div class="verseblock-attribution">
588 </div></div>
589 </div>
590 <h2 id="_description">DESCRIPTION</h2>
591 <div class="sectionbody">
592 <div class="paragraph"><p>Compares the files in the working tree and the index. When paths
593 are specified, compares only those named paths. Otherwise all
594 entries in the index are compared. The output format is the
595 same as for <em>git diff-index</em> and <em>git diff-tree</em>.</p></div>
596 </div>
597 <h2 id="_options">OPTIONS</h2>
598 <div class="sectionbody">
599 <div class="dlist"><dl>
600 <dt class="hdlist1">
602 </dt>
603 <dt class="hdlist1">
605 </dt>
606 <dt class="hdlist1">
607 --patch
608 </dt>
609 <dd>
611 Generate patch (see section on generating patches).
613 </p>
614 </dd>
615 <dt class="hdlist1">
616 -U&lt;n&gt;
617 </dt>
618 <dt class="hdlist1">
619 --unified=&lt;n&gt;
620 </dt>
621 <dd>
623 Generate diffs with &lt;n&gt; lines of context instead of
624 the usual three.
625 Implies <tt>-p</tt>.
626 </p>
627 </dd>
628 <dt class="hdlist1">
629 --raw
630 </dt>
631 <dd>
633 Generate the raw format.
634 This is the default.
635 </p>
636 </dd>
637 <dt class="hdlist1">
638 --patch-with-raw
639 </dt>
640 <dd>
642 Synonym for <tt>-p --raw</tt>.
643 </p>
644 </dd>
645 <dt class="hdlist1">
646 --minimal
647 </dt>
648 <dd>
650 Spend extra time to make sure the smallest possible
651 diff is produced.
652 </p>
653 </dd>
654 <dt class="hdlist1">
655 --patience
656 </dt>
657 <dd>
659 Generate a diff using the "patience diff" algorithm.
660 </p>
661 </dd>
662 <dt class="hdlist1">
663 --stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
664 </dt>
665 <dd>
667 Generate a diffstat. You can override the default
668 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
669 The width of the filename part can be controlled by
670 giving another width to it separated by a comma.
671 By giving a third parameter <tt>&lt;count&gt;</tt>, you can limit the
672 output to the first <tt>&lt;count&gt;</tt> lines, followed by
673 <tt>&#8230;</tt> if there are more.
674 </p>
675 <div class="paragraph"><p>These parameters can also be set individually with <tt>--stat-width=&lt;width&gt;</tt>,
676 <tt>--stat-name-width=&lt;name-width&gt;</tt> and <tt>--stat-count=&lt;count&gt;</tt>.</p></div>
677 </dd>
678 <dt class="hdlist1">
679 --numstat
680 </dt>
681 <dd>
683 Similar to <tt>--stat</tt>, but shows number of added and
684 deleted lines in decimal notation and pathname without
685 abbreviation, to make it more machine friendly. For
686 binary files, outputs two <tt>-</tt> instead of saying
687 <tt>0 0</tt>.
688 </p>
689 </dd>
690 <dt class="hdlist1">
691 --shortstat
692 </dt>
693 <dd>
695 Output only the last line of the <tt>--stat</tt> format containing total
696 number of modified files, as well as number of added and deleted
697 lines.
698 </p>
699 </dd>
700 <dt class="hdlist1">
701 --dirstat[=&lt;param1,param2,&#8230;&gt;]
702 </dt>
703 <dd>
705 Output the distribution of relative amount of changes for each
706 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
707 passing it a comma separated list of parameters.
708 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
709 variable (see <a href="git-config.html">git-config(1)</a>).
710 The following parameters are available:
711 </p>
712 <div class="dlist"><dl>
713 <dt class="hdlist1">
714 <tt>changes</tt>
715 </dt>
716 <dd>
718 Compute the dirstat numbers by counting the lines that have been
719 removed from the source, or added to the destination. This ignores
720 the amount of pure code movements within a file. In other words,
721 rearranging lines in a file is not counted as much as other changes.
722 This is the default behavior when no parameter is given.
723 </p>
724 </dd>
725 <dt class="hdlist1">
726 <tt>lines</tt>
727 </dt>
728 <dd>
730 Compute the dirstat numbers by doing the regular line-based diff
731 analysis, and summing the removed/added line counts. (For binary
732 files, count 64-byte chunks instead, since binary files have no
733 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
734 behavior than the <tt>changes</tt> behavior, but it does count rearranged
735 lines within a file as much as other changes. The resulting output
736 is consistent with what you get from the other <tt>--*stat</tt> options.
737 </p>
738 </dd>
739 <dt class="hdlist1">
740 <tt>files</tt>
741 </dt>
742 <dd>
744 Compute the dirstat numbers by counting the number of files changed.
745 Each changed file counts equally in the dirstat analysis. This is
746 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
747 not have to look at the file contents at all.
748 </p>
749 </dd>
750 <dt class="hdlist1">
751 <tt>cumulative</tt>
752 </dt>
753 <dd>
755 Count changes in a child directory for the parent directory as well.
756 Note that when using <tt>cumulative</tt>, the sum of the percentages
757 reported may exceed 100%. The default (non-cumulative) behavior can
758 be specified with the <tt>noncumulative</tt> parameter.
759 </p>
760 </dd>
761 <dt class="hdlist1">
762 &lt;limit&gt;
763 </dt>
764 <dd>
766 An integer parameter specifies a cut-off percent (3% by default).
767 Directories contributing less than this percentage of the changes
768 are not shown in the output.
769 </p>
770 </dd>
771 </dl></div>
772 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
773 directories with less than 10% of the total amount of changed files,
774 and accumulating child directory counts in the parent directories:
775 <tt>--dirstat=files,10,cumulative</tt>.</p></div>
776 </dd>
777 <dt class="hdlist1">
778 --summary
779 </dt>
780 <dd>
782 Output a condensed summary of extended header information
783 such as creations, renames and mode changes.
784 </p>
785 </dd>
786 <dt class="hdlist1">
787 --patch-with-stat
788 </dt>
789 <dd>
791 Synonym for <tt>-p --stat</tt>.
792 </p>
793 </dd>
794 <dt class="hdlist1">
796 </dt>
797 <dd>
799 When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been
800 given, do not munge pathnames and use NULs as output field terminators.
801 </p>
802 <div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
803 and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
804 respectively, and the pathname will be enclosed in double quotes if
805 any of those replacements occurred.</p></div>
806 </dd>
807 <dt class="hdlist1">
808 --name-only
809 </dt>
810 <dd>
812 Show only names of changed files.
813 </p>
814 </dd>
815 <dt class="hdlist1">
816 --name-status
817 </dt>
818 <dd>
820 Show only names and status of changed files. See the description
821 of the <tt>--diff-filter</tt> option on what the status letters mean.
822 </p>
823 </dd>
824 <dt class="hdlist1">
825 --submodule[=&lt;format&gt;]
826 </dt>
827 <dd>
829 Chose the output format for submodule differences. &lt;format&gt; can be one of
830 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
831 is used when this option is not given. <em>log</em> is the default value for this
832 option and lists the commits in that commit range like the <em>summary</em>
833 option of <a href="git-submodule.html">git-submodule(1)</a> does.
834 </p>
835 </dd>
836 <dt class="hdlist1">
837 --color[=&lt;when&gt;]
838 </dt>
839 <dd>
841 Show colored diff.
842 The value must be <tt>always</tt> (the default for <tt>&lt;when&gt;</tt>), <tt>never</tt>, or <tt>auto</tt>.
843 The default value is <tt>never</tt>.
844 </p>
845 </dd>
846 <dt class="hdlist1">
847 --no-color
848 </dt>
849 <dd>
851 Turn off colored diff.
852 It is the same as <tt>--color=never</tt>.
853 </p>
854 </dd>
855 <dt class="hdlist1">
856 --word-diff[=&lt;mode&gt;]
857 </dt>
858 <dd>
860 Show a word diff, using the &lt;mode&gt; to delimit changed words.
861 By default, words are delimited by whitespace; see
862 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
863 must be one of:
864 </p>
865 <div class="dlist"><dl>
866 <dt class="hdlist1">
867 color
868 </dt>
869 <dd>
871 Highlight changed words using only colors. Implies <tt>--color</tt>.
872 </p>
873 </dd>
874 <dt class="hdlist1">
875 plain
876 </dt>
877 <dd>
879 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
880 attempts to escape the delimiters if they appear in the input,
881 so the output may be ambiguous.
882 </p>
883 </dd>
884 <dt class="hdlist1">
885 porcelain
886 </dt>
887 <dd>
889 Use a special line-based format intended for script
890 consumption. Added/removed/unchanged runs are printed in the
891 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
892 character at the beginning of the line and extending to the
893 end of the line. Newlines in the input are represented by a
894 tilde <tt>~</tt> on a line of its own.
895 </p>
896 </dd>
897 <dt class="hdlist1">
898 none
899 </dt>
900 <dd>
902 Disable word diff again.
903 </p>
904 </dd>
905 </dl></div>
906 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
907 highlight the changed parts in all modes if enabled.</p></div>
908 </dd>
909 <dt class="hdlist1">
910 --word-diff-regex=&lt;regex&gt;
911 </dt>
912 <dd>
914 Use &lt;regex&gt; to decide what a word is, instead of considering
915 runs of non-whitespace to be a word. Also implies
916 <tt>--word-diff</tt> unless it was already enabled.
917 </p>
918 <div class="paragraph"><p>Every non-overlapping match of the
919 &lt;regex&gt; is considered a word. Anything between these matches is
920 considered whitespace and ignored(!) for the purposes of finding
921 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
922 expression to make sure that it matches all non-whitespace characters.
923 A match that contains a newline is silently truncated(!) at the
924 newline.</p></div>
925 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
926 <a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
927 overrides any diff driver or configuration setting. Diff drivers
928 override configuration settings.</p></div>
929 </dd>
930 <dt class="hdlist1">
931 --color-words[=&lt;regex&gt;]
932 </dt>
933 <dd>
935 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
936 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
937 </p>
938 </dd>
939 <dt class="hdlist1">
940 --no-renames
941 </dt>
942 <dd>
944 Turn off rename detection, even when the configuration
945 file gives the default to do so.
946 </p>
947 </dd>
948 <dt class="hdlist1">
949 --check
950 </dt>
951 <dd>
953 Warn if changes introduce whitespace errors. What are
954 considered whitespace errors is controlled by <tt>core.whitespace</tt>
955 configuration. By default, trailing whitespaces (including
956 lines that solely consist of whitespaces) and a space character
957 that is immediately followed by a tab character inside the
958 initial indent of the line are considered whitespace errors.
959 Exits with non-zero status if problems are found. Not compatible
960 with --exit-code.
961 </p>
962 </dd>
963 <dt class="hdlist1">
964 --full-index
965 </dt>
966 <dd>
968 Instead of the first handful of characters, show the full
969 pre- and post-image blob object names on the "index"
970 line when generating patch format output.
971 </p>
972 </dd>
973 <dt class="hdlist1">
974 --binary
975 </dt>
976 <dd>
978 In addition to <tt>--full-index</tt>, output a binary diff that
979 can be applied with <tt>git-apply</tt>.
980 </p>
981 </dd>
982 <dt class="hdlist1">
983 --abbrev[=&lt;n&gt;]
984 </dt>
985 <dd>
987 Instead of showing the full 40-byte hexadecimal object
988 name in diff-raw format output and diff-tree header
989 lines, show only a partial prefix. This is
990 independent of the <tt>--full-index</tt> option above, which controls
991 the diff-patch output format. Non default number of
992 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
993 </p>
994 </dd>
995 <dt class="hdlist1">
996 -B[&lt;n&gt;][/&lt;m&gt;]
997 </dt>
998 <dt class="hdlist1">
999 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1000 </dt>
1001 <dd>
1003 Break complete rewrite changes into pairs of delete and
1004 create. This serves two purposes:
1005 </p>
1006 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
1007 not as a series of deletion and insertion mixed together with a very
1008 few lines that happen to match textually as the context, but as a
1009 single deletion of everything old followed by a single insertion of
1010 everything new, and the number <tt>m</tt> controls this aspect of the -B
1011 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
1012 original should remain in the result for git to consider it a total
1013 rewrite (i.e. otherwise the resulting patch will be a series of
1014 deletion and insertion mixed together with context lines).</p></div>
1015 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
1016 source of a rename (usually -M only considers a file that disappeared
1017 as the source of a rename), and the number <tt>n</tt> controls this aspect of
1018 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
1019 addition and deletion compared to 20% or more of the file&#8217;s size are
1020 eligible for being picked up as a possible source of a rename to
1021 another file.</p></div>
1022 </dd>
1023 <dt class="hdlist1">
1024 -M[&lt;n&gt;]
1025 </dt>
1026 <dt class="hdlist1">
1027 --find-renames[=&lt;n&gt;]
1028 </dt>
1029 <dd>
1031 Detect renames.
1032 If <tt>n</tt> is specified, it is a threshold on the similarity
1033 index (i.e. amount of addition/deletions compared to the
1034 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
1035 delete/add pair to be a rename if more than 90% of the file
1036 hasn&#8217;t changed.
1037 </p>
1038 </dd>
1039 <dt class="hdlist1">
1040 -C[&lt;n&gt;]
1041 </dt>
1042 <dt class="hdlist1">
1043 --find-copies[=&lt;n&gt;]
1044 </dt>
1045 <dd>
1047 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
1048 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
1049 </p>
1050 </dd>
1051 <dt class="hdlist1">
1052 --find-copies-harder
1053 </dt>
1054 <dd>
1056 For performance reasons, by default, <tt>-C</tt> option finds copies only
1057 if the original file of the copy was modified in the same
1058 changeset. This flag makes the command
1059 inspect unmodified files as candidates for the source of
1060 copy. This is a very expensive operation for large
1061 projects, so use it with caution. Giving more than one
1062 <tt>-C</tt> option has the same effect.
1063 </p>
1064 </dd>
1065 <dt class="hdlist1">
1067 </dt>
1068 <dt class="hdlist1">
1069 --irreversible-delete
1070 </dt>
1071 <dd>
1073 Omit the preimage for deletes, i.e. print only the header but not
1074 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
1075 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
1076 solely for people who want to just concentrate on reviewing the
1077 text after the change. In addition, the output obviously lack
1078 enough information to apply such a patch in reverse, even manually,
1079 hence the name of the option.
1080 </p>
1081 <div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
1082 of a delete/create pair.</p></div>
1083 </dd>
1084 <dt class="hdlist1">
1085 -l&lt;num&gt;
1086 </dt>
1087 <dd>
1089 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
1090 is the number of potential rename/copy targets. This
1091 option prevents rename/copy detection from running if
1092 the number of rename/copy targets exceeds the specified
1093 number.
1094 </p>
1095 </dd>
1096 <dt class="hdlist1">
1097 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1098 </dt>
1099 <dd>
1101 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
1102 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
1103 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
1104 are Unmerged (<tt>U</tt>), are
1105 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
1106 Any combination of the filter characters (including none) can be used.
1107 When <tt>*</tt> (All-or-none) is added to the combination, all
1108 paths are selected if there is any file that matches
1109 other criteria in the comparison; if there is no file
1110 that matches other criteria, nothing is selected.
1111 </p>
1112 </dd>
1113 <dt class="hdlist1">
1114 -S&lt;string&gt;
1115 </dt>
1116 <dd>
1118 Look for differences that introduce or remove an instance of
1119 &lt;string&gt;. Note that this is different than the string simply
1120 appearing in diff output; see the <em>pickaxe</em> entry in
1121 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
1122 </p>
1123 </dd>
1124 <dt class="hdlist1">
1125 -G&lt;regex&gt;
1126 </dt>
1127 <dd>
1129 Look for differences whose added or removed line matches
1130 the given &lt;regex&gt;.
1131 </p>
1132 </dd>
1133 <dt class="hdlist1">
1134 --pickaxe-all
1135 </dt>
1136 <dd>
1138 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
1139 changeset, not just the files that contain the change
1140 in &lt;string&gt;.
1141 </p>
1142 </dd>
1143 <dt class="hdlist1">
1144 --pickaxe-regex
1145 </dt>
1146 <dd>
1148 Make the &lt;string&gt; not a plain string but an extended POSIX
1149 regex to match.
1150 </p>
1151 </dd>
1152 <dt class="hdlist1">
1153 -O&lt;orderfile&gt;
1154 </dt>
1155 <dd>
1157 Output the patch in the order specified in the
1158 &lt;orderfile&gt;, which has one shell glob pattern per line.
1159 </p>
1160 </dd>
1161 <dt class="hdlist1">
1163 </dt>
1164 <dd>
1166 Swap two inputs; that is, show differences from index or
1167 on-disk file to tree contents.
1168 </p>
1169 </dd>
1170 <dt class="hdlist1">
1171 --relative[=&lt;path&gt;]
1172 </dt>
1173 <dd>
1175 When run from a subdirectory of the project, it can be
1176 told to exclude changes outside the directory and show
1177 pathnames relative to it with this option. When you are
1178 not in a subdirectory (e.g. in a bare repository), you
1179 can name which subdirectory to make the output relative
1180 to by giving a &lt;path&gt; as an argument.
1181 </p>
1182 </dd>
1183 <dt class="hdlist1">
1185 </dt>
1186 <dt class="hdlist1">
1187 --text
1188 </dt>
1189 <dd>
1191 Treat all files as text.
1192 </p>
1193 </dd>
1194 <dt class="hdlist1">
1195 --ignore-space-at-eol
1196 </dt>
1197 <dd>
1199 Ignore changes in whitespace at EOL.
1200 </p>
1201 </dd>
1202 <dt class="hdlist1">
1204 </dt>
1205 <dt class="hdlist1">
1206 --ignore-space-change
1207 </dt>
1208 <dd>
1210 Ignore changes in amount of whitespace. This ignores whitespace
1211 at line end, and considers all other sequences of one or
1212 more whitespace characters to be equivalent.
1213 </p>
1214 </dd>
1215 <dt class="hdlist1">
1217 </dt>
1218 <dt class="hdlist1">
1219 --ignore-all-space
1220 </dt>
1221 <dd>
1223 Ignore whitespace when comparing lines. This ignores
1224 differences even if one line has whitespace where the other
1225 line has none.
1226 </p>
1227 </dd>
1228 <dt class="hdlist1">
1229 --inter-hunk-context=&lt;lines&gt;
1230 </dt>
1231 <dd>
1233 Show the context between diff hunks, up to the specified number
1234 of lines, thereby fusing hunks that are close to each other.
1235 </p>
1236 </dd>
1237 <dt class="hdlist1">
1238 --exit-code
1239 </dt>
1240 <dd>
1242 Make the program exit with codes similar to diff(1).
1243 That is, it exits with 1 if there were differences and
1244 0 means no differences.
1245 </p>
1246 </dd>
1247 <dt class="hdlist1">
1248 --quiet
1249 </dt>
1250 <dd>
1252 Disable all output of the program. Implies <tt>--exit-code</tt>.
1253 </p>
1254 </dd>
1255 <dt class="hdlist1">
1256 --ext-diff
1257 </dt>
1258 <dd>
1260 Allow an external diff helper to be executed. If you set an
1261 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1262 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1263 </p>
1264 </dd>
1265 <dt class="hdlist1">
1266 --no-ext-diff
1267 </dt>
1268 <dd>
1270 Disallow external diff drivers.
1271 </p>
1272 </dd>
1273 <dt class="hdlist1">
1274 --textconv
1275 </dt>
1276 <dt class="hdlist1">
1277 --no-textconv
1278 </dt>
1279 <dd>
1281 Allow (or disallow) external text conversion filters to be run
1282 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1283 details. Because textconv filters are typically a one-way
1284 conversion, the resulting diff is suitable for human
1285 consumption, but cannot be applied. For this reason, textconv
1286 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1287 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1288 diff plumbing commands.
1289 </p>
1290 </dd>
1291 <dt class="hdlist1">
1292 --ignore-submodules[=&lt;when&gt;]
1293 </dt>
1294 <dd>
1296 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1297 either "none", "untracked", "dirty" or "all", which is the default
1298 Using "none" will consider the submodule modified when it either contains
1299 untracked or modified files or its HEAD differs from the commit recorded
1300 in the superproject and can be used to override any settings of the
1301 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1302 "untracked" is used submodules are not considered dirty when they only
1303 contain untracked content (but they are still scanned for modified
1304 content). Using "dirty" ignores all changes to the work tree of submodules,
1305 only changes to the commits stored in the superproject are shown (this was
1306 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1307 </p>
1308 </dd>
1309 <dt class="hdlist1">
1310 --src-prefix=&lt;prefix&gt;
1311 </dt>
1312 <dd>
1314 Show the given source prefix instead of "a/".
1315 </p>
1316 </dd>
1317 <dt class="hdlist1">
1318 --dst-prefix=&lt;prefix&gt;
1319 </dt>
1320 <dd>
1322 Show the given destination prefix instead of "b/".
1323 </p>
1324 </dd>
1325 <dt class="hdlist1">
1326 --no-prefix
1327 </dt>
1328 <dd>
1330 Do not show any source or destination prefix.
1331 </p>
1332 </dd>
1333 </dl></div>
1334 <div class="paragraph"><p>For more detailed explanation on these common options, see also
1335 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
1336 <div class="dlist"><dl>
1337 <dt class="hdlist1">
1338 -1 --base
1339 </dt>
1340 <dt class="hdlist1">
1341 -2 --ours
1342 </dt>
1343 <dt class="hdlist1">
1344 -3 --theirs
1345 </dt>
1346 <dt class="hdlist1">
1348 </dt>
1349 <dd>
1351 Diff against the "base" version, "our branch" or "their
1352 branch" respectively. With these options, diffs for
1353 merged entries are not shown.
1354 </p>
1355 <div class="paragraph"><p>The default is to diff against our branch (-2) and the
1356 cleanly resolved paths. The option -0 can be given to
1357 omit diff output for unmerged entries and just show "Unmerged".</p></div>
1358 </dd>
1359 <dt class="hdlist1">
1361 </dt>
1362 <dt class="hdlist1">
1363 --cc
1364 </dt>
1365 <dd>
1367 This compares stage 2 (our branch), stage 3 (their
1368 branch) and the working tree file and outputs a combined
1369 diff, similar to the way <em>diff-tree</em> shows a merge
1370 commit with these flags.
1371 </p>
1372 </dd>
1373 <dt class="hdlist1">
1375 </dt>
1376 <dd>
1378 Remain silent even on nonexistent files
1379 </p>
1380 </dd>
1381 </dl></div>
1382 </div>
1383 <h2 id="_raw_output_format">Raw output format</h2>
1384 <div class="sectionbody">
1385 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
1386 "git-diff-files" and "git diff --raw" are very similar.</p></div>
1387 <div class="paragraph"><p>These commands all compare two sets of things; what is
1388 compared differs:</p></div>
1389 <div class="dlist"><dl>
1390 <dt class="hdlist1">
1391 git-diff-index &lt;tree-ish&gt;
1392 </dt>
1393 <dd>
1395 compares the &lt;tree-ish&gt; and the files on the filesystem.
1396 </p>
1397 </dd>
1398 <dt class="hdlist1">
1399 git-diff-index --cached &lt;tree-ish&gt;
1400 </dt>
1401 <dd>
1403 compares the &lt;tree-ish&gt; and the index.
1404 </p>
1405 </dd>
1406 <dt class="hdlist1">
1407 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1408 </dt>
1409 <dd>
1411 compares the trees named by the two arguments.
1412 </p>
1413 </dd>
1414 <dt class="hdlist1">
1415 git-diff-files [&lt;pattern&gt;&#8230;]
1416 </dt>
1417 <dd>
1419 compares the index and the files on the filesystem.
1420 </p>
1421 </dd>
1422 </dl></div>
1423 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
1424 what is being compared. After that, all the commands print one output
1425 line per changed file.</p></div>
1426 <div class="paragraph"><p>An output line is formatted this way:</p></div>
1427 <div class="listingblock">
1428 <div class="content">
1429 <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1430 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1431 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1432 create :000000 100644 0000000... 1234567... A file4
1433 delete :100644 000000 1234567... 0000000... D file5
1434 unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1435 </div></div>
1436 <div class="paragraph"><p>That is, from the left to the right:</p></div>
1437 <div class="olist arabic"><ol class="arabic">
1438 <li>
1440 a colon.
1441 </p>
1442 </li>
1443 <li>
1445 mode for "src"; 000000 if creation or unmerged.
1446 </p>
1447 </li>
1448 <li>
1450 a space.
1451 </p>
1452 </li>
1453 <li>
1455 mode for "dst"; 000000 if deletion or unmerged.
1456 </p>
1457 </li>
1458 <li>
1460 a space.
1461 </p>
1462 </li>
1463 <li>
1465 sha1 for "src"; 0{40} if creation or unmerged.
1466 </p>
1467 </li>
1468 <li>
1470 a space.
1471 </p>
1472 </li>
1473 <li>
1475 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1476 </p>
1477 </li>
1478 <li>
1480 a space.
1481 </p>
1482 </li>
1483 <li>
1485 status, followed by optional "score" number.
1486 </p>
1487 </li>
1488 <li>
1490 a tab or a NUL when <em>-z</em> option is used.
1491 </p>
1492 </li>
1493 <li>
1495 path for "src"
1496 </p>
1497 </li>
1498 <li>
1500 a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1501 </p>
1502 </li>
1503 <li>
1505 path for "dst"; only exists for C or R.
1506 </p>
1507 </li>
1508 <li>
1510 an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1511 </p>
1512 </li>
1513 </ol></div>
1514 <div class="paragraph"><p>Possible status letters are:</p></div>
1515 <div class="ulist"><ul>
1516 <li>
1518 A: addition of a file
1519 </p>
1520 </li>
1521 <li>
1523 C: copy of a file into a new one
1524 </p>
1525 </li>
1526 <li>
1528 D: deletion of a file
1529 </p>
1530 </li>
1531 <li>
1533 M: modification of the contents or mode of a file
1534 </p>
1535 </li>
1536 <li>
1538 R: renaming of a file
1539 </p>
1540 </li>
1541 <li>
1543 T: change in the type of the file
1544 </p>
1545 </li>
1546 <li>
1548 U: file is unmerged (you must complete the merge before it can
1549 be committed)
1550 </p>
1551 </li>
1552 <li>
1554 X: "unknown" change type (most probably a bug, please report it)
1555 </p>
1556 </li>
1557 </ul></div>
1558 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
1559 percentage of similarity between the source and target of the move or
1560 copy), and are the only ones to be so.</p></div>
1561 <div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
1562 and it is out of sync with the index.</p></div>
1563 <div class="paragraph"><p>Example:</p></div>
1564 <div class="listingblock">
1565 <div class="content">
1566 <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
1567 </div></div>
1568 <div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
1569 in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
1570 respectively.</p></div>
1571 </div>
1572 <h2 id="_diff_format_for_merges">diff format for merges</h2>
1573 <div class="sectionbody">
1574 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
1575 can take <em>-c</em> or <em>--cc</em> option
1576 to generate diff output also for merge commits. The output differs
1577 from the format described above in the following way:</p></div>
1578 <div class="olist arabic"><ol class="arabic">
1579 <li>
1581 there is a colon for each parent
1582 </p>
1583 </li>
1584 <li>
1586 there are more "src" modes and "src" sha1
1587 </p>
1588 </li>
1589 <li>
1591 status is concatenated status characters for each parent
1592 </p>
1593 </li>
1594 <li>
1596 no optional "score" number
1597 </p>
1598 </li>
1599 <li>
1601 single path, only for "dst"
1602 </p>
1603 </li>
1604 </ol></div>
1605 <div class="paragraph"><p>Example:</p></div>
1606 <div class="listingblock">
1607 <div class="content">
1608 <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
1609 </div></div>
1610 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
1611 all parents.</p></div>
1612 </div>
1613 <h2 id="_generating_patches_with_p">Generating patches with -p</h2>
1614 <div class="sectionbody">
1615 <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1616 with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
1617 "git log" with the "-p" option, they
1618 do not produce the output described above; instead they produce a
1619 patch file. You can customize the creation of such patches via the
1620 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
1621 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
1622 diff format:</p></div>
1623 <div class="olist arabic"><ol class="arabic">
1624 <li>
1626 It is preceded with a "git diff" header that looks like this:
1627 </p>
1628 <div class="literalblock">
1629 <div class="content">
1630 <pre><tt>diff --git a/file1 b/file2</tt></pre>
1631 </div></div>
1632 <div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
1633 involved. Especially, even for a creation or a deletion,
1634 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
1635 <div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
1636 name of the source file of the rename/copy and the name of
1637 the file that rename/copy produces, respectively.</p></div>
1638 </li>
1639 <li>
1641 It is followed by one or more extended header lines:
1642 </p>
1643 <div class="literalblock">
1644 <div class="content">
1645 <pre><tt>old mode &lt;mode&gt;
1646 new mode &lt;mode&gt;
1647 deleted file mode &lt;mode&gt;
1648 new file mode &lt;mode&gt;
1649 copy from &lt;path&gt;
1650 copy to &lt;path&gt;
1651 rename from &lt;path&gt;
1652 rename to &lt;path&gt;
1653 similarity index &lt;number&gt;
1654 dissimilarity index &lt;number&gt;
1655 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
1656 </div></div>
1657 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
1658 and file permission bits.</p></div>
1659 <div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
1660 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
1661 the dissimilarity index is the percentage of changed lines. It
1662 is a rounded down integer, followed by a percent sign. The
1663 similarity index value of 100% is thus reserved for two equal
1664 files, while 100% dissimilarity means that no line from the old
1665 file made it into the new one.</p></div>
1666 <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
1667 The &lt;mode&gt; is included if the file mode does not change; otherwise,
1668 separate lines indicate the old and the new mode.</p></div>
1669 </li>
1670 <li>
1672 TAB, LF, double quote and backslash characters in pathnames
1673 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
1674 If there is need for such substitution then the whole
1675 pathname is put in double quotes.
1676 </p>
1677 </li>
1678 <li>
1680 All the <tt>file1</tt> files in the output refer to files before the
1681 commit, and all the <tt>file2</tt> files refer to files after the commit.
1682 It is incorrect to apply each change to each file sequentially. For
1683 example, this patch will swap a and b:
1684 </p>
1685 <div class="literalblock">
1686 <div class="content">
1687 <pre><tt>diff --git a/a b/b
1688 rename from a
1689 rename to b
1690 diff --git a/b b/a
1691 rename from b
1692 rename to a</tt></pre>
1693 </div></div>
1694 </li>
1695 </ol></div>
1696 </div>
1697 <h2 id="_combined_diff_format">combined diff format</h2>
1698 <div class="sectionbody">
1699 <div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
1700 produce a <em>combined diff</em> when showing a merge. This is the default
1701 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
1702 <a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
1703 of these commands to force generation of diffs with individual parents
1704 of a merge.</p></div>
1705 <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
1706 <div class="listingblock">
1707 <div class="content">
1708 <pre><tt>diff --combined describe.c
1709 index fabadb8,cc95eb0..4866510
1710 --- a/describe.c
1711 +++ b/describe.c
1712 @@@ -98,20 -98,12 +98,20 @@@
1713 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1716 - static void describe(char *arg)
1717 -static void describe(struct commit *cmit, int last_one)
1718 ++static void describe(char *arg, int last_one)
1720 + unsigned char sha1[20];
1721 + struct commit *cmit;
1722 struct commit_list *list;
1723 static int initialized = 0;
1724 struct commit_name *n;
1726 + if (get_sha1(arg, sha1) &lt; 0)
1727 + usage(describe_usage);
1728 + cmit = lookup_commit_reference(sha1);
1729 + if (!cmit)
1730 + usage(describe_usage);
1732 if (!initialized) {
1733 initialized = 1;
1734 for_each_ref(get_name);</tt></pre>
1735 </div></div>
1736 <div class="olist arabic"><ol class="arabic">
1737 <li>
1739 It is preceded with a "git diff" header, that looks like
1740 this (when <em>-c</em> option is used):
1741 </p>
1742 <div class="literalblock">
1743 <div class="content">
1744 <pre><tt>diff --combined file</tt></pre>
1745 </div></div>
1746 <div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
1747 <div class="literalblock">
1748 <div class="content">
1749 <pre><tt>diff --cc file</tt></pre>
1750 </div></div>
1751 </li>
1752 <li>
1754 It is followed by one or more extended header lines
1755 (this example shows a merge with two parents):
1756 </p>
1757 <div class="literalblock">
1758 <div class="content">
1759 <pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
1760 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
1761 new file mode &lt;mode&gt;
1762 deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
1763 </div></div>
1764 <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
1765 the &lt;mode&gt; is different from the rest. Extended headers with
1766 information about detected contents movement (renames and
1767 copying detection) are designed to work with diff of two
1768 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
1769 </li>
1770 <li>
1772 It is followed by two-line from-file/to-file header
1773 </p>
1774 <div class="literalblock">
1775 <div class="content">
1776 <pre><tt>--- a/file
1777 +++ b/file</tt></pre>
1778 </div></div>
1779 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
1780 format, <tt>/dev/null</tt> is used to signal created or deleted
1781 files.</p></div>
1782 </li>
1783 <li>
1785 Chunk header format is modified to prevent people from
1786 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
1787 was created for review of merge commit changes, and was not
1788 meant for apply. The change is similar to the change in the
1789 extended <em>index</em> header:
1790 </p>
1791 <div class="literalblock">
1792 <div class="content">
1793 <pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
1794 </div></div>
1795 <div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
1796 header for combined diff format.</p></div>
1797 </li>
1798 </ol></div>
1799 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
1800 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
1801 added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
1802 compares two or more files file1, file2,&#8230; with one file X, and
1803 shows how X differs from each of fileN. One column for each of
1804 fileN is prepended to the output line to note how X&#8217;s line is
1805 different from it.</p></div>
1806 <div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
1807 fileN but it does not appear in the result. A <tt>+</tt> character
1808 in the column N means that the line appears in the result,
1809 and fileN does not have that line (in other words, the line was
1810 added, from the point of view of that parent).</p></div>
1811 <div class="paragraph"><p>In the above example output, the function signature was changed
1812 from both files (hence two <tt>-</tt> removals from both file1 and
1813 file2, plus <tt>++</tt> to mean one line that was added does not appear
1814 in either file1 nor file2). Also eight other lines are the same
1815 from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
1816 <div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
1817 merge commit with the merge result (i.e. file1..fileN are the
1818 parents). When shown by <tt>git diff-files -c</tt>, it compares the
1819 two unresolved merge parents with the working tree file
1820 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
1821 "their version").</p></div>
1822 </div>
1823 <h2 id="_other_diff_formats">other diff formats</h2>
1824 <div class="sectionbody">
1825 <div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
1826 copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
1827 output. These options can be combined with other options, such as
1828 <tt>-p</tt>, and are meant for human consumption.</p></div>
1829 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
1830 formats the pathnames compactly by combining common prefix and suffix of
1831 the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
1832 <tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
1833 <div class="listingblock">
1834 <div class="content">
1835 <pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
1836 </div></div>
1837 <div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
1838 for easier machine consumption. An entry in <tt>--numstat</tt> output looks
1839 like this:</p></div>
1840 <div class="listingblock">
1841 <div class="content">
1842 <pre><tt>1 2 README
1843 3 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
1844 </div></div>
1845 <div class="paragraph"><p>That is, from left to right:</p></div>
1846 <div class="olist arabic"><ol class="arabic">
1847 <li>
1849 the number of added lines;
1850 </p>
1851 </li>
1852 <li>
1854 a tab;
1855 </p>
1856 </li>
1857 <li>
1859 the number of deleted lines;
1860 </p>
1861 </li>
1862 <li>
1864 a tab;
1865 </p>
1866 </li>
1867 <li>
1869 pathname (possibly with rename/copy information);
1870 </p>
1871 </li>
1872 <li>
1874 a newline.
1875 </p>
1876 </li>
1877 </ol></div>
1878 <div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
1879 <div class="listingblock">
1880 <div class="content">
1881 <pre><tt>1 2 README NUL
1882 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
1883 </div></div>
1884 <div class="paragraph"><p>That is:</p></div>
1885 <div class="olist arabic"><ol class="arabic">
1886 <li>
1888 the number of added lines;
1889 </p>
1890 </li>
1891 <li>
1893 a tab;
1894 </p>
1895 </li>
1896 <li>
1898 the number of deleted lines;
1899 </p>
1900 </li>
1901 <li>
1903 a tab;
1904 </p>
1905 </li>
1906 <li>
1908 a NUL (only exists if renamed/copied);
1909 </p>
1910 </li>
1911 <li>
1913 pathname in preimage;
1914 </p>
1915 </li>
1916 <li>
1918 a NUL (only exists if renamed/copied);
1919 </p>
1920 </li>
1921 <li>
1923 pathname in postimage (only exists if renamed/copied);
1924 </p>
1925 </li>
1926 <li>
1928 a NUL.
1929 </p>
1930 </li>
1931 </ol></div>
1932 <div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
1933 scripts that read the output to tell if the current record being read is
1934 a single-path record or a rename/copy record without reading ahead.
1935 After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
1936 the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
1937 </div>
1938 <h2 id="_git">GIT</h2>
1939 <div class="sectionbody">
1940 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1941 </div>
1942 </div>
1943 <div id="footnotes"><hr /></div>
1944 <div id="footer">
1945 <div id="footer-text">
1946 Last updated 2011-09-21 23:01:14 PDT
1947 </div>
1948 </div>
1949 </body>
1950 </html>