Autogenerated HTML docs for v1.7.7-419-g87009
[git/jnareb-git.git] / git-diff-files.html
blob9574d06701b805609867ed0e4f26634dfd17afeb
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">
1239 </dt>
1240 <dt class="hdlist1">
1241 --function-context
1242 </dt>
1243 <dd>
1245 Show whole surrounding functions of changes.
1246 </p>
1247 </dd>
1248 <dt class="hdlist1">
1249 --exit-code
1250 </dt>
1251 <dd>
1253 Make the program exit with codes similar to diff(1).
1254 That is, it exits with 1 if there were differences and
1255 0 means no differences.
1256 </p>
1257 </dd>
1258 <dt class="hdlist1">
1259 --quiet
1260 </dt>
1261 <dd>
1263 Disable all output of the program. Implies <tt>--exit-code</tt>.
1264 </p>
1265 </dd>
1266 <dt class="hdlist1">
1267 --ext-diff
1268 </dt>
1269 <dd>
1271 Allow an external diff helper to be executed. If you set an
1272 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1273 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1274 </p>
1275 </dd>
1276 <dt class="hdlist1">
1277 --no-ext-diff
1278 </dt>
1279 <dd>
1281 Disallow external diff drivers.
1282 </p>
1283 </dd>
1284 <dt class="hdlist1">
1285 --textconv
1286 </dt>
1287 <dt class="hdlist1">
1288 --no-textconv
1289 </dt>
1290 <dd>
1292 Allow (or disallow) external text conversion filters to be run
1293 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1294 details. Because textconv filters are typically a one-way
1295 conversion, the resulting diff is suitable for human
1296 consumption, but cannot be applied. For this reason, textconv
1297 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1298 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1299 diff plumbing commands.
1300 </p>
1301 </dd>
1302 <dt class="hdlist1">
1303 --ignore-submodules[=&lt;when&gt;]
1304 </dt>
1305 <dd>
1307 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1308 either "none", "untracked", "dirty" or "all", which is the default
1309 Using "none" will consider the submodule modified when it either contains
1310 untracked or modified files or its HEAD differs from the commit recorded
1311 in the superproject and can be used to override any settings of the
1312 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1313 "untracked" is used submodules are not considered dirty when they only
1314 contain untracked content (but they are still scanned for modified
1315 content). Using "dirty" ignores all changes to the work tree of submodules,
1316 only changes to the commits stored in the superproject are shown (this was
1317 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1318 </p>
1319 </dd>
1320 <dt class="hdlist1">
1321 --src-prefix=&lt;prefix&gt;
1322 </dt>
1323 <dd>
1325 Show the given source prefix instead of "a/".
1326 </p>
1327 </dd>
1328 <dt class="hdlist1">
1329 --dst-prefix=&lt;prefix&gt;
1330 </dt>
1331 <dd>
1333 Show the given destination prefix instead of "b/".
1334 </p>
1335 </dd>
1336 <dt class="hdlist1">
1337 --no-prefix
1338 </dt>
1339 <dd>
1341 Do not show any source or destination prefix.
1342 </p>
1343 </dd>
1344 </dl></div>
1345 <div class="paragraph"><p>For more detailed explanation on these common options, see also
1346 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
1347 <div class="dlist"><dl>
1348 <dt class="hdlist1">
1349 -1 --base
1350 </dt>
1351 <dt class="hdlist1">
1352 -2 --ours
1353 </dt>
1354 <dt class="hdlist1">
1355 -3 --theirs
1356 </dt>
1357 <dt class="hdlist1">
1359 </dt>
1360 <dd>
1362 Diff against the "base" version, "our branch" or "their
1363 branch" respectively. With these options, diffs for
1364 merged entries are not shown.
1365 </p>
1366 <div class="paragraph"><p>The default is to diff against our branch (-2) and the
1367 cleanly resolved paths. The option -0 can be given to
1368 omit diff output for unmerged entries and just show "Unmerged".</p></div>
1369 </dd>
1370 <dt class="hdlist1">
1372 </dt>
1373 <dt class="hdlist1">
1374 --cc
1375 </dt>
1376 <dd>
1378 This compares stage 2 (our branch), stage 3 (their
1379 branch) and the working tree file and outputs a combined
1380 diff, similar to the way <em>diff-tree</em> shows a merge
1381 commit with these flags.
1382 </p>
1383 </dd>
1384 <dt class="hdlist1">
1386 </dt>
1387 <dd>
1389 Remain silent even on nonexistent files
1390 </p>
1391 </dd>
1392 </dl></div>
1393 </div>
1394 <h2 id="_raw_output_format">Raw output format</h2>
1395 <div class="sectionbody">
1396 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
1397 "git-diff-files" and "git diff --raw" are very similar.</p></div>
1398 <div class="paragraph"><p>These commands all compare two sets of things; what is
1399 compared differs:</p></div>
1400 <div class="dlist"><dl>
1401 <dt class="hdlist1">
1402 git-diff-index &lt;tree-ish&gt;
1403 </dt>
1404 <dd>
1406 compares the &lt;tree-ish&gt; and the files on the filesystem.
1407 </p>
1408 </dd>
1409 <dt class="hdlist1">
1410 git-diff-index --cached &lt;tree-ish&gt;
1411 </dt>
1412 <dd>
1414 compares the &lt;tree-ish&gt; and the index.
1415 </p>
1416 </dd>
1417 <dt class="hdlist1">
1418 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1419 </dt>
1420 <dd>
1422 compares the trees named by the two arguments.
1423 </p>
1424 </dd>
1425 <dt class="hdlist1">
1426 git-diff-files [&lt;pattern&gt;&#8230;]
1427 </dt>
1428 <dd>
1430 compares the index and the files on the filesystem.
1431 </p>
1432 </dd>
1433 </dl></div>
1434 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
1435 what is being compared. After that, all the commands print one output
1436 line per changed file.</p></div>
1437 <div class="paragraph"><p>An output line is formatted this way:</p></div>
1438 <div class="listingblock">
1439 <div class="content">
1440 <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1441 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1442 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1443 create :000000 100644 0000000... 1234567... A file4
1444 delete :100644 000000 1234567... 0000000... D file5
1445 unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1446 </div></div>
1447 <div class="paragraph"><p>That is, from the left to the right:</p></div>
1448 <div class="olist arabic"><ol class="arabic">
1449 <li>
1451 a colon.
1452 </p>
1453 </li>
1454 <li>
1456 mode for "src"; 000000 if creation or unmerged.
1457 </p>
1458 </li>
1459 <li>
1461 a space.
1462 </p>
1463 </li>
1464 <li>
1466 mode for "dst"; 000000 if deletion or unmerged.
1467 </p>
1468 </li>
1469 <li>
1471 a space.
1472 </p>
1473 </li>
1474 <li>
1476 sha1 for "src"; 0{40} if creation or unmerged.
1477 </p>
1478 </li>
1479 <li>
1481 a space.
1482 </p>
1483 </li>
1484 <li>
1486 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1487 </p>
1488 </li>
1489 <li>
1491 a space.
1492 </p>
1493 </li>
1494 <li>
1496 status, followed by optional "score" number.
1497 </p>
1498 </li>
1499 <li>
1501 a tab or a NUL when <em>-z</em> option is used.
1502 </p>
1503 </li>
1504 <li>
1506 path for "src"
1507 </p>
1508 </li>
1509 <li>
1511 a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1512 </p>
1513 </li>
1514 <li>
1516 path for "dst"; only exists for C or R.
1517 </p>
1518 </li>
1519 <li>
1521 an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1522 </p>
1523 </li>
1524 </ol></div>
1525 <div class="paragraph"><p>Possible status letters are:</p></div>
1526 <div class="ulist"><ul>
1527 <li>
1529 A: addition of a file
1530 </p>
1531 </li>
1532 <li>
1534 C: copy of a file into a new one
1535 </p>
1536 </li>
1537 <li>
1539 D: deletion of a file
1540 </p>
1541 </li>
1542 <li>
1544 M: modification of the contents or mode of a file
1545 </p>
1546 </li>
1547 <li>
1549 R: renaming of a file
1550 </p>
1551 </li>
1552 <li>
1554 T: change in the type of the file
1555 </p>
1556 </li>
1557 <li>
1559 U: file is unmerged (you must complete the merge before it can
1560 be committed)
1561 </p>
1562 </li>
1563 <li>
1565 X: "unknown" change type (most probably a bug, please report it)
1566 </p>
1567 </li>
1568 </ul></div>
1569 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
1570 percentage of similarity between the source and target of the move or
1571 copy), and are the only ones to be so.</p></div>
1572 <div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
1573 and it is out of sync with the index.</p></div>
1574 <div class="paragraph"><p>Example:</p></div>
1575 <div class="listingblock">
1576 <div class="content">
1577 <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
1578 </div></div>
1579 <div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
1580 in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
1581 respectively.</p></div>
1582 </div>
1583 <h2 id="_diff_format_for_merges">diff format for merges</h2>
1584 <div class="sectionbody">
1585 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
1586 can take <em>-c</em> or <em>--cc</em> option
1587 to generate diff output also for merge commits. The output differs
1588 from the format described above in the following way:</p></div>
1589 <div class="olist arabic"><ol class="arabic">
1590 <li>
1592 there is a colon for each parent
1593 </p>
1594 </li>
1595 <li>
1597 there are more "src" modes and "src" sha1
1598 </p>
1599 </li>
1600 <li>
1602 status is concatenated status characters for each parent
1603 </p>
1604 </li>
1605 <li>
1607 no optional "score" number
1608 </p>
1609 </li>
1610 <li>
1612 single path, only for "dst"
1613 </p>
1614 </li>
1615 </ol></div>
1616 <div class="paragraph"><p>Example:</p></div>
1617 <div class="listingblock">
1618 <div class="content">
1619 <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
1620 </div></div>
1621 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
1622 all parents.</p></div>
1623 </div>
1624 <h2 id="_generating_patches_with_p">Generating patches with -p</h2>
1625 <div class="sectionbody">
1626 <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
1627 with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
1628 "git log" with the "-p" option, they
1629 do not produce the output described above; instead they produce a
1630 patch file. You can customize the creation of such patches via the
1631 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
1632 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
1633 diff format:</p></div>
1634 <div class="olist arabic"><ol class="arabic">
1635 <li>
1637 It is preceded with a "git diff" header that looks like this:
1638 </p>
1639 <div class="literalblock">
1640 <div class="content">
1641 <pre><tt>diff --git a/file1 b/file2</tt></pre>
1642 </div></div>
1643 <div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
1644 involved. Especially, even for a creation or a deletion,
1645 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
1646 <div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
1647 name of the source file of the rename/copy and the name of
1648 the file that rename/copy produces, respectively.</p></div>
1649 </li>
1650 <li>
1652 It is followed by one or more extended header lines:
1653 </p>
1654 <div class="literalblock">
1655 <div class="content">
1656 <pre><tt>old mode &lt;mode&gt;
1657 new mode &lt;mode&gt;
1658 deleted file mode &lt;mode&gt;
1659 new file mode &lt;mode&gt;
1660 copy from &lt;path&gt;
1661 copy to &lt;path&gt;
1662 rename from &lt;path&gt;
1663 rename to &lt;path&gt;
1664 similarity index &lt;number&gt;
1665 dissimilarity index &lt;number&gt;
1666 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
1667 </div></div>
1668 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
1669 and file permission bits.</p></div>
1670 <div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
1671 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
1672 the dissimilarity index is the percentage of changed lines. It
1673 is a rounded down integer, followed by a percent sign. The
1674 similarity index value of 100% is thus reserved for two equal
1675 files, while 100% dissimilarity means that no line from the old
1676 file made it into the new one.</p></div>
1677 <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
1678 The &lt;mode&gt; is included if the file mode does not change; otherwise,
1679 separate lines indicate the old and the new mode.</p></div>
1680 </li>
1681 <li>
1683 TAB, LF, double quote and backslash characters in pathnames
1684 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
1685 If there is need for such substitution then the whole
1686 pathname is put in double quotes.
1687 </p>
1688 </li>
1689 <li>
1691 All the <tt>file1</tt> files in the output refer to files before the
1692 commit, and all the <tt>file2</tt> files refer to files after the commit.
1693 It is incorrect to apply each change to each file sequentially. For
1694 example, this patch will swap a and b:
1695 </p>
1696 <div class="literalblock">
1697 <div class="content">
1698 <pre><tt>diff --git a/a b/b
1699 rename from a
1700 rename to b
1701 diff --git a/b b/a
1702 rename from b
1703 rename to a</tt></pre>
1704 </div></div>
1705 </li>
1706 </ol></div>
1707 </div>
1708 <h2 id="_combined_diff_format">combined diff format</h2>
1709 <div class="sectionbody">
1710 <div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
1711 produce a <em>combined diff</em> when showing a merge. This is the default
1712 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
1713 <a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
1714 of these commands to force generation of diffs with individual parents
1715 of a merge.</p></div>
1716 <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
1717 <div class="listingblock">
1718 <div class="content">
1719 <pre><tt>diff --combined describe.c
1720 index fabadb8,cc95eb0..4866510
1721 --- a/describe.c
1722 +++ b/describe.c
1723 @@@ -98,20 -98,12 +98,20 @@@
1724 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
1727 - static void describe(char *arg)
1728 -static void describe(struct commit *cmit, int last_one)
1729 ++static void describe(char *arg, int last_one)
1731 + unsigned char sha1[20];
1732 + struct commit *cmit;
1733 struct commit_list *list;
1734 static int initialized = 0;
1735 struct commit_name *n;
1737 + if (get_sha1(arg, sha1) &lt; 0)
1738 + usage(describe_usage);
1739 + cmit = lookup_commit_reference(sha1);
1740 + if (!cmit)
1741 + usage(describe_usage);
1743 if (!initialized) {
1744 initialized = 1;
1745 for_each_ref(get_name);</tt></pre>
1746 </div></div>
1747 <div class="olist arabic"><ol class="arabic">
1748 <li>
1750 It is preceded with a "git diff" header, that looks like
1751 this (when <em>-c</em> option is used):
1752 </p>
1753 <div class="literalblock">
1754 <div class="content">
1755 <pre><tt>diff --combined file</tt></pre>
1756 </div></div>
1757 <div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
1758 <div class="literalblock">
1759 <div class="content">
1760 <pre><tt>diff --cc file</tt></pre>
1761 </div></div>
1762 </li>
1763 <li>
1765 It is followed by one or more extended header lines
1766 (this example shows a merge with two parents):
1767 </p>
1768 <div class="literalblock">
1769 <div class="content">
1770 <pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
1771 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
1772 new file mode &lt;mode&gt;
1773 deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
1774 </div></div>
1775 <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
1776 the &lt;mode&gt; is different from the rest. Extended headers with
1777 information about detected contents movement (renames and
1778 copying detection) are designed to work with diff of two
1779 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
1780 </li>
1781 <li>
1783 It is followed by two-line from-file/to-file header
1784 </p>
1785 <div class="literalblock">
1786 <div class="content">
1787 <pre><tt>--- a/file
1788 +++ b/file</tt></pre>
1789 </div></div>
1790 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
1791 format, <tt>/dev/null</tt> is used to signal created or deleted
1792 files.</p></div>
1793 </li>
1794 <li>
1796 Chunk header format is modified to prevent people from
1797 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
1798 was created for review of merge commit changes, and was not
1799 meant for apply. The change is similar to the change in the
1800 extended <em>index</em> header:
1801 </p>
1802 <div class="literalblock">
1803 <div class="content">
1804 <pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
1805 </div></div>
1806 <div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
1807 header for combined diff format.</p></div>
1808 </li>
1809 </ol></div>
1810 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
1811 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
1812 added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
1813 compares two or more files file1, file2,&#8230; with one file X, and
1814 shows how X differs from each of fileN. One column for each of
1815 fileN is prepended to the output line to note how X&#8217;s line is
1816 different from it.</p></div>
1817 <div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
1818 fileN but it does not appear in the result. A <tt>+</tt> character
1819 in the column N means that the line appears in the result,
1820 and fileN does not have that line (in other words, the line was
1821 added, from the point of view of that parent).</p></div>
1822 <div class="paragraph"><p>In the above example output, the function signature was changed
1823 from both files (hence two <tt>-</tt> removals from both file1 and
1824 file2, plus <tt>++</tt> to mean one line that was added does not appear
1825 in either file1 nor file2). Also eight other lines are the same
1826 from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
1827 <div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
1828 merge commit with the merge result (i.e. file1..fileN are the
1829 parents). When shown by <tt>git diff-files -c</tt>, it compares the
1830 two unresolved merge parents with the working tree file
1831 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
1832 "their version").</p></div>
1833 </div>
1834 <h2 id="_other_diff_formats">other diff formats</h2>
1835 <div class="sectionbody">
1836 <div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
1837 copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
1838 output. These options can be combined with other options, such as
1839 <tt>-p</tt>, and are meant for human consumption.</p></div>
1840 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
1841 formats the pathnames compactly by combining common prefix and suffix of
1842 the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
1843 <tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
1844 <div class="listingblock">
1845 <div class="content">
1846 <pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
1847 </div></div>
1848 <div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
1849 for easier machine consumption. An entry in <tt>--numstat</tt> output looks
1850 like this:</p></div>
1851 <div class="listingblock">
1852 <div class="content">
1853 <pre><tt>1 2 README
1854 3 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
1855 </div></div>
1856 <div class="paragraph"><p>That is, from left to right:</p></div>
1857 <div class="olist arabic"><ol class="arabic">
1858 <li>
1860 the number of added lines;
1861 </p>
1862 </li>
1863 <li>
1865 a tab;
1866 </p>
1867 </li>
1868 <li>
1870 the number of deleted lines;
1871 </p>
1872 </li>
1873 <li>
1875 a tab;
1876 </p>
1877 </li>
1878 <li>
1880 pathname (possibly with rename/copy information);
1881 </p>
1882 </li>
1883 <li>
1885 a newline.
1886 </p>
1887 </li>
1888 </ol></div>
1889 <div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
1890 <div class="listingblock">
1891 <div class="content">
1892 <pre><tt>1 2 README NUL
1893 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
1894 </div></div>
1895 <div class="paragraph"><p>That is:</p></div>
1896 <div class="olist arabic"><ol class="arabic">
1897 <li>
1899 the number of added lines;
1900 </p>
1901 </li>
1902 <li>
1904 a tab;
1905 </p>
1906 </li>
1907 <li>
1909 the number of deleted lines;
1910 </p>
1911 </li>
1912 <li>
1914 a tab;
1915 </p>
1916 </li>
1917 <li>
1919 a NUL (only exists if renamed/copied);
1920 </p>
1921 </li>
1922 <li>
1924 pathname in preimage;
1925 </p>
1926 </li>
1927 <li>
1929 a NUL (only exists if renamed/copied);
1930 </p>
1931 </li>
1932 <li>
1934 pathname in postimage (only exists if renamed/copied);
1935 </p>
1936 </li>
1937 <li>
1939 a NUL.
1940 </p>
1941 </li>
1942 </ol></div>
1943 <div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
1944 scripts that read the output to tell if the current record being read is
1945 a single-path record or a rename/copy record without reading ahead.
1946 After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
1947 the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
1948 </div>
1949 <h2 id="_git">GIT</h2>
1950 <div class="sectionbody">
1951 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1952 </div>
1953 </div>
1954 <div id="footnotes"><hr /></div>
1955 <div id="footer">
1956 <div id="footer-text">
1957 Last updated 2011-09-21 23:01:14 PDT
1958 </div>
1959 </div>
1960 </body>
1961 </html>