Autogenerated HTML docs for v1.7.7-290-gc9e7aa
[git/jnareb-git.git] / git-diff-tree.html
blob59a2de27e057e9eeb31d23fed20bba1da728246d
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-tree(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.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-tree(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-diff-tree -
578 Compares the content and mode of blobs found via two tree objects
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-tree</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
587 [-t] [-r] [-c | --cc] [--root] [&lt;common diff options&gt;]
588 &lt;tree-ish&gt; [&lt;tree-ish&gt;] [&lt;path&gt;&#8230;]</div>
589 <div class="verseblock-attribution">
590 </div></div>
591 </div>
592 <h2 id="_description">DESCRIPTION</h2>
593 <div class="sectionbody">
594 <div class="paragraph"><p>Compares the content and mode of the blobs found via two tree objects.</p></div>
595 <div class="paragraph"><p>If there is only one &lt;tree-ish&gt; given, the commit is compared with its parents
596 (see --stdin below).</p></div>
597 <div class="paragraph"><p>Note that <em>git diff-tree</em> can use the tree encapsulated in a commit object.</p></div>
598 </div>
599 <h2 id="_options">OPTIONS</h2>
600 <div class="sectionbody">
601 <div class="dlist"><dl>
602 <dt class="hdlist1">
604 </dt>
605 <dt class="hdlist1">
607 </dt>
608 <dt class="hdlist1">
609 --patch
610 </dt>
611 <dd>
613 Generate patch (see section on generating patches).
615 </p>
616 </dd>
617 <dt class="hdlist1">
618 -U&lt;n&gt;
619 </dt>
620 <dt class="hdlist1">
621 --unified=&lt;n&gt;
622 </dt>
623 <dd>
625 Generate diffs with &lt;n&gt; lines of context instead of
626 the usual three.
627 Implies <tt>-p</tt>.
628 </p>
629 </dd>
630 <dt class="hdlist1">
631 --raw
632 </dt>
633 <dd>
635 Generate the raw format.
636 This is the default.
637 </p>
638 </dd>
639 <dt class="hdlist1">
640 --patch-with-raw
641 </dt>
642 <dd>
644 Synonym for <tt>-p --raw</tt>.
645 </p>
646 </dd>
647 <dt class="hdlist1">
648 --minimal
649 </dt>
650 <dd>
652 Spend extra time to make sure the smallest possible
653 diff is produced.
654 </p>
655 </dd>
656 <dt class="hdlist1">
657 --patience
658 </dt>
659 <dd>
661 Generate a diff using the "patience diff" algorithm.
662 </p>
663 </dd>
664 <dt class="hdlist1">
665 --stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
666 </dt>
667 <dd>
669 Generate a diffstat. You can override the default
670 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
671 The width of the filename part can be controlled by
672 giving another width to it separated by a comma.
673 By giving a third parameter <tt>&lt;count&gt;</tt>, you can limit the
674 output to the first <tt>&lt;count&gt;</tt> lines, followed by
675 <tt>&#8230;</tt> if there are more.
676 </p>
677 <div class="paragraph"><p>These parameters can also be set individually with <tt>--stat-width=&lt;width&gt;</tt>,
678 <tt>--stat-name-width=&lt;name-width&gt;</tt> and <tt>--stat-count=&lt;count&gt;</tt>.</p></div>
679 </dd>
680 <dt class="hdlist1">
681 --numstat
682 </dt>
683 <dd>
685 Similar to <tt>--stat</tt>, but shows number of added and
686 deleted lines in decimal notation and pathname without
687 abbreviation, to make it more machine friendly. For
688 binary files, outputs two <tt>-</tt> instead of saying
689 <tt>0 0</tt>.
690 </p>
691 </dd>
692 <dt class="hdlist1">
693 --shortstat
694 </dt>
695 <dd>
697 Output only the last line of the <tt>--stat</tt> format containing total
698 number of modified files, as well as number of added and deleted
699 lines.
700 </p>
701 </dd>
702 <dt class="hdlist1">
703 --dirstat[=&lt;param1,param2,&#8230;&gt;]
704 </dt>
705 <dd>
707 Output the distribution of relative amount of changes for each
708 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
709 passing it a comma separated list of parameters.
710 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
711 variable (see <a href="git-config.html">git-config(1)</a>).
712 The following parameters are available:
713 </p>
714 <div class="dlist"><dl>
715 <dt class="hdlist1">
716 <tt>changes</tt>
717 </dt>
718 <dd>
720 Compute the dirstat numbers by counting the lines that have been
721 removed from the source, or added to the destination. This ignores
722 the amount of pure code movements within a file. In other words,
723 rearranging lines in a file is not counted as much as other changes.
724 This is the default behavior when no parameter is given.
725 </p>
726 </dd>
727 <dt class="hdlist1">
728 <tt>lines</tt>
729 </dt>
730 <dd>
732 Compute the dirstat numbers by doing the regular line-based diff
733 analysis, and summing the removed/added line counts. (For binary
734 files, count 64-byte chunks instead, since binary files have no
735 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
736 behavior than the <tt>changes</tt> behavior, but it does count rearranged
737 lines within a file as much as other changes. The resulting output
738 is consistent with what you get from the other <tt>--*stat</tt> options.
739 </p>
740 </dd>
741 <dt class="hdlist1">
742 <tt>files</tt>
743 </dt>
744 <dd>
746 Compute the dirstat numbers by counting the number of files changed.
747 Each changed file counts equally in the dirstat analysis. This is
748 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
749 not have to look at the file contents at all.
750 </p>
751 </dd>
752 <dt class="hdlist1">
753 <tt>cumulative</tt>
754 </dt>
755 <dd>
757 Count changes in a child directory for the parent directory as well.
758 Note that when using <tt>cumulative</tt>, the sum of the percentages
759 reported may exceed 100%. The default (non-cumulative) behavior can
760 be specified with the <tt>noncumulative</tt> parameter.
761 </p>
762 </dd>
763 <dt class="hdlist1">
764 &lt;limit&gt;
765 </dt>
766 <dd>
768 An integer parameter specifies a cut-off percent (3% by default).
769 Directories contributing less than this percentage of the changes
770 are not shown in the output.
771 </p>
772 </dd>
773 </dl></div>
774 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
775 directories with less than 10% of the total amount of changed files,
776 and accumulating child directory counts in the parent directories:
777 <tt>--dirstat=files,10,cumulative</tt>.</p></div>
778 </dd>
779 <dt class="hdlist1">
780 --summary
781 </dt>
782 <dd>
784 Output a condensed summary of extended header information
785 such as creations, renames and mode changes.
786 </p>
787 </dd>
788 <dt class="hdlist1">
789 --patch-with-stat
790 </dt>
791 <dd>
793 Synonym for <tt>-p --stat</tt>.
794 </p>
795 </dd>
796 <dt class="hdlist1">
798 </dt>
799 <dd>
801 When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been
802 given, do not munge pathnames and use NULs as output field terminators.
803 </p>
804 <div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
805 and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
806 respectively, and the pathname will be enclosed in double quotes if
807 any of those replacements occurred.</p></div>
808 </dd>
809 <dt class="hdlist1">
810 --name-only
811 </dt>
812 <dd>
814 Show only names of changed files.
815 </p>
816 </dd>
817 <dt class="hdlist1">
818 --name-status
819 </dt>
820 <dd>
822 Show only names and status of changed files. See the description
823 of the <tt>--diff-filter</tt> option on what the status letters mean.
824 </p>
825 </dd>
826 <dt class="hdlist1">
827 --submodule[=&lt;format&gt;]
828 </dt>
829 <dd>
831 Chose the output format for submodule differences. &lt;format&gt; can be one of
832 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
833 is used when this option is not given. <em>log</em> is the default value for this
834 option and lists the commits in that commit range like the <em>summary</em>
835 option of <a href="git-submodule.html">git-submodule(1)</a> does.
836 </p>
837 </dd>
838 <dt class="hdlist1">
839 --color[=&lt;when&gt;]
840 </dt>
841 <dd>
843 Show colored diff.
844 The value must be <tt>always</tt> (the default for <tt>&lt;when&gt;</tt>), <tt>never</tt>, or <tt>auto</tt>.
845 The default value is <tt>never</tt>.
846 </p>
847 </dd>
848 <dt class="hdlist1">
849 --no-color
850 </dt>
851 <dd>
853 Turn off colored diff.
854 It is the same as <tt>--color=never</tt>.
855 </p>
856 </dd>
857 <dt class="hdlist1">
858 --word-diff[=&lt;mode&gt;]
859 </dt>
860 <dd>
862 Show a word diff, using the &lt;mode&gt; to delimit changed words.
863 By default, words are delimited by whitespace; see
864 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
865 must be one of:
866 </p>
867 <div class="dlist"><dl>
868 <dt class="hdlist1">
869 color
870 </dt>
871 <dd>
873 Highlight changed words using only colors. Implies <tt>--color</tt>.
874 </p>
875 </dd>
876 <dt class="hdlist1">
877 plain
878 </dt>
879 <dd>
881 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
882 attempts to escape the delimiters if they appear in the input,
883 so the output may be ambiguous.
884 </p>
885 </dd>
886 <dt class="hdlist1">
887 porcelain
888 </dt>
889 <dd>
891 Use a special line-based format intended for script
892 consumption. Added/removed/unchanged runs are printed in the
893 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
894 character at the beginning of the line and extending to the
895 end of the line. Newlines in the input are represented by a
896 tilde <tt>~</tt> on a line of its own.
897 </p>
898 </dd>
899 <dt class="hdlist1">
900 none
901 </dt>
902 <dd>
904 Disable word diff again.
905 </p>
906 </dd>
907 </dl></div>
908 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
909 highlight the changed parts in all modes if enabled.</p></div>
910 </dd>
911 <dt class="hdlist1">
912 --word-diff-regex=&lt;regex&gt;
913 </dt>
914 <dd>
916 Use &lt;regex&gt; to decide what a word is, instead of considering
917 runs of non-whitespace to be a word. Also implies
918 <tt>--word-diff</tt> unless it was already enabled.
919 </p>
920 <div class="paragraph"><p>Every non-overlapping match of the
921 &lt;regex&gt; is considered a word. Anything between these matches is
922 considered whitespace and ignored(!) for the purposes of finding
923 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
924 expression to make sure that it matches all non-whitespace characters.
925 A match that contains a newline is silently truncated(!) at the
926 newline.</p></div>
927 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
928 <a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
929 overrides any diff driver or configuration setting. Diff drivers
930 override configuration settings.</p></div>
931 </dd>
932 <dt class="hdlist1">
933 --color-words[=&lt;regex&gt;]
934 </dt>
935 <dd>
937 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
938 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
939 </p>
940 </dd>
941 <dt class="hdlist1">
942 --no-renames
943 </dt>
944 <dd>
946 Turn off rename detection, even when the configuration
947 file gives the default to do so.
948 </p>
949 </dd>
950 <dt class="hdlist1">
951 --check
952 </dt>
953 <dd>
955 Warn if changes introduce whitespace errors. What are
956 considered whitespace errors is controlled by <tt>core.whitespace</tt>
957 configuration. By default, trailing whitespaces (including
958 lines that solely consist of whitespaces) and a space character
959 that is immediately followed by a tab character inside the
960 initial indent of the line are considered whitespace errors.
961 Exits with non-zero status if problems are found. Not compatible
962 with --exit-code.
963 </p>
964 </dd>
965 <dt class="hdlist1">
966 --full-index
967 </dt>
968 <dd>
970 Instead of the first handful of characters, show the full
971 pre- and post-image blob object names on the "index"
972 line when generating patch format output.
973 </p>
974 </dd>
975 <dt class="hdlist1">
976 --binary
977 </dt>
978 <dd>
980 In addition to <tt>--full-index</tt>, output a binary diff that
981 can be applied with <tt>git-apply</tt>.
982 </p>
983 </dd>
984 <dt class="hdlist1">
985 --abbrev[=&lt;n&gt;]
986 </dt>
987 <dd>
989 Instead of showing the full 40-byte hexadecimal object
990 name in diff-raw format output and diff-tree header
991 lines, show only a partial prefix. This is
992 independent of the <tt>--full-index</tt> option above, which controls
993 the diff-patch output format. Non default number of
994 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
995 </p>
996 </dd>
997 <dt class="hdlist1">
998 -B[&lt;n&gt;][/&lt;m&gt;]
999 </dt>
1000 <dt class="hdlist1">
1001 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1002 </dt>
1003 <dd>
1005 Break complete rewrite changes into pairs of delete and
1006 create. This serves two purposes:
1007 </p>
1008 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
1009 not as a series of deletion and insertion mixed together with a very
1010 few lines that happen to match textually as the context, but as a
1011 single deletion of everything old followed by a single insertion of
1012 everything new, and the number <tt>m</tt> controls this aspect of the -B
1013 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
1014 original should remain in the result for git to consider it a total
1015 rewrite (i.e. otherwise the resulting patch will be a series of
1016 deletion and insertion mixed together with context lines).</p></div>
1017 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
1018 source of a rename (usually -M only considers a file that disappeared
1019 as the source of a rename), and the number <tt>n</tt> controls this aspect of
1020 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
1021 addition and deletion compared to 20% or more of the file&#8217;s size are
1022 eligible for being picked up as a possible source of a rename to
1023 another file.</p></div>
1024 </dd>
1025 <dt class="hdlist1">
1026 -M[&lt;n&gt;]
1027 </dt>
1028 <dt class="hdlist1">
1029 --find-renames[=&lt;n&gt;]
1030 </dt>
1031 <dd>
1033 Detect renames.
1034 If <tt>n</tt> is specified, it is a threshold on the similarity
1035 index (i.e. amount of addition/deletions compared to the
1036 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
1037 delete/add pair to be a rename if more than 90% of the file
1038 hasn&#8217;t changed.
1039 </p>
1040 </dd>
1041 <dt class="hdlist1">
1042 -C[&lt;n&gt;]
1043 </dt>
1044 <dt class="hdlist1">
1045 --find-copies[=&lt;n&gt;]
1046 </dt>
1047 <dd>
1049 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
1050 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
1051 </p>
1052 </dd>
1053 <dt class="hdlist1">
1054 --find-copies-harder
1055 </dt>
1056 <dd>
1058 For performance reasons, by default, <tt>-C</tt> option finds copies only
1059 if the original file of the copy was modified in the same
1060 changeset. This flag makes the command
1061 inspect unmodified files as candidates for the source of
1062 copy. This is a very expensive operation for large
1063 projects, so use it with caution. Giving more than one
1064 <tt>-C</tt> option has the same effect.
1065 </p>
1066 </dd>
1067 <dt class="hdlist1">
1069 </dt>
1070 <dt class="hdlist1">
1071 --irreversible-delete
1072 </dt>
1073 <dd>
1075 Omit the preimage for deletes, i.e. print only the header but not
1076 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
1077 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
1078 solely for people who want to just concentrate on reviewing the
1079 text after the change. In addition, the output obviously lack
1080 enough information to apply such a patch in reverse, even manually,
1081 hence the name of the option.
1082 </p>
1083 <div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
1084 of a delete/create pair.</p></div>
1085 </dd>
1086 <dt class="hdlist1">
1087 -l&lt;num&gt;
1088 </dt>
1089 <dd>
1091 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
1092 is the number of potential rename/copy targets. This
1093 option prevents rename/copy detection from running if
1094 the number of rename/copy targets exceeds the specified
1095 number.
1096 </p>
1097 </dd>
1098 <dt class="hdlist1">
1099 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1100 </dt>
1101 <dd>
1103 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
1104 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
1105 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
1106 are Unmerged (<tt>U</tt>), are
1107 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
1108 Any combination of the filter characters (including none) can be used.
1109 When <tt>*</tt> (All-or-none) is added to the combination, all
1110 paths are selected if there is any file that matches
1111 other criteria in the comparison; if there is no file
1112 that matches other criteria, nothing is selected.
1113 </p>
1114 </dd>
1115 <dt class="hdlist1">
1116 -S&lt;string&gt;
1117 </dt>
1118 <dd>
1120 Look for differences that introduce or remove an instance of
1121 &lt;string&gt;. Note that this is different than the string simply
1122 appearing in diff output; see the <em>pickaxe</em> entry in
1123 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
1124 </p>
1125 </dd>
1126 <dt class="hdlist1">
1127 -G&lt;regex&gt;
1128 </dt>
1129 <dd>
1131 Look for differences whose added or removed line matches
1132 the given &lt;regex&gt;.
1133 </p>
1134 </dd>
1135 <dt class="hdlist1">
1136 --pickaxe-all
1137 </dt>
1138 <dd>
1140 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
1141 changeset, not just the files that contain the change
1142 in &lt;string&gt;.
1143 </p>
1144 </dd>
1145 <dt class="hdlist1">
1146 --pickaxe-regex
1147 </dt>
1148 <dd>
1150 Make the &lt;string&gt; not a plain string but an extended POSIX
1151 regex to match.
1152 </p>
1153 </dd>
1154 <dt class="hdlist1">
1155 -O&lt;orderfile&gt;
1156 </dt>
1157 <dd>
1159 Output the patch in the order specified in the
1160 &lt;orderfile&gt;, which has one shell glob pattern per line.
1161 </p>
1162 </dd>
1163 <dt class="hdlist1">
1165 </dt>
1166 <dd>
1168 Swap two inputs; that is, show differences from index or
1169 on-disk file to tree contents.
1170 </p>
1171 </dd>
1172 <dt class="hdlist1">
1173 --relative[=&lt;path&gt;]
1174 </dt>
1175 <dd>
1177 When run from a subdirectory of the project, it can be
1178 told to exclude changes outside the directory and show
1179 pathnames relative to it with this option. When you are
1180 not in a subdirectory (e.g. in a bare repository), you
1181 can name which subdirectory to make the output relative
1182 to by giving a &lt;path&gt; as an argument.
1183 </p>
1184 </dd>
1185 <dt class="hdlist1">
1187 </dt>
1188 <dt class="hdlist1">
1189 --text
1190 </dt>
1191 <dd>
1193 Treat all files as text.
1194 </p>
1195 </dd>
1196 <dt class="hdlist1">
1197 --ignore-space-at-eol
1198 </dt>
1199 <dd>
1201 Ignore changes in whitespace at EOL.
1202 </p>
1203 </dd>
1204 <dt class="hdlist1">
1206 </dt>
1207 <dt class="hdlist1">
1208 --ignore-space-change
1209 </dt>
1210 <dd>
1212 Ignore changes in amount of whitespace. This ignores whitespace
1213 at line end, and considers all other sequences of one or
1214 more whitespace characters to be equivalent.
1215 </p>
1216 </dd>
1217 <dt class="hdlist1">
1219 </dt>
1220 <dt class="hdlist1">
1221 --ignore-all-space
1222 </dt>
1223 <dd>
1225 Ignore whitespace when comparing lines. This ignores
1226 differences even if one line has whitespace where the other
1227 line has none.
1228 </p>
1229 </dd>
1230 <dt class="hdlist1">
1231 --inter-hunk-context=&lt;lines&gt;
1232 </dt>
1233 <dd>
1235 Show the context between diff hunks, up to the specified number
1236 of lines, thereby fusing hunks that are close to each other.
1237 </p>
1238 </dd>
1239 <dt class="hdlist1">
1240 --exit-code
1241 </dt>
1242 <dd>
1244 Make the program exit with codes similar to diff(1).
1245 That is, it exits with 1 if there were differences and
1246 0 means no differences.
1247 </p>
1248 </dd>
1249 <dt class="hdlist1">
1250 --quiet
1251 </dt>
1252 <dd>
1254 Disable all output of the program. Implies <tt>--exit-code</tt>.
1255 </p>
1256 </dd>
1257 <dt class="hdlist1">
1258 --ext-diff
1259 </dt>
1260 <dd>
1262 Allow an external diff helper to be executed. If you set an
1263 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1264 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1265 </p>
1266 </dd>
1267 <dt class="hdlist1">
1268 --no-ext-diff
1269 </dt>
1270 <dd>
1272 Disallow external diff drivers.
1273 </p>
1274 </dd>
1275 <dt class="hdlist1">
1276 --textconv
1277 </dt>
1278 <dt class="hdlist1">
1279 --no-textconv
1280 </dt>
1281 <dd>
1283 Allow (or disallow) external text conversion filters to be run
1284 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1285 details. Because textconv filters are typically a one-way
1286 conversion, the resulting diff is suitable for human
1287 consumption, but cannot be applied. For this reason, textconv
1288 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1289 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1290 diff plumbing commands.
1291 </p>
1292 </dd>
1293 <dt class="hdlist1">
1294 --ignore-submodules[=&lt;when&gt;]
1295 </dt>
1296 <dd>
1298 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1299 either "none", "untracked", "dirty" or "all", which is the default
1300 Using "none" will consider the submodule modified when it either contains
1301 untracked or modified files or its HEAD differs from the commit recorded
1302 in the superproject and can be used to override any settings of the
1303 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1304 "untracked" is used submodules are not considered dirty when they only
1305 contain untracked content (but they are still scanned for modified
1306 content). Using "dirty" ignores all changes to the work tree of submodules,
1307 only changes to the commits stored in the superproject are shown (this was
1308 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1309 </p>
1310 </dd>
1311 <dt class="hdlist1">
1312 --src-prefix=&lt;prefix&gt;
1313 </dt>
1314 <dd>
1316 Show the given source prefix instead of "a/".
1317 </p>
1318 </dd>
1319 <dt class="hdlist1">
1320 --dst-prefix=&lt;prefix&gt;
1321 </dt>
1322 <dd>
1324 Show the given destination prefix instead of "b/".
1325 </p>
1326 </dd>
1327 <dt class="hdlist1">
1328 --no-prefix
1329 </dt>
1330 <dd>
1332 Do not show any source or destination prefix.
1333 </p>
1334 </dd>
1335 </dl></div>
1336 <div class="paragraph"><p>For more detailed explanation on these common options, see also
1337 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
1338 <div class="dlist"><dl>
1339 <dt class="hdlist1">
1340 &lt;tree-ish&gt;
1341 </dt>
1342 <dd>
1344 The id of a tree object.
1345 </p>
1346 </dd>
1347 <dt class="hdlist1">
1348 &lt;path&gt;&#8230;
1349 </dt>
1350 <dd>
1352 If provided, the results are limited to a subset of files
1353 matching one of these prefix strings.
1354 i.e., file matches <tt>/^&lt;pattern1&gt;|&lt;pattern2&gt;|&#8230;/</tt>
1355 Note that this parameter does not provide any wildcard or regexp
1356 features.
1357 </p>
1358 </dd>
1359 <dt class="hdlist1">
1361 </dt>
1362 <dd>
1364 recurse into sub-trees
1365 </p>
1366 </dd>
1367 <dt class="hdlist1">
1369 </dt>
1370 <dd>
1372 show tree entry itself as well as subtrees. Implies -r.
1373 </p>
1374 </dd>
1375 <dt class="hdlist1">
1376 --root
1377 </dt>
1378 <dd>
1380 When <em>--root</em> is specified the initial commit will be shown as a big
1381 creation event. This is equivalent to a diff against the NULL tree.
1382 </p>
1383 </dd>
1384 <dt class="hdlist1">
1385 --stdin
1386 </dt>
1387 <dd>
1389 When <em>--stdin</em> is specified, the command does not take
1390 &lt;tree-ish&gt; arguments from the command line. Instead, it
1391 reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a
1392 list of &lt;commit&gt; from its standard input. (Use a single space
1393 as separator.)
1394 </p>
1395 <div class="paragraph"><p>When two trees are given, it compares the first tree with the second.
1396 When a single commit is given, it compares the commit with its
1397 parents. The remaining commits, when given, are used as if they are
1398 parents of the first commit.</p></div>
1399 <div class="paragraph"><p>When comparing two trees, the ID of both trees (separated by a space
1400 and terminated by a newline) is printed before the difference. When
1401 comparing commits, the ID of the first (or only) commit, followed by a
1402 newline, is printed.</p></div>
1403 <div class="paragraph"><p>The following flags further affect the behavior when comparing
1404 commits (but not trees).</p></div>
1405 </dd>
1406 <dt class="hdlist1">
1408 </dt>
1409 <dd>
1411 By default, <em>git diff-tree --stdin</em> does not show
1412 differences for merge commits. With this flag, it shows
1413 differences to that commit from all of its parents. See
1414 also <em>-c</em>.
1415 </p>
1416 </dd>
1417 <dt class="hdlist1">
1419 </dt>
1420 <dd>
1422 By default, <em>git diff-tree --stdin</em> shows differences,
1423 either in machine-readable form (without <em>-p</em>) or in patch
1424 form (with <em>-p</em>). This output can be suppressed. It is
1425 only useful with <em>-v</em> flag.
1426 </p>
1427 </dd>
1428 <dt class="hdlist1">
1430 </dt>
1431 <dd>
1433 This flag causes <em>git diff-tree --stdin</em> to also show
1434 the commit message before the differences.
1435 </p>
1436 </dd>
1437 <dt class="hdlist1">
1438 --pretty[=&lt;format&gt;]
1439 </dt>
1440 <dt class="hdlist1">
1441 --format=&lt;format&gt;
1442 </dt>
1443 <dd>
1445 Pretty-print the contents of the commit logs in a given format,
1446 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
1447 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>. See
1448 the "PRETTY FORMATS" section for some additional details for each
1449 format. When omitted, the format defaults to <em>medium</em>.
1450 </p>
1451 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
1452 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
1453 </dd>
1454 <dt class="hdlist1">
1455 --abbrev-commit
1456 </dt>
1457 <dd>
1459 Instead of showing the full 40-byte hexadecimal commit object
1460 name, show only a partial prefix. Non default number of
1461 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
1462 diff output, if it is displayed).
1463 </p>
1464 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
1465 people using 80-column terminals.</p></div>
1466 </dd>
1467 <dt class="hdlist1">
1468 --no-abbrev-commit
1469 </dt>
1470 <dd>
1472 Show the full 40-byte hexadecimal commit object name. This negates
1473 <tt>--abbrev-commit</tt> and those options which imply it such as
1474 "--oneline". It also overrides the <em>log.abbrevCommit</em> variable.
1475 </p>
1476 </dd>
1477 <dt class="hdlist1">
1478 --oneline
1479 </dt>
1480 <dd>
1482 This is a shorthand for "--pretty=oneline --abbrev-commit"
1483 used together.
1484 </p>
1485 </dd>
1486 <dt class="hdlist1">
1487 --encoding[=&lt;encoding&gt;]
1488 </dt>
1489 <dd>
1491 The commit objects record the encoding used for the log message
1492 in their encoding header; this option can be used to tell the
1493 command to re-code the commit log message in the encoding
1494 preferred by the user. For non plumbing commands this
1495 defaults to UTF-8.
1496 </p>
1497 </dd>
1498 <dt class="hdlist1">
1499 --notes[=&lt;ref&gt;]
1500 </dt>
1501 <dd>
1503 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
1504 commit, when showing the commit log message. This is the default
1505 for <tt>git log</tt>, <tt>git show</tt> and <tt>git whatchanged</tt> commands when
1506 there is no <tt>--pretty</tt>, <tt>--format</tt> nor <tt>--oneline</tt> option given
1507 on the command line.
1508 </p>
1509 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
1510 <em>core.notesRef</em> and <em>notes.displayRef</em> variables (or corresponding
1511 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
1512 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, show this notes ref instead of the
1513 default notes ref(s). The ref is taken to be in <tt>refs/notes/</tt> if it
1514 is not qualified.</p></div>
1515 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
1516 being displayed. Examples: "--notes=foo" will show only notes from
1517 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
1518 "refs/notes/foo" and from the default notes ref(s).</p></div>
1519 </dd>
1520 <dt class="hdlist1">
1521 --no-notes
1522 </dt>
1523 <dd>
1525 Do not show notes. This negates the above <tt>--notes</tt> option, by
1526 resetting the list of notes refs from which notes are shown.
1527 Options are parsed in the order given on the command line, so e.g.
1528 "--notes --notes=foo --no-notes --notes=bar" will only show notes
1529 from "refs/notes/bar".
1530 </p>
1531 </dd>
1532 <dt class="hdlist1">
1533 --show-notes[=&lt;ref&gt;]
1534 </dt>
1535 <dt class="hdlist1">
1536 --[no-]standard-notes
1537 </dt>
1538 <dd>
1540 These options are deprecated. Use the above --notes/--no-notes
1541 options instead.
1542 </p>
1543 </dd>
1544 <dt class="hdlist1">
1545 --no-commit-id
1546 </dt>
1547 <dd>
1549 <em>git diff-tree</em> outputs a line with the commit ID when
1550 applicable. This flag suppressed the commit ID output.
1551 </p>
1552 </dd>
1553 <dt class="hdlist1">
1555 </dt>
1556 <dd>
1558 This flag changes the way a merge commit is displayed
1559 (which means it is useful only when the command is given
1560 one &lt;tree-ish&gt;, or <em>--stdin</em>). It shows the differences
1561 from each of the parents to the merge result simultaneously
1562 instead of showing pairwise diff between a parent and the
1563 result one at a time (which is what the <em>-m</em> option does).
1564 Furthermore, it lists only files which were modified
1565 from all parents.
1566 </p>
1567 </dd>
1568 <dt class="hdlist1">
1569 --cc
1570 </dt>
1571 <dd>
1573 This flag changes the way a merge commit patch is displayed,
1574 in a similar way to the <em>-c</em> option. It implies the <em>-c</em>
1575 and <em>-p</em> options and further compresses the patch output
1576 by omitting uninteresting hunks whose the contents in the parents
1577 have only two variants and the merge result picks one of them
1578 without modification. When all hunks are uninteresting, the commit
1579 itself and the commit log message is not shown, just like in any other
1580 "empty diff" case.
1581 </p>
1582 </dd>
1583 <dt class="hdlist1">
1584 --always
1585 </dt>
1586 <dd>
1588 Show the commit itself and the commit log message even
1589 if the diff itself is empty.
1590 </p>
1591 </dd>
1592 </dl></div>
1593 </div>
1594 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
1595 <div class="sectionbody">
1596 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
1597 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1598 inserted before the <em>Author:</em> line. This line begins with
1599 "Merge: " and the sha1s of ancestral commits are printed,
1600 separated by spaces. Note that the listed commits may not
1601 necessarily be the list of the <strong>direct</strong> parent commits if you
1602 have limited your view of history: for example, if you are
1603 only interested in changes related to a certain directory or
1604 file.</p></div>
1605 <div class="paragraph"><p>There are several built-in formats, and you can define
1606 additional formats by setting a pretty.&lt;name&gt;
1607 config option to either another format name, or a
1608 <em>format:</em> string, as described below (see
1609 <a href="git-config.html">git-config(1)</a>). Here are the details of the
1610 built-in formats:</p></div>
1611 <div class="ulist"><ul>
1612 <li>
1614 <em>oneline</em>
1615 </p>
1616 <div class="literalblock">
1617 <div class="content">
1618 <pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
1619 </div></div>
1620 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
1621 </li>
1622 <li>
1624 <em>short</em>
1625 </p>
1626 <div class="literalblock">
1627 <div class="content">
1628 <pre><tt>commit &lt;sha1&gt;
1629 Author: &lt;author&gt;</tt></pre>
1630 </div></div>
1631 <div class="literalblock">
1632 <div class="content">
1633 <pre><tt>&lt;title line&gt;</tt></pre>
1634 </div></div>
1635 </li>
1636 <li>
1638 <em>medium</em>
1639 </p>
1640 <div class="literalblock">
1641 <div class="content">
1642 <pre><tt>commit &lt;sha1&gt;
1643 Author: &lt;author&gt;
1644 Date: &lt;author date&gt;</tt></pre>
1645 </div></div>
1646 <div class="literalblock">
1647 <div class="content">
1648 <pre><tt>&lt;title line&gt;</tt></pre>
1649 </div></div>
1650 <div class="literalblock">
1651 <div class="content">
1652 <pre><tt>&lt;full commit message&gt;</tt></pre>
1653 </div></div>
1654 </li>
1655 <li>
1657 <em>full</em>
1658 </p>
1659 <div class="literalblock">
1660 <div class="content">
1661 <pre><tt>commit &lt;sha1&gt;
1662 Author: &lt;author&gt;
1663 Commit: &lt;committer&gt;</tt></pre>
1664 </div></div>
1665 <div class="literalblock">
1666 <div class="content">
1667 <pre><tt>&lt;title line&gt;</tt></pre>
1668 </div></div>
1669 <div class="literalblock">
1670 <div class="content">
1671 <pre><tt>&lt;full commit message&gt;</tt></pre>
1672 </div></div>
1673 </li>
1674 <li>
1676 <em>fuller</em>
1677 </p>
1678 <div class="literalblock">
1679 <div class="content">
1680 <pre><tt>commit &lt;sha1&gt;
1681 Author: &lt;author&gt;
1682 AuthorDate: &lt;author date&gt;
1683 Commit: &lt;committer&gt;
1684 CommitDate: &lt;committer date&gt;</tt></pre>
1685 </div></div>
1686 <div class="literalblock">
1687 <div class="content">
1688 <pre><tt>&lt;title line&gt;</tt></pre>
1689 </div></div>
1690 <div class="literalblock">
1691 <div class="content">
1692 <pre><tt>&lt;full commit message&gt;</tt></pre>
1693 </div></div>
1694 </li>
1695 <li>
1697 <em>email</em>
1698 </p>
1699 <div class="literalblock">
1700 <div class="content">
1701 <pre><tt>From &lt;sha1&gt; &lt;date&gt;
1702 From: &lt;author&gt;
1703 Date: &lt;author date&gt;
1704 Subject: [PATCH] &lt;title line&gt;</tt></pre>
1705 </div></div>
1706 <div class="literalblock">
1707 <div class="content">
1708 <pre><tt>&lt;full commit message&gt;</tt></pre>
1709 </div></div>
1710 </li>
1711 <li>
1713 <em>raw</em>
1714 </p>
1715 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
1716 stored in the commit object. Notably, the SHA1s are
1717 displayed in full, regardless of whether --abbrev or
1718 --no-abbrev are used, and <em>parents</em> information show the
1719 true parent commits, without taking grafts nor history
1720 simplification into account.</p></div>
1721 </li>
1722 <li>
1724 <em>format:&lt;string&gt;</em>
1725 </p>
1726 <div class="paragraph"><p>The <em>format:&lt;string&gt;</em> format allows you to specify which information
1727 you want to show. It works a little bit like printf format,
1728 with the notable exception that you get a newline with <em>%n</em>
1729 instead of <em>\n</em>.</p></div>
1730 <div class="paragraph"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
1731 would show something like this:</p></div>
1732 <div class="listingblock">
1733 <div class="content">
1734 <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
1735 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</tt></pre>
1736 </div></div>
1737 <div class="paragraph"><p>The placeholders are:</p></div>
1738 <div class="ulist"><ul>
1739 <li>
1741 <em>%H</em>: commit hash
1742 </p>
1743 </li>
1744 <li>
1746 <em>%h</em>: abbreviated commit hash
1747 </p>
1748 </li>
1749 <li>
1751 <em>%T</em>: tree hash
1752 </p>
1753 </li>
1754 <li>
1756 <em>%t</em>: abbreviated tree hash
1757 </p>
1758 </li>
1759 <li>
1761 <em>%P</em>: parent hashes
1762 </p>
1763 </li>
1764 <li>
1766 <em>%p</em>: abbreviated parent hashes
1767 </p>
1768 </li>
1769 <li>
1771 <em>%an</em>: author name
1772 </p>
1773 </li>
1774 <li>
1776 <em>%aN</em>: author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1777 </p>
1778 </li>
1779 <li>
1781 <em>%ae</em>: author email
1782 </p>
1783 </li>
1784 <li>
1786 <em>%aE</em>: author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1787 </p>
1788 </li>
1789 <li>
1791 <em>%ad</em>: author date (format respects --date= option)
1792 </p>
1793 </li>
1794 <li>
1796 <em>%aD</em>: author date, RFC2822 style
1797 </p>
1798 </li>
1799 <li>
1801 <em>%ar</em>: author date, relative
1802 </p>
1803 </li>
1804 <li>
1806 <em>%at</em>: author date, UNIX timestamp
1807 </p>
1808 </li>
1809 <li>
1811 <em>%ai</em>: author date, ISO 8601 format
1812 </p>
1813 </li>
1814 <li>
1816 <em>%cn</em>: committer name
1817 </p>
1818 </li>
1819 <li>
1821 <em>%cN</em>: committer name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1822 </p>
1823 </li>
1824 <li>
1826 <em>%ce</em>: committer email
1827 </p>
1828 </li>
1829 <li>
1831 <em>%cE</em>: committer email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
1832 </p>
1833 </li>
1834 <li>
1836 <em>%cd</em>: committer date
1837 </p>
1838 </li>
1839 <li>
1841 <em>%cD</em>: committer date, RFC2822 style
1842 </p>
1843 </li>
1844 <li>
1846 <em>%cr</em>: committer date, relative
1847 </p>
1848 </li>
1849 <li>
1851 <em>%ct</em>: committer date, UNIX timestamp
1852 </p>
1853 </li>
1854 <li>
1856 <em>%ci</em>: committer date, ISO 8601 format
1857 </p>
1858 </li>
1859 <li>
1861 <em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
1862 </p>
1863 </li>
1864 <li>
1866 <em>%e</em>: encoding
1867 </p>
1868 </li>
1869 <li>
1871 <em>%s</em>: subject
1872 </p>
1873 </li>
1874 <li>
1876 <em>%f</em>: sanitized subject line, suitable for a filename
1877 </p>
1878 </li>
1879 <li>
1881 <em>%b</em>: body
1882 </p>
1883 </li>
1884 <li>
1886 <em>%B</em>: raw body (unwrapped subject and body)
1887 </p>
1888 </li>
1889 <li>
1891 <em>%N</em>: commit notes
1892 </p>
1893 </li>
1894 <li>
1896 <em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
1897 </p>
1898 </li>
1899 <li>
1901 <em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
1902 </p>
1903 </li>
1904 <li>
1906 <em>%gs</em>: reflog subject
1907 </p>
1908 </li>
1909 <li>
1911 <em>%Cred</em>: switch color to red
1912 </p>
1913 </li>
1914 <li>
1916 <em>%Cgreen</em>: switch color to green
1917 </p>
1918 </li>
1919 <li>
1921 <em>%Cblue</em>: switch color to blue
1922 </p>
1923 </li>
1924 <li>
1926 <em>%Creset</em>: reset color
1927 </p>
1928 </li>
1929 <li>
1931 <em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
1932 </p>
1933 </li>
1934 <li>
1936 <em>%m</em>: left, right or boundary mark
1937 </p>
1938 </li>
1939 <li>
1941 <em>%n</em>: newline
1942 </p>
1943 </li>
1944 <li>
1946 <em>%%</em>: a raw <em>%</em>
1947 </p>
1948 </li>
1949 <li>
1951 <em>%x00</em>: print a byte from a hex code
1952 </p>
1953 </li>
1954 <li>
1956 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
1957 <a href="git-shortlog.html">git-shortlog(1)</a>.
1958 </p>
1959 </li>
1960 </ul></div>
1961 </li>
1962 </ul></div>
1963 <div class="admonitionblock">
1964 <table><tr>
1965 <td class="icon">
1966 <div class="title">Note</div>
1967 </td>
1968 <td class="content">Some placeholders may depend on other options given to the
1969 revision traversal engine. For example, the <tt>%g*</tt> reflog options will
1970 insert an empty string unless we are traversing reflog entries (e.g., by
1971 <tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
1972 format if <tt>--decorate</tt> was not already provided on the command line.</td>
1973 </tr></table>
1974 </div>
1975 <div class="paragraph"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
1976 is inserted immediately before the expansion if and only if the
1977 placeholder expands to a non-empty string.</p></div>
1978 <div class="paragraph"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
1979 immediately precede the expansion are deleted if and only if the
1980 placeholder expands to an empty string.</p></div>
1981 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
1982 is inserted immediately before the expansion if and only if the
1983 placeholder expands to a non-empty string.</p></div>
1984 <div class="ulist"><ul>
1985 <li>
1987 <em>tformat:</em>
1988 </p>
1989 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
1990 provides "terminator" semantics instead of "separator" semantics. In
1991 other words, each commit has the message terminator character (usually a
1992 newline) appended, rather than a separator placed between entries.
1993 This means that the final entry of a single-line format will be properly
1994 terminated with a new line, just as the "oneline" format does.
1995 For example:</p></div>
1996 <div class="listingblock">
1997 <div class="content">
1998 <pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
1999 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
2000 4da45be
2001 7134973 -- NO NEWLINE
2003 $ git log -2 --pretty=tformat:%h 4da45bef \
2004 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
2005 4da45be
2006 7134973</tt></pre>
2007 </div></div>
2008 <div class="paragraph"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
2009 as if it has <tt>tformat:</tt> in front of it. For example, these two are
2010 equivalent:</p></div>
2011 <div class="listingblock">
2012 <div class="content">
2013 <pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
2014 $ git log -2 --pretty=%h 4da45bef</tt></pre>
2015 </div></div>
2016 </li>
2017 </ul></div>
2018 </div>
2019 <h2 id="_limiting_output">Limiting Output</h2>
2020 <div class="sectionbody">
2021 <div class="paragraph"><p>If you&#8217;re only interested in differences in a subset of files, for
2022 example some architecture-specific files, you might do:</p></div>
2023 <div class="literalblock">
2024 <div class="content">
2025 <pre><tt>git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; arch/ia64 include/asm-ia64</tt></pre>
2026 </div></div>
2027 <div class="paragraph"><p>and it will only show you what changed in those two directories.</p></div>
2028 <div class="paragraph"><p>Or if you are searching for what changed in just <tt>kernel/sched.c</tt>, just do</p></div>
2029 <div class="literalblock">
2030 <div class="content">
2031 <pre><tt>git diff-tree -r &lt;tree-ish&gt; &lt;tree-ish&gt; kernel/sched.c</tt></pre>
2032 </div></div>
2033 <div class="paragraph"><p>and it will ignore all differences to other files.</p></div>
2034 <div class="paragraph"><p>The pattern is always the prefix, and is matched exactly. There are no
2035 wildcards. Even stricter, it has to match a complete path component.
2036 I.e. "foo" does not pick up <tt>foobar.h</tt>. "foo" does match <tt>foo/bar.h</tt>
2037 so it can be used to name subdirectories.</p></div>
2038 <div class="paragraph"><p>An example of normal usage is:</p></div>
2039 <div class="literalblock">
2040 <div class="content">
2041 <pre><tt>torvalds@ppc970:~/git&gt; git diff-tree --abbrev 5319e4
2042 :100664 100664 ac348b... a01513... git-fsck-objects.c</tt></pre>
2043 </div></div>
2044 <div class="paragraph"><p>which tells you that the last commit changed just one file (it&#8217;s from
2045 this one:</p></div>
2046 <div class="listingblock">
2047 <div class="content">
2048 <pre><tt>commit 3c6f7ca19ad4043e9e72fa94106f352897e651a8
2049 tree 5319e4d609cdd282069cc4dce33c1db559539b03
2050 parent b4e628ea30d5ab3606119d2ea5caeab141d38df7
2051 author Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
2052 committer Linus Torvalds &lt;torvalds@ppc970.osdl.org&gt; Sat Apr 9 12:02:30 2005
2054 Make "git-fsck-objects" print out all the root commits it finds.
2056 Once I do the reference tracking, I'll also make it print out all the
2057 HEAD commits it finds, which is even more interesting.</tt></pre>
2058 </div></div>
2059 <div class="paragraph"><p>in case you care).</p></div>
2060 </div>
2061 <h2 id="_raw_output_format">Raw output format</h2>
2062 <div class="sectionbody">
2063 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
2064 "git-diff-files" and "git diff --raw" are very similar.</p></div>
2065 <div class="paragraph"><p>These commands all compare two sets of things; what is
2066 compared differs:</p></div>
2067 <div class="dlist"><dl>
2068 <dt class="hdlist1">
2069 git-diff-index &lt;tree-ish&gt;
2070 </dt>
2071 <dd>
2073 compares the &lt;tree-ish&gt; and the files on the filesystem.
2074 </p>
2075 </dd>
2076 <dt class="hdlist1">
2077 git-diff-index --cached &lt;tree-ish&gt;
2078 </dt>
2079 <dd>
2081 compares the &lt;tree-ish&gt; and the index.
2082 </p>
2083 </dd>
2084 <dt class="hdlist1">
2085 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
2086 </dt>
2087 <dd>
2089 compares the trees named by the two arguments.
2090 </p>
2091 </dd>
2092 <dt class="hdlist1">
2093 git-diff-files [&lt;pattern&gt;&#8230;]
2094 </dt>
2095 <dd>
2097 compares the index and the files on the filesystem.
2098 </p>
2099 </dd>
2100 </dl></div>
2101 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
2102 what is being compared. After that, all the commands print one output
2103 line per changed file.</p></div>
2104 <div class="paragraph"><p>An output line is formatted this way:</p></div>
2105 <div class="listingblock">
2106 <div class="content">
2107 <pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
2108 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
2109 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
2110 create :000000 100644 0000000... 1234567... A file4
2111 delete :100644 000000 1234567... 0000000... D file5
2112 unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
2113 </div></div>
2114 <div class="paragraph"><p>That is, from the left to the right:</p></div>
2115 <div class="olist arabic"><ol class="arabic">
2116 <li>
2118 a colon.
2119 </p>
2120 </li>
2121 <li>
2123 mode for "src"; 000000 if creation or unmerged.
2124 </p>
2125 </li>
2126 <li>
2128 a space.
2129 </p>
2130 </li>
2131 <li>
2133 mode for "dst"; 000000 if deletion or unmerged.
2134 </p>
2135 </li>
2136 <li>
2138 a space.
2139 </p>
2140 </li>
2141 <li>
2143 sha1 for "src"; 0{40} if creation or unmerged.
2144 </p>
2145 </li>
2146 <li>
2148 a space.
2149 </p>
2150 </li>
2151 <li>
2153 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
2154 </p>
2155 </li>
2156 <li>
2158 a space.
2159 </p>
2160 </li>
2161 <li>
2163 status, followed by optional "score" number.
2164 </p>
2165 </li>
2166 <li>
2168 a tab or a NUL when <em>-z</em> option is used.
2169 </p>
2170 </li>
2171 <li>
2173 path for "src"
2174 </p>
2175 </li>
2176 <li>
2178 a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
2179 </p>
2180 </li>
2181 <li>
2183 path for "dst"; only exists for C or R.
2184 </p>
2185 </li>
2186 <li>
2188 an LF or a NUL when <em>-z</em> option is used, to terminate the record.
2189 </p>
2190 </li>
2191 </ol></div>
2192 <div class="paragraph"><p>Possible status letters are:</p></div>
2193 <div class="ulist"><ul>
2194 <li>
2196 A: addition of a file
2197 </p>
2198 </li>
2199 <li>
2201 C: copy of a file into a new one
2202 </p>
2203 </li>
2204 <li>
2206 D: deletion of a file
2207 </p>
2208 </li>
2209 <li>
2211 M: modification of the contents or mode of a file
2212 </p>
2213 </li>
2214 <li>
2216 R: renaming of a file
2217 </p>
2218 </li>
2219 <li>
2221 T: change in the type of the file
2222 </p>
2223 </li>
2224 <li>
2226 U: file is unmerged (you must complete the merge before it can
2227 be committed)
2228 </p>
2229 </li>
2230 <li>
2232 X: "unknown" change type (most probably a bug, please report it)
2233 </p>
2234 </li>
2235 </ul></div>
2236 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
2237 percentage of similarity between the source and target of the move or
2238 copy), and are the only ones to be so.</p></div>
2239 <div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
2240 and it is out of sync with the index.</p></div>
2241 <div class="paragraph"><p>Example:</p></div>
2242 <div class="listingblock">
2243 <div class="content">
2244 <pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
2245 </div></div>
2246 <div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
2247 in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
2248 respectively.</p></div>
2249 </div>
2250 <h2 id="_diff_format_for_merges">diff format for merges</h2>
2251 <div class="sectionbody">
2252 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
2253 can take <em>-c</em> or <em>--cc</em> option
2254 to generate diff output also for merge commits. The output differs
2255 from the format described above in the following way:</p></div>
2256 <div class="olist arabic"><ol class="arabic">
2257 <li>
2259 there is a colon for each parent
2260 </p>
2261 </li>
2262 <li>
2264 there are more "src" modes and "src" sha1
2265 </p>
2266 </li>
2267 <li>
2269 status is concatenated status characters for each parent
2270 </p>
2271 </li>
2272 <li>
2274 no optional "score" number
2275 </p>
2276 </li>
2277 <li>
2279 single path, only for "dst"
2280 </p>
2281 </li>
2282 </ol></div>
2283 <div class="paragraph"><p>Example:</p></div>
2284 <div class="listingblock">
2285 <div class="content">
2286 <pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
2287 </div></div>
2288 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
2289 all parents.</p></div>
2290 </div>
2291 <h2 id="_generating_patches_with_p">Generating patches with -p</h2>
2292 <div class="sectionbody">
2293 <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
2294 with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
2295 "git log" with the "-p" option, they
2296 do not produce the output described above; instead they produce a
2297 patch file. You can customize the creation of such patches via the
2298 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2299 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
2300 diff format:</p></div>
2301 <div class="olist arabic"><ol class="arabic">
2302 <li>
2304 It is preceded with a "git diff" header that looks like this:
2305 </p>
2306 <div class="literalblock">
2307 <div class="content">
2308 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2309 </div></div>
2310 <div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2311 involved. Especially, even for a creation or a deletion,
2312 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2313 <div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2314 name of the source file of the rename/copy and the name of
2315 the file that rename/copy produces, respectively.</p></div>
2316 </li>
2317 <li>
2319 It is followed by one or more extended header lines:
2320 </p>
2321 <div class="literalblock">
2322 <div class="content">
2323 <pre><tt>old mode &lt;mode&gt;
2324 new mode &lt;mode&gt;
2325 deleted file mode &lt;mode&gt;
2326 new file mode &lt;mode&gt;
2327 copy from &lt;path&gt;
2328 copy to &lt;path&gt;
2329 rename from &lt;path&gt;
2330 rename to &lt;path&gt;
2331 similarity index &lt;number&gt;
2332 dissimilarity index &lt;number&gt;
2333 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
2334 </div></div>
2335 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
2336 and file permission bits.</p></div>
2337 <div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2338 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
2339 the dissimilarity index is the percentage of changed lines. It
2340 is a rounded down integer, followed by a percent sign. The
2341 similarity index value of 100% is thus reserved for two equal
2342 files, while 100% dissimilarity means that no line from the old
2343 file made it into the new one.</p></div>
2344 <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
2345 The &lt;mode&gt; is included if the file mode does not change; otherwise,
2346 separate lines indicate the old and the new mode.</p></div>
2347 </li>
2348 <li>
2350 TAB, LF, double quote and backslash characters in pathnames
2351 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
2352 If there is need for such substitution then the whole
2353 pathname is put in double quotes.
2354 </p>
2355 </li>
2356 <li>
2358 All the <tt>file1</tt> files in the output refer to files before the
2359 commit, and all the <tt>file2</tt> files refer to files after the commit.
2360 It is incorrect to apply each change to each file sequentially. For
2361 example, this patch will swap a and b:
2362 </p>
2363 <div class="literalblock">
2364 <div class="content">
2365 <pre><tt>diff --git a/a b/b
2366 rename from a
2367 rename to b
2368 diff --git a/b b/a
2369 rename from b
2370 rename to a</tt></pre>
2371 </div></div>
2372 </li>
2373 </ol></div>
2374 </div>
2375 <h2 id="_combined_diff_format">combined diff format</h2>
2376 <div class="sectionbody">
2377 <div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
2378 produce a <em>combined diff</em> when showing a merge. This is the default
2379 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
2380 <a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
2381 of these commands to force generation of diffs with individual parents
2382 of a merge.</p></div>
2383 <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
2384 <div class="listingblock">
2385 <div class="content">
2386 <pre><tt>diff --combined describe.c
2387 index fabadb8,cc95eb0..4866510
2388 --- a/describe.c
2389 +++ b/describe.c
2390 @@@ -98,20 -98,12 +98,20 @@@
2391 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
2394 - static void describe(char *arg)
2395 -static void describe(struct commit *cmit, int last_one)
2396 ++static void describe(char *arg, int last_one)
2398 + unsigned char sha1[20];
2399 + struct commit *cmit;
2400 struct commit_list *list;
2401 static int initialized = 0;
2402 struct commit_name *n;
2404 + if (get_sha1(arg, sha1) &lt; 0)
2405 + usage(describe_usage);
2406 + cmit = lookup_commit_reference(sha1);
2407 + if (!cmit)
2408 + usage(describe_usage);
2410 if (!initialized) {
2411 initialized = 1;
2412 for_each_ref(get_name);</tt></pre>
2413 </div></div>
2414 <div class="olist arabic"><ol class="arabic">
2415 <li>
2417 It is preceded with a "git diff" header, that looks like
2418 this (when <em>-c</em> option is used):
2419 </p>
2420 <div class="literalblock">
2421 <div class="content">
2422 <pre><tt>diff --combined file</tt></pre>
2423 </div></div>
2424 <div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
2425 <div class="literalblock">
2426 <div class="content">
2427 <pre><tt>diff --cc file</tt></pre>
2428 </div></div>
2429 </li>
2430 <li>
2432 It is followed by one or more extended header lines
2433 (this example shows a merge with two parents):
2434 </p>
2435 <div class="literalblock">
2436 <div class="content">
2437 <pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
2438 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2439 new file mode &lt;mode&gt;
2440 deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
2441 </div></div>
2442 <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
2443 the &lt;mode&gt; is different from the rest. Extended headers with
2444 information about detected contents movement (renames and
2445 copying detection) are designed to work with diff of two
2446 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
2447 </li>
2448 <li>
2450 It is followed by two-line from-file/to-file header
2451 </p>
2452 <div class="literalblock">
2453 <div class="content">
2454 <pre><tt>--- a/file
2455 +++ b/file</tt></pre>
2456 </div></div>
2457 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
2458 format, <tt>/dev/null</tt> is used to signal created or deleted
2459 files.</p></div>
2460 </li>
2461 <li>
2463 Chunk header format is modified to prevent people from
2464 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
2465 was created for review of merge commit changes, and was not
2466 meant for apply. The change is similar to the change in the
2467 extended <em>index</em> header:
2468 </p>
2469 <div class="literalblock">
2470 <div class="content">
2471 <pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
2472 </div></div>
2473 <div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
2474 header for combined diff format.</p></div>
2475 </li>
2476 </ol></div>
2477 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
2478 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
2479 added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
2480 compares two or more files file1, file2,&#8230; with one file X, and
2481 shows how X differs from each of fileN. One column for each of
2482 fileN is prepended to the output line to note how X&#8217;s line is
2483 different from it.</p></div>
2484 <div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
2485 fileN but it does not appear in the result. A <tt>+</tt> character
2486 in the column N means that the line appears in the result,
2487 and fileN does not have that line (in other words, the line was
2488 added, from the point of view of that parent).</p></div>
2489 <div class="paragraph"><p>In the above example output, the function signature was changed
2490 from both files (hence two <tt>-</tt> removals from both file1 and
2491 file2, plus <tt>++</tt> to mean one line that was added does not appear
2492 in either file1 nor file2). Also eight other lines are the same
2493 from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
2494 <div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
2495 merge commit with the merge result (i.e. file1..fileN are the
2496 parents). When shown by <tt>git diff-files -c</tt>, it compares the
2497 two unresolved merge parents with the working tree file
2498 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
2499 "their version").</p></div>
2500 </div>
2501 <h2 id="_other_diff_formats">other diff formats</h2>
2502 <div class="sectionbody">
2503 <div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
2504 copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
2505 output. These options can be combined with other options, such as
2506 <tt>-p</tt>, and are meant for human consumption.</p></div>
2507 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
2508 formats the pathnames compactly by combining common prefix and suffix of
2509 the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
2510 <tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
2511 <div class="listingblock">
2512 <div class="content">
2513 <pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
2514 </div></div>
2515 <div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
2516 for easier machine consumption. An entry in <tt>--numstat</tt> output looks
2517 like this:</p></div>
2518 <div class="listingblock">
2519 <div class="content">
2520 <pre><tt>1 2 README
2521 3 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
2522 </div></div>
2523 <div class="paragraph"><p>That is, from left to right:</p></div>
2524 <div class="olist arabic"><ol class="arabic">
2525 <li>
2527 the number of added lines;
2528 </p>
2529 </li>
2530 <li>
2532 a tab;
2533 </p>
2534 </li>
2535 <li>
2537 the number of deleted lines;
2538 </p>
2539 </li>
2540 <li>
2542 a tab;
2543 </p>
2544 </li>
2545 <li>
2547 pathname (possibly with rename/copy information);
2548 </p>
2549 </li>
2550 <li>
2552 a newline.
2553 </p>
2554 </li>
2555 </ol></div>
2556 <div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
2557 <div class="listingblock">
2558 <div class="content">
2559 <pre><tt>1 2 README NUL
2560 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
2561 </div></div>
2562 <div class="paragraph"><p>That is:</p></div>
2563 <div class="olist arabic"><ol class="arabic">
2564 <li>
2566 the number of added lines;
2567 </p>
2568 </li>
2569 <li>
2571 a tab;
2572 </p>
2573 </li>
2574 <li>
2576 the number of deleted lines;
2577 </p>
2578 </li>
2579 <li>
2581 a tab;
2582 </p>
2583 </li>
2584 <li>
2586 a NUL (only exists if renamed/copied);
2587 </p>
2588 </li>
2589 <li>
2591 pathname in preimage;
2592 </p>
2593 </li>
2594 <li>
2596 a NUL (only exists if renamed/copied);
2597 </p>
2598 </li>
2599 <li>
2601 pathname in postimage (only exists if renamed/copied);
2602 </p>
2603 </li>
2604 <li>
2606 a NUL.
2607 </p>
2608 </li>
2609 </ol></div>
2610 <div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
2611 scripts that read the output to tell if the current record being read is
2612 a single-path record or a rename/copy record without reading ahead.
2613 After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
2614 the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
2615 </div>
2616 <h2 id="_git">GIT</h2>
2617 <div class="sectionbody">
2618 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2619 </div>
2620 </div>
2621 <div id="footnotes"><hr /></div>
2622 <div id="footer">
2623 <div id="footer-text">
2624 Last updated 2011-09-21 23:01:14 PDT
2625 </div>
2626 </div>
2627 </body>
2628 </html>