Autogenerated HTML docs for v2.41.0-28-gd7d884
[git-htmldocs.git] / git-diff-tree.html
blob9d9ac4ec4b0ab3f6f36075e14a87bb6b50ebf247
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-diff-tree(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-diff-tree(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-diff-tree -
743 Compares the content and mode of blobs found via two tree objects
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git diff-tree</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
753 [-t] [-r] [-c | --cc] [--combined-all-paths] [--root] [--merge-base]
754 [&lt;common-diff-options&gt;] &lt;tree-ish&gt; [&lt;tree-ish&gt;] [&lt;path&gt;&#8230;]</pre>
755 <div class="attribution">
756 </div></div>
757 </div>
758 </div>
759 <div class="sect1">
760 <h2 id="_description">DESCRIPTION</h2>
761 <div class="sectionbody">
762 <div class="paragraph"><p>Compares the content and mode of the blobs found via two tree objects.</p></div>
763 <div class="paragraph"><p>If there is only one &lt;tree-ish&gt; given, the commit is compared with its parents
764 (see --stdin below).</p></div>
765 <div class="paragraph"><p>Note that <em>git diff-tree</em> can use the tree encapsulated in a commit object.</p></div>
766 </div>
767 </div>
768 <div class="sect1">
769 <h2 id="_options">OPTIONS</h2>
770 <div class="sectionbody">
771 <div class="dlist"><dl>
772 <dt class="hdlist1">
774 </dt>
775 <dt class="hdlist1">
777 </dt>
778 <dt class="hdlist1">
779 --patch
780 </dt>
781 <dd>
783 Generate patch (see section titled
784 "Generating patch text with -p").
785 </p>
786 </dd>
787 <dt class="hdlist1">
789 </dt>
790 <dt class="hdlist1">
791 --no-patch
792 </dt>
793 <dd>
795 Suppress all output from the diff machinery. Useful for
796 commands like <code>git show</code> that show the patch by default to
797 squelch their output, or to cancel the effect of options like
798 <code>--patch</code>, <code>--stat</code> earlier on the command line in an alias.
799 </p>
800 </dd>
801 <dt class="hdlist1">
802 -U&lt;n&gt;
803 </dt>
804 <dt class="hdlist1">
805 --unified=&lt;n&gt;
806 </dt>
807 <dd>
809 Generate diffs with &lt;n&gt; lines of context instead of
810 the usual three.
811 Implies <code>--patch</code>.
812 </p>
813 </dd>
814 <dt class="hdlist1">
815 --output=&lt;file&gt;
816 </dt>
817 <dd>
819 Output to a specific file instead of stdout.
820 </p>
821 </dd>
822 <dt class="hdlist1">
823 --output-indicator-new=&lt;char&gt;
824 </dt>
825 <dt class="hdlist1">
826 --output-indicator-old=&lt;char&gt;
827 </dt>
828 <dt class="hdlist1">
829 --output-indicator-context=&lt;char&gt;
830 </dt>
831 <dd>
833 Specify the character used to indicate new, old or context
834 lines in the generated patch. Normally they are <em>+</em>, <em>-</em> and
835 ' ' respectively.
836 </p>
837 </dd>
838 <dt class="hdlist1">
839 --raw
840 </dt>
841 <dd>
843 Generate the diff in raw format.
844 This is the default.
845 </p>
846 </dd>
847 <dt class="hdlist1">
848 --patch-with-raw
849 </dt>
850 <dd>
852 Synonym for <code>-p --raw</code>.
853 </p>
854 </dd>
855 <dt class="hdlist1">
856 --indent-heuristic
857 </dt>
858 <dd>
860 Enable the heuristic that shifts diff hunk boundaries to make patches
861 easier to read. This is the default.
862 </p>
863 </dd>
864 <dt class="hdlist1">
865 --no-indent-heuristic
866 </dt>
867 <dd>
869 Disable the indent heuristic.
870 </p>
871 </dd>
872 <dt class="hdlist1">
873 --minimal
874 </dt>
875 <dd>
877 Spend extra time to make sure the smallest possible
878 diff is produced.
879 </p>
880 </dd>
881 <dt class="hdlist1">
882 --patience
883 </dt>
884 <dd>
886 Generate a diff using the "patience diff" algorithm.
887 </p>
888 </dd>
889 <dt class="hdlist1">
890 --histogram
891 </dt>
892 <dd>
894 Generate a diff using the "histogram diff" algorithm.
895 </p>
896 </dd>
897 <dt class="hdlist1">
898 --anchored=&lt;text&gt;
899 </dt>
900 <dd>
902 Generate a diff using the "anchored diff" algorithm.
903 </p>
904 <div class="paragraph"><p>This option may be specified more than once.</p></div>
905 <div class="paragraph"><p>If a line exists in both the source and destination, exists only once,
906 and starts with this text, this algorithm attempts to prevent it from
907 appearing as a deletion or addition in the output. It uses the "patience
908 diff" algorithm internally.</p></div>
909 </dd>
910 <dt class="hdlist1">
911 --diff-algorithm={patience|minimal|histogram|myers}
912 </dt>
913 <dd>
915 Choose a diff algorithm. The variants are as follows:
916 </p>
917 <div class="openblock">
918 <div class="content">
919 <div class="dlist"><dl>
920 <dt class="hdlist1">
921 <code>default</code>, <code>myers</code>
922 </dt>
923 <dd>
925 The basic greedy diff algorithm. Currently, this is the default.
926 </p>
927 </dd>
928 <dt class="hdlist1">
929 <code>minimal</code>
930 </dt>
931 <dd>
933 Spend extra time to make sure the smallest possible diff is
934 produced.
935 </p>
936 </dd>
937 <dt class="hdlist1">
938 <code>patience</code>
939 </dt>
940 <dd>
942 Use "patience diff" algorithm when generating patches.
943 </p>
944 </dd>
945 <dt class="hdlist1">
946 <code>histogram</code>
947 </dt>
948 <dd>
950 This algorithm extends the patience algorithm to "support
951 low-occurrence common elements".
952 </p>
953 </dd>
954 </dl></div>
955 </div></div>
956 <div class="paragraph"><p>For instance, if you configured the <code>diff.algorithm</code> variable to a
957 non-default value and want to use the default one, then you
958 have to use <code>--diff-algorithm=default</code> option.</p></div>
959 </dd>
960 <dt class="hdlist1">
961 --stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
962 </dt>
963 <dd>
965 Generate a diffstat. By default, as much space as necessary
966 will be used for the filename part, and the rest for the graph
967 part. Maximum width defaults to terminal width, or 80 columns
968 if not connected to a terminal, and can be overridden by
969 <code>&lt;width&gt;</code>. The width of the filename part can be limited by
970 giving another width <code>&lt;name-width&gt;</code> after a comma. The width
971 of the graph part can be limited by using
972 <code>--stat-graph-width=&lt;width&gt;</code> (affects all commands generating
973 a stat graph) or by setting <code>diff.statGraphWidth=&lt;width&gt;</code>
974 (does not affect <code>git format-patch</code>).
975 By giving a third parameter <code>&lt;count&gt;</code>, you can limit the
976 output to the first <code>&lt;count&gt;</code> lines, followed by <code>...</code> if
977 there are more.
978 </p>
979 <div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=&lt;width&gt;</code>,
980 <code>--stat-name-width=&lt;name-width&gt;</code> and <code>--stat-count=&lt;count&gt;</code>.</p></div>
981 </dd>
982 <dt class="hdlist1">
983 --compact-summary
984 </dt>
985 <dd>
987 Output a condensed summary of extended header information such
988 as file creations or deletions ("new" or "gone", optionally "+l"
989 if it&#8217;s a symlink) and mode changes ("+x" or "-x" for adding
990 or removing executable bit respectively) in diffstat. The
991 information is put between the filename part and the graph
992 part. Implies <code>--stat</code>.
993 </p>
994 </dd>
995 <dt class="hdlist1">
996 --numstat
997 </dt>
998 <dd>
1000 Similar to <code>--stat</code>, but shows number of added and
1001 deleted lines in decimal notation and pathname without
1002 abbreviation, to make it more machine friendly. For
1003 binary files, outputs two <code>-</code> instead of saying
1004 <code>0 0</code>.
1005 </p>
1006 </dd>
1007 <dt class="hdlist1">
1008 --shortstat
1009 </dt>
1010 <dd>
1012 Output only the last line of the <code>--stat</code> format containing total
1013 number of modified files, as well as number of added and deleted
1014 lines.
1015 </p>
1016 </dd>
1017 <dt class="hdlist1">
1018 -X[&lt;param1,param2,&#8230;&gt;]
1019 </dt>
1020 <dt class="hdlist1">
1021 --dirstat[=&lt;param1,param2,&#8230;&gt;]
1022 </dt>
1023 <dd>
1025 Output the distribution of relative amount of changes for each
1026 sub-directory. The behavior of <code>--dirstat</code> can be customized by
1027 passing it a comma separated list of parameters.
1028 The defaults are controlled by the <code>diff.dirstat</code> configuration
1029 variable (see <a href="git-config.html">git-config(1)</a>).
1030 The following parameters are available:
1031 </p>
1032 <div class="openblock">
1033 <div class="content">
1034 <div class="dlist"><dl>
1035 <dt class="hdlist1">
1036 <code>changes</code>
1037 </dt>
1038 <dd>
1040 Compute the dirstat numbers by counting the lines that have been
1041 removed from the source, or added to the destination. This ignores
1042 the amount of pure code movements within a file. In other words,
1043 rearranging lines in a file is not counted as much as other changes.
1044 This is the default behavior when no parameter is given.
1045 </p>
1046 </dd>
1047 <dt class="hdlist1">
1048 <code>lines</code>
1049 </dt>
1050 <dd>
1052 Compute the dirstat numbers by doing the regular line-based diff
1053 analysis, and summing the removed/added line counts. (For binary
1054 files, count 64-byte chunks instead, since binary files have no
1055 natural concept of lines). This is a more expensive <code>--dirstat</code>
1056 behavior than the <code>changes</code> behavior, but it does count rearranged
1057 lines within a file as much as other changes. The resulting output
1058 is consistent with what you get from the other <code>--*stat</code> options.
1059 </p>
1060 </dd>
1061 <dt class="hdlist1">
1062 <code>files</code>
1063 </dt>
1064 <dd>
1066 Compute the dirstat numbers by counting the number of files changed.
1067 Each changed file counts equally in the dirstat analysis. This is
1068 the computationally cheapest <code>--dirstat</code> behavior, since it does
1069 not have to look at the file contents at all.
1070 </p>
1071 </dd>
1072 <dt class="hdlist1">
1073 <code>cumulative</code>
1074 </dt>
1075 <dd>
1077 Count changes in a child directory for the parent directory as well.
1078 Note that when using <code>cumulative</code>, the sum of the percentages
1079 reported may exceed 100%. The default (non-cumulative) behavior can
1080 be specified with the <code>noncumulative</code> parameter.
1081 </p>
1082 </dd>
1083 <dt class="hdlist1">
1084 &lt;limit&gt;
1085 </dt>
1086 <dd>
1088 An integer parameter specifies a cut-off percent (3% by default).
1089 Directories contributing less than this percentage of the changes
1090 are not shown in the output.
1091 </p>
1092 </dd>
1093 </dl></div>
1094 </div></div>
1095 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
1096 directories with less than 10% of the total amount of changed files,
1097 and accumulating child directory counts in the parent directories:
1098 <code>--dirstat=files,10,cumulative</code>.</p></div>
1099 </dd>
1100 <dt class="hdlist1">
1101 --cumulative
1102 </dt>
1103 <dd>
1105 Synonym for --dirstat=cumulative
1106 </p>
1107 </dd>
1108 <dt class="hdlist1">
1109 --dirstat-by-file[=&lt;param1,param2&gt;&#8230;]
1110 </dt>
1111 <dd>
1113 Synonym for --dirstat=files,param1,param2&#8230;
1114 </p>
1115 </dd>
1116 <dt class="hdlist1">
1117 --summary
1118 </dt>
1119 <dd>
1121 Output a condensed summary of extended header information
1122 such as creations, renames and mode changes.
1123 </p>
1124 </dd>
1125 <dt class="hdlist1">
1126 --patch-with-stat
1127 </dt>
1128 <dd>
1130 Synonym for <code>-p --stat</code>.
1131 </p>
1132 </dd>
1133 <dt class="hdlist1">
1135 </dt>
1136 <dd>
1138 When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been
1139 given, do not munge pathnames and use NULs as output field terminators.
1140 </p>
1141 <div class="paragraph"><p>Without this option, pathnames with "unusual" characters are quoted as
1142 explained for the configuration variable <code>core.quotePath</code> (see
1143 <a href="git-config.html">git-config(1)</a>).</p></div>
1144 </dd>
1145 <dt class="hdlist1">
1146 --name-only
1147 </dt>
1148 <dd>
1150 Show only names of changed files. The file names are often encoded in UTF-8.
1151 For more information see the discussion about encoding in the <a href="git-log.html">git-log(1)</a>
1152 manual page.
1153 </p>
1154 </dd>
1155 <dt class="hdlist1">
1156 --name-status
1157 </dt>
1158 <dd>
1160 Show only names and status of changed files. See the description
1161 of the <code>--diff-filter</code> option on what the status letters mean.
1162 Just like <code>--name-only</code> the file names are often encoded in UTF-8.
1163 </p>
1164 </dd>
1165 <dt class="hdlist1">
1166 --submodule[=&lt;format&gt;]
1167 </dt>
1168 <dd>
1170 Specify how differences in submodules are shown. When specifying
1171 <code>--submodule=short</code> the <em>short</em> format is used. This format just
1172 shows the names of the commits at the beginning and end of the range.
1173 When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em>
1174 format is used. This format lists the commits in the range like
1175 <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
1176 is specified, the <em>diff</em> format is used. This format shows an
1177 inline diff of the changes in the submodule contents between the
1178 commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format
1179 if the config option is unset.
1180 </p>
1181 </dd>
1182 <dt class="hdlist1">
1183 --color[=&lt;when&gt;]
1184 </dt>
1185 <dd>
1187 Show colored diff.
1188 <code>--color</code> (i.e. without <em>=&lt;when&gt;</em>) is the same as <code>--color=always</code>.
1189 <em>&lt;when&gt;</em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>.
1190 </p>
1191 </dd>
1192 <dt class="hdlist1">
1193 --no-color
1194 </dt>
1195 <dd>
1197 Turn off colored diff.
1198 It is the same as <code>--color=never</code>.
1199 </p>
1200 </dd>
1201 <dt class="hdlist1">
1202 --color-moved[=&lt;mode&gt;]
1203 </dt>
1204 <dd>
1206 Moved lines of code are colored differently.
1207 The &lt;mode&gt; defaults to <em>no</em> if the option is not given
1208 and to <em>zebra</em> if the option with no mode is given.
1209 The mode must be one of:
1210 </p>
1211 <div class="openblock">
1212 <div class="content">
1213 <div class="dlist"><dl>
1214 <dt class="hdlist1">
1216 </dt>
1217 <dd>
1219 Moved lines are not highlighted.
1220 </p>
1221 </dd>
1222 <dt class="hdlist1">
1223 default
1224 </dt>
1225 <dd>
1227 Is a synonym for <code>zebra</code>. This may change to a more sensible mode
1228 in the future.
1229 </p>
1230 </dd>
1231 <dt class="hdlist1">
1232 plain
1233 </dt>
1234 <dd>
1236 Any line that is added in one location and was removed
1237 in another location will be colored with <em>color.diff.newMoved</em>.
1238 Similarly <em>color.diff.oldMoved</em> will be used for removed lines
1239 that are added somewhere else in the diff. This mode picks up any
1240 moved line, but it is not very useful in a review to determine
1241 if a block of code was moved without permutation.
1242 </p>
1243 </dd>
1244 <dt class="hdlist1">
1245 blocks
1246 </dt>
1247 <dd>
1249 Blocks of moved text of at least 20 alphanumeric characters
1250 are detected greedily. The detected blocks are
1251 painted using either the <em>color.diff.{old,new}Moved</em> color.
1252 Adjacent blocks cannot be told apart.
1253 </p>
1254 </dd>
1255 <dt class="hdlist1">
1256 zebra
1257 </dt>
1258 <dd>
1260 Blocks of moved text are detected as in <em>blocks</em> mode. The blocks
1261 are painted using either the <em>color.diff.{old,new}Moved</em> color or
1262 <em>color.diff.{old,new}MovedAlternative</em>. The change between
1263 the two colors indicates that a new block was detected.
1264 </p>
1265 </dd>
1266 <dt class="hdlist1">
1267 dimmed-zebra
1268 </dt>
1269 <dd>
1271 Similar to <em>zebra</em>, but additional dimming of uninteresting parts
1272 of moved code is performed. The bordering lines of two adjacent
1273 blocks are considered interesting, the rest is uninteresting.
1274 <code>dimmed_zebra</code> is a deprecated synonym.
1275 </p>
1276 </dd>
1277 </dl></div>
1278 </div></div>
1279 </dd>
1280 <dt class="hdlist1">
1281 --no-color-moved
1282 </dt>
1283 <dd>
1285 Turn off move detection. This can be used to override configuration
1286 settings. It is the same as <code>--color-moved=no</code>.
1287 </p>
1288 </dd>
1289 <dt class="hdlist1">
1290 --color-moved-ws=&lt;modes&gt;
1291 </dt>
1292 <dd>
1294 This configures how whitespace is ignored when performing the
1295 move detection for <code>--color-moved</code>.
1296 These modes can be given as a comma separated list:
1297 </p>
1298 <div class="openblock">
1299 <div class="content">
1300 <div class="dlist"><dl>
1301 <dt class="hdlist1">
1303 </dt>
1304 <dd>
1306 Do not ignore whitespace when performing move detection.
1307 </p>
1308 </dd>
1309 <dt class="hdlist1">
1310 ignore-space-at-eol
1311 </dt>
1312 <dd>
1314 Ignore changes in whitespace at EOL.
1315 </p>
1316 </dd>
1317 <dt class="hdlist1">
1318 ignore-space-change
1319 </dt>
1320 <dd>
1322 Ignore changes in amount of whitespace. This ignores whitespace
1323 at line end, and considers all other sequences of one or
1324 more whitespace characters to be equivalent.
1325 </p>
1326 </dd>
1327 <dt class="hdlist1">
1328 ignore-all-space
1329 </dt>
1330 <dd>
1332 Ignore whitespace when comparing lines. This ignores differences
1333 even if one line has whitespace where the other line has none.
1334 </p>
1335 </dd>
1336 <dt class="hdlist1">
1337 allow-indentation-change
1338 </dt>
1339 <dd>
1341 Initially ignore any whitespace in the move detection, then
1342 group the moved code blocks only into a block if the change in
1343 whitespace is the same per line. This is incompatible with the
1344 other modes.
1345 </p>
1346 </dd>
1347 </dl></div>
1348 </div></div>
1349 </dd>
1350 <dt class="hdlist1">
1351 --no-color-moved-ws
1352 </dt>
1353 <dd>
1355 Do not ignore whitespace when performing move detection. This can be
1356 used to override configuration settings. It is the same as
1357 <code>--color-moved-ws=no</code>.
1358 </p>
1359 </dd>
1360 <dt class="hdlist1">
1361 --word-diff[=&lt;mode&gt;]
1362 </dt>
1363 <dd>
1365 Show a word diff, using the &lt;mode&gt; to delimit changed words.
1366 By default, words are delimited by whitespace; see
1367 <code>--word-diff-regex</code> below. The &lt;mode&gt; defaults to <em>plain</em>, and
1368 must be one of:
1369 </p>
1370 <div class="openblock">
1371 <div class="content">
1372 <div class="dlist"><dl>
1373 <dt class="hdlist1">
1374 color
1375 </dt>
1376 <dd>
1378 Highlight changed words using only colors. Implies <code>--color</code>.
1379 </p>
1380 </dd>
1381 <dt class="hdlist1">
1382 plain
1383 </dt>
1384 <dd>
1386 Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no
1387 attempts to escape the delimiters if they appear in the input,
1388 so the output may be ambiguous.
1389 </p>
1390 </dd>
1391 <dt class="hdlist1">
1392 porcelain
1393 </dt>
1394 <dd>
1396 Use a special line-based format intended for script
1397 consumption. Added/removed/unchanged runs are printed in the
1398 usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
1399 character at the beginning of the line and extending to the
1400 end of the line. Newlines in the input are represented by a
1401 tilde <code>~</code> on a line of its own.
1402 </p>
1403 </dd>
1404 <dt class="hdlist1">
1405 none
1406 </dt>
1407 <dd>
1409 Disable word diff again.
1410 </p>
1411 </dd>
1412 </dl></div>
1413 </div></div>
1414 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
1415 highlight the changed parts in all modes if enabled.</p></div>
1416 </dd>
1417 <dt class="hdlist1">
1418 --word-diff-regex=&lt;regex&gt;
1419 </dt>
1420 <dd>
1422 Use &lt;regex&gt; to decide what a word is, instead of considering
1423 runs of non-whitespace to be a word. Also implies
1424 <code>--word-diff</code> unless it was already enabled.
1425 </p>
1426 <div class="paragraph"><p>Every non-overlapping match of the
1427 &lt;regex&gt; is considered a word. Anything between these matches is
1428 considered whitespace and ignored(!) for the purposes of finding
1429 differences. You may want to append <code>|[^[:space:]]</code> to your regular
1430 expression to make sure that it matches all non-whitespace characters.
1431 A match that contains a newline is silently truncated(!) at the
1432 newline.</p></div>
1433 <div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
1434 and, correspondingly, show differences character by character.</p></div>
1435 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
1436 <a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
1437 overrides any diff driver or configuration setting. Diff drivers
1438 override configuration settings.</p></div>
1439 </dd>
1440 <dt class="hdlist1">
1441 --color-words[=&lt;regex&gt;]
1442 </dt>
1443 <dd>
1445 Equivalent to <code>--word-diff=color</code> plus (if a regex was
1446 specified) <code>--word-diff-regex=&lt;regex&gt;</code>.
1447 </p>
1448 </dd>
1449 <dt class="hdlist1">
1450 --no-renames
1451 </dt>
1452 <dd>
1454 Turn off rename detection, even when the configuration
1455 file gives the default to do so.
1456 </p>
1457 </dd>
1458 <dt class="hdlist1">
1459 --[no-]rename-empty
1460 </dt>
1461 <dd>
1463 Whether to use empty blobs as rename source.
1464 </p>
1465 </dd>
1466 <dt class="hdlist1">
1467 --check
1468 </dt>
1469 <dd>
1471 Warn if changes introduce conflict markers or whitespace errors.
1472 What are considered whitespace errors is controlled by <code>core.whitespace</code>
1473 configuration. By default, trailing whitespaces (including
1474 lines that consist solely of whitespaces) and a space character
1475 that is immediately followed by a tab character inside the
1476 initial indent of the line are considered whitespace errors.
1477 Exits with non-zero status if problems are found. Not compatible
1478 with --exit-code.
1479 </p>
1480 </dd>
1481 <dt class="hdlist1">
1482 --ws-error-highlight=&lt;kind&gt;
1483 </dt>
1484 <dd>
1486 Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code>
1487 lines of the diff. Multiple values are separated by comma,
1488 <code>none</code> resets previous values, <code>default</code> reset the list to
1489 <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When
1490 this option is not given, and the configuration variable
1491 <code>diff.wsErrorHighlight</code> is not set, only whitespace errors in
1492 <code>new</code> lines are highlighted. The whitespace errors are colored
1493 with <code>color.diff.whitespace</code>.
1494 </p>
1495 </dd>
1496 <dt class="hdlist1">
1497 --full-index
1498 </dt>
1499 <dd>
1501 Instead of the first handful of characters, show the full
1502 pre- and post-image blob object names on the "index"
1503 line when generating patch format output.
1504 </p>
1505 </dd>
1506 <dt class="hdlist1">
1507 --binary
1508 </dt>
1509 <dd>
1511 In addition to <code>--full-index</code>, output a binary diff that
1512 can be applied with <code>git-apply</code>.
1513 Implies <code>--patch</code>.
1514 </p>
1515 </dd>
1516 <dt class="hdlist1">
1517 --abbrev[=&lt;n&gt;]
1518 </dt>
1519 <dd>
1521 Instead of showing the full 40-byte hexadecimal object
1522 name in diff-raw format output and diff-tree header
1523 lines, show the shortest prefix that is at least <em>&lt;n&gt;</em>
1524 hexdigits long that uniquely refers the object.
1525 In diff-patch output format, <code>--full-index</code> takes higher
1526 precedence, i.e. if <code>--full-index</code> is specified, full blob
1527 names will be shown regardless of <code>--abbrev</code>.
1528 Non default number of digits can be specified with <code>--abbrev=&lt;n&gt;</code>.
1529 </p>
1530 </dd>
1531 <dt class="hdlist1">
1532 -B[&lt;n&gt;][/&lt;m&gt;]
1533 </dt>
1534 <dt class="hdlist1">
1535 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1536 </dt>
1537 <dd>
1539 Break complete rewrite changes into pairs of delete and
1540 create. This serves two purposes:
1541 </p>
1542 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
1543 not as a series of deletion and insertion mixed together with a very
1544 few lines that happen to match textually as the context, but as a
1545 single deletion of everything old followed by a single insertion of
1546 everything new, and the number <code>m</code> controls this aspect of the -B
1547 option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the
1548 original should remain in the result for Git to consider it a total
1549 rewrite (i.e. otherwise the resulting patch will be a series of
1550 deletion and insertion mixed together with context lines).</p></div>
1551 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
1552 source of a rename (usually -M only considers a file that disappeared
1553 as the source of a rename), and the number <code>n</code> controls this aspect of
1554 the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with
1555 addition and deletion compared to 20% or more of the file&#8217;s size are
1556 eligible for being picked up as a possible source of a rename to
1557 another file.</p></div>
1558 </dd>
1559 <dt class="hdlist1">
1560 -M[&lt;n&gt;]
1561 </dt>
1562 <dt class="hdlist1">
1563 --find-renames[=&lt;n&gt;]
1564 </dt>
1565 <dd>
1567 Detect renames.
1568 If <code>n</code> is specified, it is a threshold on the similarity
1569 index (i.e. amount of addition/deletions compared to the
1570 file&#8217;s size). For example, <code>-M90%</code> means Git should consider a
1571 delete/add pair to be a rename if more than 90% of the file
1572 hasn&#8217;t changed. Without a <code>%</code> sign, the number is to be read as
1573 a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
1574 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is
1575 the same as <code>-M5%</code>. To limit detection to exact renames, use
1576 <code>-M100%</code>. The default similarity index is 50%.
1577 </p>
1578 </dd>
1579 <dt class="hdlist1">
1580 -C[&lt;n&gt;]
1581 </dt>
1582 <dt class="hdlist1">
1583 --find-copies[=&lt;n&gt;]
1584 </dt>
1585 <dd>
1587 Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1588 If <code>n</code> is specified, it has the same meaning as for <code>-M&lt;n&gt;</code>.
1589 </p>
1590 </dd>
1591 <dt class="hdlist1">
1592 --find-copies-harder
1593 </dt>
1594 <dd>
1596 For performance reasons, by default, <code>-C</code> option finds copies only
1597 if the original file of the copy was modified in the same
1598 changeset. This flag makes the command
1599 inspect unmodified files as candidates for the source of
1600 copy. This is a very expensive operation for large
1601 projects, so use it with caution. Giving more than one
1602 <code>-C</code> option has the same effect.
1603 </p>
1604 </dd>
1605 <dt class="hdlist1">
1607 </dt>
1608 <dt class="hdlist1">
1609 --irreversible-delete
1610 </dt>
1611 <dd>
1613 Omit the preimage for deletes, i.e. print only the header but not
1614 the diff between the preimage and <code>/dev/null</code>. The resulting patch
1615 is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is
1616 solely for people who want to just concentrate on reviewing the
1617 text after the change. In addition, the output obviously lacks
1618 enough information to apply such a patch in reverse, even manually,
1619 hence the name of the option.
1620 </p>
1621 <div class="paragraph"><p>When used together with <code>-B</code>, omit also the preimage in the deletion part
1622 of a delete/create pair.</p></div>
1623 </dd>
1624 <dt class="hdlist1">
1625 -l&lt;num&gt;
1626 </dt>
1627 <dd>
1629 The <code>-M</code> and <code>-C</code> options involve some preliminary steps that
1630 can detect subsets of renames/copies cheaply, followed by an
1631 exhaustive fallback portion that compares all remaining
1632 unpaired destinations to all relevant sources. (For renames,
1633 only remaining unpaired sources are relevant; for copies, all
1634 original sources are relevant.) For N sources and
1635 destinations, this exhaustive check is O(N^2). This option
1636 prevents the exhaustive portion of rename/copy detection from
1637 running if the number of source/destination files involved
1638 exceeds the specified number. Defaults to diff.renameLimit.
1639 Note that a value of 0 is treated as unlimited.
1640 </p>
1641 </dd>
1642 <dt class="hdlist1">
1643 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1644 </dt>
1645 <dd>
1647 Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1648 Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1649 type (i.e. regular file, symlink, submodule, &#8230;) changed (<code>T</code>),
1650 are Unmerged (<code>U</code>), are
1651 Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
1652 Any combination of the filter characters (including none) can be used.
1653 When <code>*</code> (All-or-none) is added to the combination, all
1654 paths are selected if there is any file that matches
1655 other criteria in the comparison; if there is no file
1656 that matches other criteria, nothing is selected.
1657 </p>
1658 <div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1659 <code>--diff-filter=ad</code> excludes added and deleted paths.</p></div>
1660 <div class="paragraph"><p>Note that not all diffs can feature all types. For instance, copied and
1661 renamed entries cannot appear if detection for those types is disabled.</p></div>
1662 </dd>
1663 <dt class="hdlist1">
1664 -S&lt;string&gt;
1665 </dt>
1666 <dd>
1668 Look for differences that change the number of occurrences of
1669 the specified string (i.e. addition/deletion) in a file.
1670 Intended for the scripter&#8217;s use.
1671 </p>
1672 <div class="paragraph"><p>It is useful when you&#8217;re looking for an exact block of code (like a
1673 struct), and want to know the history of that block since it first
1674 came into being: use the feature iteratively to feed the interesting
1675 block in the preimage back into <code>-S</code>, and keep going until you get the
1676 very first version of the block.</p></div>
1677 <div class="paragraph"><p>Binary files are searched as well.</p></div>
1678 </dd>
1679 <dt class="hdlist1">
1680 -G&lt;regex&gt;
1681 </dt>
1682 <dd>
1684 Look for differences whose patch text contains added/removed
1685 lines that match &lt;regex&gt;.
1686 </p>
1687 <div class="paragraph"><p>To illustrate the difference between <code>-S&lt;regex&gt; --pickaxe-regex</code> and
1688 <code>-G&lt;regex&gt;</code>, consider a commit with the following diff in the same
1689 file:</p></div>
1690 <div class="listingblock">
1691 <div class="content">
1692 <pre><code>+ return frotz(nitfol, two-&gt;ptr, 1, 0);
1694 - hit = frotz(nitfol, mf2.ptr, 1, 0);</code></pre>
1695 </div></div>
1696 <div class="paragraph"><p>While <code>git log -G"frotz\(nitfol"</code> will show this commit, <code>git log
1697 -S"frotz\(nitfol" --pickaxe-regex</code> will not (because the number of
1698 occurrences of that string did not change).</p></div>
1699 <div class="paragraph"><p>Unless <code>--text</code> is supplied patches of binary files without a textconv
1700 filter will be ignored.</p></div>
1701 <div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1702 information.</p></div>
1703 </dd>
1704 <dt class="hdlist1">
1705 --find-object=&lt;object-id&gt;
1706 </dt>
1707 <dd>
1709 Look for differences that change the number of occurrences of
1710 the specified object. Similar to <code>-S</code>, just the argument is different
1711 in that it doesn&#8217;t search for a specific string but for a specific
1712 object id.
1713 </p>
1714 <div class="paragraph"><p>The object can be a blob or a submodule commit. It implies the <code>-t</code> option in
1715 <code>git-log</code> to also find trees.</p></div>
1716 </dd>
1717 <dt class="hdlist1">
1718 --pickaxe-all
1719 </dt>
1720 <dd>
1722 When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
1723 changeset, not just the files that contain the change
1724 in &lt;string&gt;.
1725 </p>
1726 </dd>
1727 <dt class="hdlist1">
1728 --pickaxe-regex
1729 </dt>
1730 <dd>
1732 Treat the &lt;string&gt; given to <code>-S</code> as an extended POSIX regular
1733 expression to match.
1734 </p>
1735 </dd>
1736 <dt class="hdlist1">
1737 -O&lt;orderfile&gt;
1738 </dt>
1739 <dd>
1741 Control the order in which files appear in the output.
1742 This overrides the <code>diff.orderFile</code> configuration variable
1743 (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
1744 use <code>-O/dev/null</code>.
1745 </p>
1746 <div class="paragraph"><p>The output order is determined by the order of glob patterns in
1747 &lt;orderfile&gt;.
1748 All files with pathnames that match the first pattern are output
1749 first, all files with pathnames that match the second pattern (but not
1750 the first) are output next, and so on.
1751 All files with pathnames that do not match any pattern are output
1752 last, as if there was an implicit match-all pattern at the end of the
1753 file.
1754 If multiple pathnames have the same rank (they match the same pattern
1755 but no earlier patterns), their output order relative to each other is
1756 the normal order.</p></div>
1757 <div class="paragraph"><p>&lt;orderfile&gt; is parsed as follows:</p></div>
1758 <div class="openblock">
1759 <div class="content">
1760 <div class="ulist"><ul>
1761 <li>
1763 Blank lines are ignored, so they can be used as separators for
1764 readability.
1765 </p>
1766 </li>
1767 <li>
1769 Lines starting with a hash ("<code>#</code>") are ignored, so they can be used
1770 for comments. Add a backslash ("<code>\</code>") to the beginning of the
1771 pattern if it starts with a hash.
1772 </p>
1773 </li>
1774 <li>
1776 Each other line contains a single pattern.
1777 </p>
1778 </li>
1779 </ul></div>
1780 </div></div>
1781 <div class="paragraph"><p>Patterns have the same syntax and semantics as patterns used for
1782 fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
1783 matches a pattern if removing any number of the final pathname
1784 components matches the pattern. For example, the pattern "<code>foo*bar</code>"
1785 matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p></div>
1786 </dd>
1787 <dt class="hdlist1">
1788 --skip-to=&lt;file&gt;
1789 </dt>
1790 <dt class="hdlist1">
1791 --rotate-to=&lt;file&gt;
1792 </dt>
1793 <dd>
1795 Discard the files before the named &lt;file&gt; from the output
1796 (i.e. <em>skip to</em>), or move them to the end of the output
1797 (i.e. <em>rotate to</em>). These were invented primarily for use
1798 of the <code>git difftool</code> command, and may not be very useful
1799 otherwise.
1800 </p>
1801 </dd>
1802 <dt class="hdlist1">
1804 </dt>
1805 <dd>
1807 Swap two inputs; that is, show differences from index or
1808 on-disk file to tree contents.
1809 </p>
1810 </dd>
1811 <dt class="hdlist1">
1812 --relative[=&lt;path&gt;]
1813 </dt>
1814 <dt class="hdlist1">
1815 --no-relative
1816 </dt>
1817 <dd>
1819 When run from a subdirectory of the project, it can be
1820 told to exclude changes outside the directory and show
1821 pathnames relative to it with this option. When you are
1822 not in a subdirectory (e.g. in a bare repository), you
1823 can name which subdirectory to make the output relative
1824 to by giving a &lt;path&gt; as an argument.
1825 <code>--no-relative</code> can be used to countermand both <code>diff.relative</code> config
1826 option and previous <code>--relative</code>.
1827 </p>
1828 </dd>
1829 <dt class="hdlist1">
1831 </dt>
1832 <dt class="hdlist1">
1833 --text
1834 </dt>
1835 <dd>
1837 Treat all files as text.
1838 </p>
1839 </dd>
1840 <dt class="hdlist1">
1841 --ignore-cr-at-eol
1842 </dt>
1843 <dd>
1845 Ignore carriage-return at the end of line when doing a comparison.
1846 </p>
1847 </dd>
1848 <dt class="hdlist1">
1849 --ignore-space-at-eol
1850 </dt>
1851 <dd>
1853 Ignore changes in whitespace at EOL.
1854 </p>
1855 </dd>
1856 <dt class="hdlist1">
1858 </dt>
1859 <dt class="hdlist1">
1860 --ignore-space-change
1861 </dt>
1862 <dd>
1864 Ignore changes in amount of whitespace. This ignores whitespace
1865 at line end, and considers all other sequences of one or
1866 more whitespace characters to be equivalent.
1867 </p>
1868 </dd>
1869 <dt class="hdlist1">
1871 </dt>
1872 <dt class="hdlist1">
1873 --ignore-all-space
1874 </dt>
1875 <dd>
1877 Ignore whitespace when comparing lines. This ignores
1878 differences even if one line has whitespace where the other
1879 line has none.
1880 </p>
1881 </dd>
1882 <dt class="hdlist1">
1883 --ignore-blank-lines
1884 </dt>
1885 <dd>
1887 Ignore changes whose lines are all blank.
1888 </p>
1889 </dd>
1890 <dt class="hdlist1">
1891 -I&lt;regex&gt;
1892 </dt>
1893 <dt class="hdlist1">
1894 --ignore-matching-lines=&lt;regex&gt;
1895 </dt>
1896 <dd>
1898 Ignore changes whose all lines match &lt;regex&gt;. This option may
1899 be specified more than once.
1900 </p>
1901 </dd>
1902 <dt class="hdlist1">
1903 --inter-hunk-context=&lt;lines&gt;
1904 </dt>
1905 <dd>
1907 Show the context between diff hunks, up to the specified number
1908 of lines, thereby fusing hunks that are close to each other.
1909 Defaults to <code>diff.interHunkContext</code> or 0 if the config option
1910 is unset.
1911 </p>
1912 </dd>
1913 <dt class="hdlist1">
1915 </dt>
1916 <dt class="hdlist1">
1917 --function-context
1918 </dt>
1919 <dd>
1921 Show whole function as context lines for each change.
1922 The function names are determined in the same way as
1923 <code>git diff</code> works out patch hunk headers (see <em>Defining a
1924 custom hunk-header</em> in <a href="gitattributes.html">gitattributes(5)</a>).
1925 </p>
1926 </dd>
1927 <dt class="hdlist1">
1928 --exit-code
1929 </dt>
1930 <dd>
1932 Make the program exit with codes similar to diff(1).
1933 That is, it exits with 1 if there were differences and
1934 0 means no differences.
1935 </p>
1936 </dd>
1937 <dt class="hdlist1">
1938 --quiet
1939 </dt>
1940 <dd>
1942 Disable all output of the program. Implies <code>--exit-code</code>.
1943 </p>
1944 </dd>
1945 <dt class="hdlist1">
1946 --ext-diff
1947 </dt>
1948 <dd>
1950 Allow an external diff helper to be executed. If you set an
1951 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1952 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1953 </p>
1954 </dd>
1955 <dt class="hdlist1">
1956 --no-ext-diff
1957 </dt>
1958 <dd>
1960 Disallow external diff drivers.
1961 </p>
1962 </dd>
1963 <dt class="hdlist1">
1964 --textconv
1965 </dt>
1966 <dt class="hdlist1">
1967 --no-textconv
1968 </dt>
1969 <dd>
1971 Allow (or disallow) external text conversion filters to be run
1972 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1973 details. Because textconv filters are typically a one-way
1974 conversion, the resulting diff is suitable for human
1975 consumption, but cannot be applied. For this reason, textconv
1976 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1977 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1978 diff plumbing commands.
1979 </p>
1980 </dd>
1981 <dt class="hdlist1">
1982 --ignore-submodules[=&lt;when&gt;]
1983 </dt>
1984 <dd>
1986 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1987 either "none", "untracked", "dirty" or "all", which is the default.
1988 Using "none" will consider the submodule modified when it either contains
1989 untracked or modified files or its HEAD differs from the commit recorded
1990 in the superproject and can be used to override any settings of the
1991 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1992 "untracked" is used submodules are not considered dirty when they only
1993 contain untracked content (but they are still scanned for modified
1994 content). Using "dirty" ignores all changes to the work tree of submodules,
1995 only changes to the commits stored in the superproject are shown (this was
1996 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1997 </p>
1998 </dd>
1999 <dt class="hdlist1">
2000 --src-prefix=&lt;prefix&gt;
2001 </dt>
2002 <dd>
2004 Show the given source prefix instead of "a/".
2005 </p>
2006 </dd>
2007 <dt class="hdlist1">
2008 --dst-prefix=&lt;prefix&gt;
2009 </dt>
2010 <dd>
2012 Show the given destination prefix instead of "b/".
2013 </p>
2014 </dd>
2015 <dt class="hdlist1">
2016 --no-prefix
2017 </dt>
2018 <dd>
2020 Do not show any source or destination prefix.
2021 </p>
2022 </dd>
2023 <dt class="hdlist1">
2024 --default-prefix
2025 </dt>
2026 <dd>
2028 Use the default source and destination prefixes ("a/" and "b/").
2029 This is usually the default already, but may be used to override
2030 config such as <code>diff.noprefix</code>.
2031 </p>
2032 </dd>
2033 <dt class="hdlist1">
2034 --line-prefix=&lt;prefix&gt;
2035 </dt>
2036 <dd>
2038 Prepend an additional prefix to every line of output.
2039 </p>
2040 </dd>
2041 <dt class="hdlist1">
2042 --ita-invisible-in-index
2043 </dt>
2044 <dd>
2046 By default entries added by "git add -N" appear as an existing
2047 empty file in "git diff" and a new file in "git diff --cached".
2048 This option makes the entry appear as a new file in "git diff"
2049 and non-existent in "git diff --cached". This option could be
2050 reverted with <code>--ita-visible-in-index</code>. Both options are
2051 experimental and could be removed in future.
2052 </p>
2053 </dd>
2054 </dl></div>
2055 <div class="paragraph"><p>For more detailed explanation on these common options, see also
2056 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
2057 <div class="dlist"><dl>
2058 <dt class="hdlist1">
2059 &lt;tree-ish&gt;
2060 </dt>
2061 <dd>
2063 The id of a tree object.
2064 </p>
2065 </dd>
2066 <dt class="hdlist1">
2067 &lt;path&gt;&#8230;
2068 </dt>
2069 <dd>
2071 If provided, the results are limited to a subset of files
2072 matching one of the provided pathspecs.
2073 </p>
2074 </dd>
2075 <dt class="hdlist1">
2077 </dt>
2078 <dd>
2080 recurse into sub-trees
2081 </p>
2082 </dd>
2083 <dt class="hdlist1">
2085 </dt>
2086 <dd>
2088 show tree entry itself as well as subtrees. Implies -r.
2089 </p>
2090 </dd>
2091 <dt class="hdlist1">
2092 --root
2093 </dt>
2094 <dd>
2096 When <code>--root</code> is specified the initial commit will be shown as a big
2097 creation event. This is equivalent to a diff against the NULL tree.
2098 </p>
2099 </dd>
2100 <dt class="hdlist1">
2101 --merge-base
2102 </dt>
2103 <dd>
2105 Instead of comparing the &lt;tree-ish&gt;s directly, use the merge
2106 base between the two &lt;tree-ish&gt;s as the "before" side. There
2107 must be two &lt;tree-ish&gt;s given and they must both be commits.
2108 </p>
2109 </dd>
2110 <dt class="hdlist1">
2111 --stdin
2112 </dt>
2113 <dd>
2115 When <code>--stdin</code> is specified, the command does not take
2116 &lt;tree-ish&gt; arguments from the command line. Instead, it
2117 reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a
2118 list of &lt;commit&gt; from its standard input. (Use a single space
2119 as separator.)
2120 </p>
2121 <div class="paragraph"><p>When two trees are given, it compares the first tree with the second.
2122 When a single commit is given, it compares the commit with its
2123 parents. The remaining commits, when given, are used as if they are
2124 parents of the first commit.</p></div>
2125 <div class="paragraph"><p>When comparing two trees, the ID of both trees (separated by a space
2126 and terminated by a newline) is printed before the difference. When
2127 comparing commits, the ID of the first (or only) commit, followed by a
2128 newline, is printed.</p></div>
2129 <div class="paragraph"><p>The following flags further affect the behavior when comparing
2130 commits (but not trees).</p></div>
2131 </dd>
2132 <dt class="hdlist1">
2134 </dt>
2135 <dd>
2137 By default, <em>git diff-tree --stdin</em> does not show
2138 differences for merge commits. With this flag, it shows
2139 differences to that commit from all of its parents. See
2140 also <code>-c</code>.
2141 </p>
2142 </dd>
2143 <dt class="hdlist1">
2145 </dt>
2146 <dd>
2148 By default, <em>git diff-tree --stdin</em> shows differences,
2149 either in machine-readable form (without <code>-p</code>) or in patch
2150 form (with <code>-p</code>). This output can be suppressed. It is
2151 only useful with <code>-v</code> flag.
2152 </p>
2153 </dd>
2154 <dt class="hdlist1">
2156 </dt>
2157 <dd>
2159 This flag causes <em>git diff-tree --stdin</em> to also show
2160 the commit message before the differences.
2161 </p>
2162 </dd>
2163 <dt class="hdlist1">
2164 --pretty[=&lt;format&gt;]
2165 </dt>
2166 <dt class="hdlist1">
2167 --format=&lt;format&gt;
2168 </dt>
2169 <dd>
2171 Pretty-print the contents of the commit logs in a given format,
2172 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
2173 <em>full</em>, <em>fuller</em>, <em>reference</em>, <em>email</em>, <em>raw</em>, <em>format:&lt;string&gt;</em>
2174 and <em>tformat:&lt;string&gt;</em>. When <em>&lt;format&gt;</em> is none of the above,
2175 and has <em>%placeholder</em> in it, it acts as if
2176 <em>--pretty=tformat:&lt;format&gt;</em> were given.
2177 </p>
2178 <div class="paragraph"><p>See the "PRETTY FORMATS" section for some additional details for each
2179 format. When <em>=&lt;format&gt;</em> part is omitted, it defaults to <em>medium</em>.</p></div>
2180 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
2181 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
2182 </dd>
2183 <dt class="hdlist1">
2184 --abbrev-commit
2185 </dt>
2186 <dd>
2188 Instead of showing the full 40-byte hexadecimal commit object
2189 name, show a prefix that names the object uniquely.
2190 "--abbrev=&lt;n&gt;" (which also modifies diff output, if it is displayed)
2191 option can be used to specify the minimum length of the prefix.
2192 </p>
2193 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
2194 people using 80-column terminals.</p></div>
2195 </dd>
2196 <dt class="hdlist1">
2197 --no-abbrev-commit
2198 </dt>
2199 <dd>
2201 Show the full 40-byte hexadecimal commit object name. This negates
2202 <code>--abbrev-commit</code>, either explicit or implied by other options such
2203 as "--oneline". It also overrides the <code>log.abbrevCommit</code> variable.
2204 </p>
2205 </dd>
2206 <dt class="hdlist1">
2207 --oneline
2208 </dt>
2209 <dd>
2211 This is a shorthand for "--pretty=oneline --abbrev-commit"
2212 used together.
2213 </p>
2214 </dd>
2215 <dt class="hdlist1">
2216 --encoding=&lt;encoding&gt;
2217 </dt>
2218 <dd>
2220 Commit objects record the character encoding used for the log message
2221 in their encoding header; this option can be used to tell the
2222 command to re-code the commit log message in the encoding
2223 preferred by the user. For non plumbing commands this
2224 defaults to UTF-8. Note that if an object claims to be encoded
2225 in <code>X</code> and we are outputting in <code>X</code>, we will output the object
2226 verbatim; this means that invalid sequences in the original
2227 commit may be copied to the output. Likewise, if iconv(3) fails
2228 to convert the commit, we will quietly output the original
2229 object verbatim.
2230 </p>
2231 </dd>
2232 <dt class="hdlist1">
2233 --expand-tabs=&lt;n&gt;
2234 </dt>
2235 <dt class="hdlist1">
2236 --expand-tabs
2237 </dt>
2238 <dt class="hdlist1">
2239 --no-expand-tabs
2240 </dt>
2241 <dd>
2243 Perform a tab expansion (replace each tab with enough spaces
2244 to fill to the next display column that is multiple of <em>&lt;n&gt;</em>)
2245 in the log message before showing it in the output.
2246 <code>--expand-tabs</code> is a short-hand for <code>--expand-tabs=8</code>, and
2247 <code>--no-expand-tabs</code> is a short-hand for <code>--expand-tabs=0</code>,
2248 which disables tab expansion.
2249 </p>
2250 <div class="paragraph"><p>By default, tabs are expanded in pretty formats that indent the log
2251 message by 4 spaces (i.e. <em>medium</em>, which is the default, <em>full</em>,
2252 and <em>fuller</em>).</p></div>
2253 </dd>
2254 <dt class="hdlist1">
2255 --notes[=&lt;ref&gt;]
2256 </dt>
2257 <dd>
2259 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
2260 commit, when showing the commit log message. This is the default
2261 for <code>git log</code>, <code>git show</code> and <code>git whatchanged</code> commands when
2262 there is no <code>--pretty</code>, <code>--format</code>, or <code>--oneline</code> option given
2263 on the command line.
2264 </p>
2265 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
2266 <code>core.notesRef</code> and <code>notes.displayRef</code> variables (or corresponding
2267 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
2268 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, use the ref to find the notes
2269 to display. The ref can specify the full refname when it begins
2270 with <code>refs/notes/</code>; when it begins with <code>notes/</code>, <code>refs/</code> and otherwise
2271 <code>refs/notes/</code> is prefixed to form a full name of the ref.</p></div>
2272 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
2273 being displayed. Examples: "--notes=foo" will show only notes from
2274 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
2275 "refs/notes/foo" and from the default notes ref(s).</p></div>
2276 </dd>
2277 <dt class="hdlist1">
2278 --no-notes
2279 </dt>
2280 <dd>
2282 Do not show notes. This negates the above <code>--notes</code> option, by
2283 resetting the list of notes refs from which notes are shown.
2284 Options are parsed in the order given on the command line, so e.g.
2285 "--notes --notes=foo --no-notes --notes=bar" will only show notes
2286 from "refs/notes/bar".
2287 </p>
2288 </dd>
2289 <dt class="hdlist1">
2290 --show-notes[=&lt;ref&gt;]
2291 </dt>
2292 <dt class="hdlist1">
2293 --[no-]standard-notes
2294 </dt>
2295 <dd>
2297 These options are deprecated. Use the above --notes/--no-notes
2298 options instead.
2299 </p>
2300 </dd>
2301 <dt class="hdlist1">
2302 --show-signature
2303 </dt>
2304 <dd>
2306 Check the validity of a signed commit object by passing the signature
2307 to <code>gpg --verify</code> and show the output.
2308 </p>
2309 </dd>
2310 <dt class="hdlist1">
2311 --no-commit-id
2312 </dt>
2313 <dd>
2315 <em>git diff-tree</em> outputs a line with the commit ID when
2316 applicable. This flag suppressed the commit ID output.
2317 </p>
2318 </dd>
2319 <dt class="hdlist1">
2321 </dt>
2322 <dd>
2324 This flag changes the way a merge commit is displayed
2325 (which means it is useful only when the command is given
2326 one &lt;tree-ish&gt;, or <code>--stdin</code>). It shows the differences
2327 from each of the parents to the merge result simultaneously
2328 instead of showing pairwise diff between a parent and the
2329 result one at a time (which is what the <code>-m</code> option does).
2330 Furthermore, it lists only files which were modified
2331 from all parents.
2332 </p>
2333 </dd>
2334 <dt class="hdlist1">
2335 --cc
2336 </dt>
2337 <dd>
2339 This flag changes the way a merge commit patch is displayed,
2340 in a similar way to the <code>-c</code> option. It implies the <code>-c</code>
2341 and <code>-p</code> options and further compresses the patch output
2342 by omitting uninteresting hunks whose the contents in the parents
2343 have only two variants and the merge result picks one of them
2344 without modification. When all hunks are uninteresting, the commit
2345 itself and the commit log message is not shown, just like in any other
2346 "empty diff" case.
2347 </p>
2348 </dd>
2349 <dt class="hdlist1">
2350 --combined-all-paths
2351 </dt>
2352 <dd>
2354 This flag causes combined diffs (used for merge commits) to
2355 list the name of the file from all parents. It thus only has
2356 effect when -c or --cc are specified, and is likely only
2357 useful if filename changes are detected (i.e. when either
2358 rename or copy detection have been requested).
2359 </p>
2360 </dd>
2361 <dt class="hdlist1">
2362 --always
2363 </dt>
2364 <dd>
2366 Show the commit itself and the commit log message even
2367 if the diff itself is empty.
2368 </p>
2369 </dd>
2370 </dl></div>
2371 </div>
2372 </div>
2373 <div class="sect1">
2374 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
2375 <div class="sectionbody">
2376 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
2377 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
2378 inserted before the <em>Author:</em> line. This line begins with
2379 "Merge: " and the hashes of ancestral commits are printed,
2380 separated by spaces. Note that the listed commits may not
2381 necessarily be the list of the <strong>direct</strong> parent commits if you
2382 have limited your view of history: for example, if you are
2383 only interested in changes related to a certain directory or
2384 file.</p></div>
2385 <div class="paragraph"><p>There are several built-in formats, and you can define
2386 additional formats by setting a pretty.&lt;name&gt;
2387 config option to either another format name, or a
2388 <em>format:</em> string, as described below (see
2389 <a href="git-config.html">git-config(1)</a>). Here are the details of the
2390 built-in formats:</p></div>
2391 <div class="ulist"><ul>
2392 <li>
2394 <em>oneline</em>
2395 </p>
2396 <div class="literalblock">
2397 <div class="content">
2398 <pre><code>&lt;hash&gt; &lt;title-line&gt;</code></pre>
2399 </div></div>
2400 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
2401 </li>
2402 <li>
2404 <em>short</em>
2405 </p>
2406 <div class="literalblock">
2407 <div class="content">
2408 <pre><code>commit &lt;hash&gt;
2409 Author: &lt;author&gt;</code></pre>
2410 </div></div>
2411 <div class="literalblock">
2412 <div class="content">
2413 <pre><code>&lt;title-line&gt;</code></pre>
2414 </div></div>
2415 </li>
2416 <li>
2418 <em>medium</em>
2419 </p>
2420 <div class="literalblock">
2421 <div class="content">
2422 <pre><code>commit &lt;hash&gt;
2423 Author: &lt;author&gt;
2424 Date: &lt;author-date&gt;</code></pre>
2425 </div></div>
2426 <div class="literalblock">
2427 <div class="content">
2428 <pre><code>&lt;title-line&gt;</code></pre>
2429 </div></div>
2430 <div class="literalblock">
2431 <div class="content">
2432 <pre><code>&lt;full-commit-message&gt;</code></pre>
2433 </div></div>
2434 </li>
2435 <li>
2437 <em>full</em>
2438 </p>
2439 <div class="literalblock">
2440 <div class="content">
2441 <pre><code>commit &lt;hash&gt;
2442 Author: &lt;author&gt;
2443 Commit: &lt;committer&gt;</code></pre>
2444 </div></div>
2445 <div class="literalblock">
2446 <div class="content">
2447 <pre><code>&lt;title-line&gt;</code></pre>
2448 </div></div>
2449 <div class="literalblock">
2450 <div class="content">
2451 <pre><code>&lt;full-commit-message&gt;</code></pre>
2452 </div></div>
2453 </li>
2454 <li>
2456 <em>fuller</em>
2457 </p>
2458 <div class="literalblock">
2459 <div class="content">
2460 <pre><code>commit &lt;hash&gt;
2461 Author: &lt;author&gt;
2462 AuthorDate: &lt;author-date&gt;
2463 Commit: &lt;committer&gt;
2464 CommitDate: &lt;committer-date&gt;</code></pre>
2465 </div></div>
2466 <div class="literalblock">
2467 <div class="content">
2468 <pre><code>&lt;title-line&gt;</code></pre>
2469 </div></div>
2470 <div class="literalblock">
2471 <div class="content">
2472 <pre><code>&lt;full-commit-message&gt;</code></pre>
2473 </div></div>
2474 </li>
2475 <li>
2477 <em>reference</em>
2478 </p>
2479 <div class="literalblock">
2480 <div class="content">
2481 <pre><code>&lt;abbrev-hash&gt; (&lt;title-line&gt;, &lt;short-author-date&gt;)</code></pre>
2482 </div></div>
2483 <div class="paragraph"><p>This format is used to refer to another commit in a commit message and
2484 is the same as <code>--pretty='format:%C(auto)%h (%s, %ad)'</code>. By default,
2485 the date is formatted with <code>--date=short</code> unless another <code>--date</code> option
2486 is explicitly specified. As with any <code>format:</code> with format
2487 placeholders, its output is not affected by other options like
2488 <code>--decorate</code> and <code>--walk-reflogs</code>.</p></div>
2489 </li>
2490 <li>
2492 <em>email</em>
2493 </p>
2494 <div class="literalblock">
2495 <div class="content">
2496 <pre><code>From &lt;hash&gt; &lt;date&gt;
2497 From: &lt;author&gt;
2498 Date: &lt;author-date&gt;
2499 Subject: [PATCH] &lt;title-line&gt;</code></pre>
2500 </div></div>
2501 <div class="literalblock">
2502 <div class="content">
2503 <pre><code>&lt;full-commit-message&gt;</code></pre>
2504 </div></div>
2505 </li>
2506 <li>
2508 <em>mboxrd</em>
2509 </p>
2510 <div class="paragraph"><p>Like <em>email</em>, but lines in the commit message starting with "From "
2511 (preceded by zero or more "&gt;") are quoted with "&gt;" so they aren&#8217;t
2512 confused as starting a new commit.</p></div>
2513 </li>
2514 <li>
2516 <em>raw</em>
2517 </p>
2518 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
2519 stored in the commit object. Notably, the hashes are
2520 displayed in full, regardless of whether --abbrev or
2521 --no-abbrev are used, and <em>parents</em> information show the
2522 true parent commits, without taking grafts or history
2523 simplification into account. Note that this format affects the way
2524 commits are displayed, but not the way the diff is shown e.g. with
2525 <code>git log --raw</code>. To get full object names in a raw diff format,
2526 use <code>--no-abbrev</code>.</p></div>
2527 </li>
2528 <li>
2530 <em>format:&lt;format-string&gt;</em>
2531 </p>
2532 <div class="paragraph"><p>The <em>format:&lt;format-string&gt;</em> format allows you to specify which information
2533 you want to show. It works a little bit like printf format,
2534 with the notable exception that you get a newline with <em>%n</em>
2535 instead of <em>\n</em>.</p></div>
2536 <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>
2537 would show something like this:</p></div>
2538 <div class="listingblock">
2539 <div class="content">
2540 <pre><code>The author of fe6e0ee was Junio C Hamano, 23 hours ago
2541 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</code></pre>
2542 </div></div>
2543 <div class="paragraph"><p>The placeholders are:</p></div>
2544 <div class="ulist"><ul>
2545 <li>
2547 Placeholders that expand to a single literal character:
2548 </p>
2549 <div class="dlist"><dl>
2550 <dt class="hdlist1">
2551 <em>%n</em>
2552 </dt>
2553 <dd>
2555 newline
2556 </p>
2557 </dd>
2558 <dt class="hdlist1">
2559 <em>%%</em>
2560 </dt>
2561 <dd>
2563 a raw <em>%</em>
2564 </p>
2565 </dd>
2566 <dt class="hdlist1">
2567 <em>%x00</em>
2568 </dt>
2569 <dd>
2571 print a byte from a hex code
2572 </p>
2573 </dd>
2574 </dl></div>
2575 </li>
2576 <li>
2578 Placeholders that affect formatting of later placeholders:
2579 </p>
2580 <div class="dlist"><dl>
2581 <dt class="hdlist1">
2582 <em>%Cred</em>
2583 </dt>
2584 <dd>
2586 switch color to red
2587 </p>
2588 </dd>
2589 <dt class="hdlist1">
2590 <em>%Cgreen</em>
2591 </dt>
2592 <dd>
2594 switch color to green
2595 </p>
2596 </dd>
2597 <dt class="hdlist1">
2598 <em>%Cblue</em>
2599 </dt>
2600 <dd>
2602 switch color to blue
2603 </p>
2604 </dd>
2605 <dt class="hdlist1">
2606 <em>%Creset</em>
2607 </dt>
2608 <dd>
2610 reset color
2611 </p>
2612 </dd>
2613 <dt class="hdlist1">
2614 <em>%C(&#8230;)</em>
2615 </dt>
2616 <dd>
2618 color specification, as described under Values in the
2619 "CONFIGURATION FILE" section of <a href="git-config.html">git-config(1)</a>. By
2620 default, colors are shown only when enabled for log output
2621 (by <code>color.diff</code>, <code>color.ui</code>, or <code>--color</code>, and respecting
2622 the <code>auto</code> settings of the former if we are going to a
2623 terminal). <code>%C(auto,...)</code> is accepted as a historical
2624 synonym for the default (e.g., <code>%C(auto,red)</code>). Specifying
2625 <code>%C(always,...)</code> will show the colors even when color is
2626 not otherwise enabled (though consider just using
2627 <code>--color=always</code> to enable color for the whole output,
2628 including this format and anything else git might color).
2629 <code>auto</code> alone (i.e. <code>%C(auto)</code>) will turn on auto coloring
2630 on the next placeholders until the color is switched
2631 again.
2632 </p>
2633 </dd>
2634 <dt class="hdlist1">
2635 <em>%m</em>
2636 </dt>
2637 <dd>
2639 left (<code>&lt;</code>), right (<code>&gt;</code>) or boundary (<code>-</code>) mark
2640 </p>
2641 </dd>
2642 <dt class="hdlist1">
2643 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>
2644 </dt>
2645 <dd>
2647 switch line wrapping, like the -w option of
2648 <a href="git-shortlog.html">git-shortlog(1)</a>.
2649 </p>
2650 </dd>
2651 <dt class="hdlist1">
2652 <em>%&lt;( &lt;N&gt; [,trunc|ltrunc|mtrunc])</em>
2653 </dt>
2654 <dd>
2656 make the next placeholder take at
2657 least N column widths, padding spaces on
2658 the right if necessary. Optionally
2659 truncate (with ellipsis <em>..</em>) at the left (ltrunc) <code>..ft</code>,
2660 the middle (mtrunc) <code>mi..le</code>, or the end
2661 (trunc) <code>rig..</code>, if the output is longer than
2662 N columns.
2663 Note 1: that truncating
2664 only works correctly with N &gt;= 2.
2665 Note 2: spaces around the N and M (see below)
2666 values are optional.
2667 Note 3: Emojis and other wide characters
2668 will take two display columns, which may
2669 over-run column boundaries.
2670 Note 4: decomposed character combining marks
2671 may be misplaced at padding boundaries.
2672 </p>
2673 </dd>
2674 <dt class="hdlist1">
2675 <em>%&lt;|( &lt;M&gt; )</em>
2676 </dt>
2677 <dd>
2679 make the next placeholder take at least until Mth
2680 display column, padding spaces on the right if necessary.
2681 Use negative M values for column positions measured
2682 from the right hand edge of the terminal window.
2683 </p>
2684 </dd>
2685 <dt class="hdlist1">
2686 <em>%&gt;( &lt;N&gt; )</em>, <em>%&gt;|( &lt;M&gt; )</em>
2687 </dt>
2688 <dd>
2690 similar to <em>%&lt;( &lt;N&gt; )</em>, <em>%&lt;|( &lt;M&gt; )</em> respectively,
2691 but padding spaces on the left
2692 </p>
2693 </dd>
2694 <dt class="hdlist1">
2695 <em>%&gt;&gt;( &lt;N&gt; )</em>, <em>%&gt;&gt;|( &lt;M&gt; )</em>
2696 </dt>
2697 <dd>
2699 similar to <em>%&gt;( &lt;N&gt; )</em>, <em>%&gt;|( &lt;M&gt; )</em>
2700 respectively, except that if the next
2701 placeholder takes more spaces than given and
2702 there are spaces on its left, use those
2703 spaces
2704 </p>
2705 </dd>
2706 <dt class="hdlist1">
2707 <em>%&gt;&lt;( &lt;N&gt; )</em>, <em>%&gt;&lt;|( &lt;M&gt; )</em>
2708 </dt>
2709 <dd>
2711 similar to <em>%&lt;( &lt;N&gt; )</em>, <em>%&lt;|( &lt;M&gt; )</em>
2712 respectively, but padding both sides
2713 (i.e. the text is centered)
2714 </p>
2715 </dd>
2716 </dl></div>
2717 </li>
2718 <li>
2720 Placeholders that expand to information extracted from the commit:
2721 </p>
2722 <div class="dlist"><dl>
2723 <dt class="hdlist1">
2724 <em>%H</em>
2725 </dt>
2726 <dd>
2728 commit hash
2729 </p>
2730 </dd>
2731 <dt class="hdlist1">
2732 <em>%h</em>
2733 </dt>
2734 <dd>
2736 abbreviated commit hash
2737 </p>
2738 </dd>
2739 <dt class="hdlist1">
2740 <em>%T</em>
2741 </dt>
2742 <dd>
2744 tree hash
2745 </p>
2746 </dd>
2747 <dt class="hdlist1">
2748 <em>%t</em>
2749 </dt>
2750 <dd>
2752 abbreviated tree hash
2753 </p>
2754 </dd>
2755 <dt class="hdlist1">
2756 <em>%P</em>
2757 </dt>
2758 <dd>
2760 parent hashes
2761 </p>
2762 </dd>
2763 <dt class="hdlist1">
2764 <em>%p</em>
2765 </dt>
2766 <dd>
2768 abbreviated parent hashes
2769 </p>
2770 </dd>
2771 <dt class="hdlist1">
2772 <em>%an</em>
2773 </dt>
2774 <dd>
2776 author name
2777 </p>
2778 </dd>
2779 <dt class="hdlist1">
2780 <em>%aN</em>
2781 </dt>
2782 <dd>
2784 author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a>
2785 or <a href="git-blame.html">git-blame(1)</a>)
2786 </p>
2787 </dd>
2788 <dt class="hdlist1">
2789 <em>%ae</em>
2790 </dt>
2791 <dd>
2793 author email
2794 </p>
2795 </dd>
2796 <dt class="hdlist1">
2797 <em>%aE</em>
2798 </dt>
2799 <dd>
2801 author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a>
2802 or <a href="git-blame.html">git-blame(1)</a>)
2803 </p>
2804 </dd>
2805 <dt class="hdlist1">
2806 <em>%al</em>
2807 </dt>
2808 <dd>
2810 author email local-part (the part before the <em>@</em> sign)
2811 </p>
2812 </dd>
2813 <dt class="hdlist1">
2814 <em>%aL</em>
2815 </dt>
2816 <dd>
2818 author local-part (see <em>%al</em>) respecting .mailmap, see
2819 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2820 </p>
2821 </dd>
2822 <dt class="hdlist1">
2823 <em>%ad</em>
2824 </dt>
2825 <dd>
2827 author date (format respects --date= option)
2828 </p>
2829 </dd>
2830 <dt class="hdlist1">
2831 <em>%aD</em>
2832 </dt>
2833 <dd>
2835 author date, RFC2822 style
2836 </p>
2837 </dd>
2838 <dt class="hdlist1">
2839 <em>%ar</em>
2840 </dt>
2841 <dd>
2843 author date, relative
2844 </p>
2845 </dd>
2846 <dt class="hdlist1">
2847 <em>%at</em>
2848 </dt>
2849 <dd>
2851 author date, UNIX timestamp
2852 </p>
2853 </dd>
2854 <dt class="hdlist1">
2855 <em>%ai</em>
2856 </dt>
2857 <dd>
2859 author date, ISO 8601-like format
2860 </p>
2861 </dd>
2862 <dt class="hdlist1">
2863 <em>%aI</em>
2864 </dt>
2865 <dd>
2867 author date, strict ISO 8601 format
2868 </p>
2869 </dd>
2870 <dt class="hdlist1">
2871 <em>%as</em>
2872 </dt>
2873 <dd>
2875 author date, short format (<code>YYYY-MM-DD</code>)
2876 </p>
2877 </dd>
2878 <dt class="hdlist1">
2879 <em>%ah</em>
2880 </dt>
2881 <dd>
2883 author date, human style (like the <code>--date=human</code> option of
2884 <a href="git-rev-list.html">git-rev-list(1)</a>)
2885 </p>
2886 </dd>
2887 <dt class="hdlist1">
2888 <em>%cn</em>
2889 </dt>
2890 <dd>
2892 committer name
2893 </p>
2894 </dd>
2895 <dt class="hdlist1">
2896 <em>%cN</em>
2897 </dt>
2898 <dd>
2900 committer name (respecting .mailmap, see
2901 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2902 </p>
2903 </dd>
2904 <dt class="hdlist1">
2905 <em>%ce</em>
2906 </dt>
2907 <dd>
2909 committer email
2910 </p>
2911 </dd>
2912 <dt class="hdlist1">
2913 <em>%cE</em>
2914 </dt>
2915 <dd>
2917 committer email (respecting .mailmap, see
2918 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2919 </p>
2920 </dd>
2921 <dt class="hdlist1">
2922 <em>%cl</em>
2923 </dt>
2924 <dd>
2926 committer email local-part (the part before the <em>@</em> sign)
2927 </p>
2928 </dd>
2929 <dt class="hdlist1">
2930 <em>%cL</em>
2931 </dt>
2932 <dd>
2934 committer local-part (see <em>%cl</em>) respecting .mailmap, see
2935 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2936 </p>
2937 </dd>
2938 <dt class="hdlist1">
2939 <em>%cd</em>
2940 </dt>
2941 <dd>
2943 committer date (format respects --date= option)
2944 </p>
2945 </dd>
2946 <dt class="hdlist1">
2947 <em>%cD</em>
2948 </dt>
2949 <dd>
2951 committer date, RFC2822 style
2952 </p>
2953 </dd>
2954 <dt class="hdlist1">
2955 <em>%cr</em>
2956 </dt>
2957 <dd>
2959 committer date, relative
2960 </p>
2961 </dd>
2962 <dt class="hdlist1">
2963 <em>%ct</em>
2964 </dt>
2965 <dd>
2967 committer date, UNIX timestamp
2968 </p>
2969 </dd>
2970 <dt class="hdlist1">
2971 <em>%ci</em>
2972 </dt>
2973 <dd>
2975 committer date, ISO 8601-like format
2976 </p>
2977 </dd>
2978 <dt class="hdlist1">
2979 <em>%cI</em>
2980 </dt>
2981 <dd>
2983 committer date, strict ISO 8601 format
2984 </p>
2985 </dd>
2986 <dt class="hdlist1">
2987 <em>%cs</em>
2988 </dt>
2989 <dd>
2991 committer date, short format (<code>YYYY-MM-DD</code>)
2992 </p>
2993 </dd>
2994 <dt class="hdlist1">
2995 <em>%ch</em>
2996 </dt>
2997 <dd>
2999 committer date, human style (like the <code>--date=human</code> option of
3000 <a href="git-rev-list.html">git-rev-list(1)</a>)
3001 </p>
3002 </dd>
3003 <dt class="hdlist1">
3004 <em>%d</em>
3005 </dt>
3006 <dd>
3008 ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
3009 </p>
3010 </dd>
3011 <dt class="hdlist1">
3012 <em>%D</em>
3013 </dt>
3014 <dd>
3016 ref names without the " (", ")" wrapping.
3017 </p>
3018 </dd>
3019 <dt class="hdlist1">
3020 <em>%(describe[:options])</em>
3021 </dt>
3022 <dd>
3024 human-readable name, like
3025 <a href="git-describe.html">git-describe(1)</a>; empty string for
3026 undescribable commits. The <code>describe</code> string
3027 may be followed by a colon and zero or more
3028 comma-separated options. Descriptions can be
3029 inconsistent when tags are added or removed at
3030 the same time.
3031 </p>
3032 <div class="ulist"><ul>
3033 <li>
3035 <em>tags[=&lt;bool-value&gt;]</em>: Instead of only considering annotated tags,
3036 consider lightweight tags as well.
3037 </p>
3038 </li>
3039 <li>
3041 <em>abbrev=&lt;number&gt;</em>: Instead of using the default number of hexadecimal digits
3042 (which will vary according to the number of objects in the repository with a
3043 default of 7) of the abbreviated object name, use &lt;number&gt; digits, or as many
3044 digits as needed to form a unique object name.
3045 </p>
3046 </li>
3047 <li>
3049 <em>match=&lt;pattern&gt;</em>: Only consider tags matching the given
3050 <code>glob(7)</code> pattern, excluding the "refs/tags/" prefix.
3051 </p>
3052 </li>
3053 <li>
3055 <em>exclude=&lt;pattern&gt;</em>: Do not consider tags matching the given
3056 <code>glob(7)</code> pattern, excluding the "refs/tags/" prefix.
3057 </p>
3058 </li>
3059 </ul></div>
3060 </dd>
3061 <dt class="hdlist1">
3062 <em>%S</em>
3063 </dt>
3064 <dd>
3066 ref name given on the command line by which the commit was reached
3067 (like <code>git log --source</code>), only works with <code>git log</code>
3068 </p>
3069 </dd>
3070 <dt class="hdlist1">
3071 <em>%e</em>
3072 </dt>
3073 <dd>
3075 encoding
3076 </p>
3077 </dd>
3078 <dt class="hdlist1">
3079 <em>%s</em>
3080 </dt>
3081 <dd>
3083 subject
3084 </p>
3085 </dd>
3086 <dt class="hdlist1">
3087 <em>%f</em>
3088 </dt>
3089 <dd>
3091 sanitized subject line, suitable for a filename
3092 </p>
3093 </dd>
3094 <dt class="hdlist1">
3095 <em>%b</em>
3096 </dt>
3097 <dd>
3099 body
3100 </p>
3101 </dd>
3102 <dt class="hdlist1">
3103 <em>%B</em>
3104 </dt>
3105 <dd>
3107 raw body (unwrapped subject and body)
3108 </p>
3109 </dd>
3110 <dt class="hdlist1">
3111 <em>%N</em>
3112 </dt>
3113 <dd>
3115 commit notes
3116 </p>
3117 </dd>
3118 <dt class="hdlist1">
3119 <em>%GG</em>
3120 </dt>
3121 <dd>
3123 raw verification message from GPG for a signed commit
3124 </p>
3125 </dd>
3126 <dt class="hdlist1">
3127 <em>%G?</em>
3128 </dt>
3129 <dd>
3131 show "G" for a good (valid) signature,
3132 "B" for a bad signature,
3133 "U" for a good signature with unknown validity,
3134 "X" for a good signature that has expired,
3135 "Y" for a good signature made by an expired key,
3136 "R" for a good signature made by a revoked key,
3137 "E" if the signature cannot be checked (e.g. missing key)
3138 and "N" for no signature
3139 </p>
3140 </dd>
3141 <dt class="hdlist1">
3142 <em>%GS</em>
3143 </dt>
3144 <dd>
3146 show the name of the signer for a signed commit
3147 </p>
3148 </dd>
3149 <dt class="hdlist1">
3150 <em>%GK</em>
3151 </dt>
3152 <dd>
3154 show the key used to sign a signed commit
3155 </p>
3156 </dd>
3157 <dt class="hdlist1">
3158 <em>%GF</em>
3159 </dt>
3160 <dd>
3162 show the fingerprint of the key used to sign a signed commit
3163 </p>
3164 </dd>
3165 <dt class="hdlist1">
3166 <em>%GP</em>
3167 </dt>
3168 <dd>
3170 show the fingerprint of the primary key whose subkey was used
3171 to sign a signed commit
3172 </p>
3173 </dd>
3174 <dt class="hdlist1">
3175 <em>%GT</em>
3176 </dt>
3177 <dd>
3179 show the trust level for the key used to sign a signed commit
3180 </p>
3181 </dd>
3182 <dt class="hdlist1">
3183 <em>%gD</em>
3184 </dt>
3185 <dd>
3187 reflog selector, e.g., <code>refs/stash@{1}</code> or <code>refs/stash@{2
3188 minutes ago}</code>; the format follows the rules described for the
3189 <code>-g</code> option. The portion before the <code>@</code> is the refname as
3190 given on the command line (so <code>git log -g refs/heads/master</code>
3191 would yield <code>refs/heads/master@{0}</code>).
3192 </p>
3193 </dd>
3194 <dt class="hdlist1">
3195 <em>%gd</em>
3196 </dt>
3197 <dd>
3199 shortened reflog selector; same as <code>%gD</code>, but the refname
3200 portion is shortened for human readability (so
3201 <code>refs/heads/master</code> becomes just <code>master</code>).
3202 </p>
3203 </dd>
3204 <dt class="hdlist1">
3205 <em>%gn</em>
3206 </dt>
3207 <dd>
3209 reflog identity name
3210 </p>
3211 </dd>
3212 <dt class="hdlist1">
3213 <em>%gN</em>
3214 </dt>
3215 <dd>
3217 reflog identity name (respecting .mailmap, see
3218 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
3219 </p>
3220 </dd>
3221 <dt class="hdlist1">
3222 <em>%ge</em>
3223 </dt>
3224 <dd>
3226 reflog identity email
3227 </p>
3228 </dd>
3229 <dt class="hdlist1">
3230 <em>%gE</em>
3231 </dt>
3232 <dd>
3234 reflog identity email (respecting .mailmap, see
3235 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
3236 </p>
3237 </dd>
3238 <dt class="hdlist1">
3239 <em>%gs</em>
3240 </dt>
3241 <dd>
3243 reflog subject
3244 </p>
3245 </dd>
3246 <dt class="hdlist1">
3247 <em>%(trailers[:options])</em>
3248 </dt>
3249 <dd>
3251 display the trailers of the body as
3252 interpreted by
3253 <a href="git-interpret-trailers.html">git-interpret-trailers(1)</a>. The
3254 <code>trailers</code> string may be followed by a colon
3255 and zero or more comma-separated options.
3256 If any option is provided multiple times the
3257 last occurrence wins.
3258 </p>
3259 <div class="ulist"><ul>
3260 <li>
3262 <em>key=&lt;key&gt;</em>: only show trailers with specified &lt;key&gt;. Matching is done
3263 case-insensitively and trailing colon is optional. If option is
3264 given multiple times trailer lines matching any of the keys are
3265 shown. This option automatically enables the <code>only</code> option so that
3266 non-trailer lines in the trailer block are hidden. If that is not
3267 desired it can be disabled with <code>only=false</code>. E.g.,
3268 <code>%(trailers:key=Reviewed-by)</code> shows trailer lines with key
3269 <code>Reviewed-by</code>.
3270 </p>
3271 </li>
3272 <li>
3274 <em>only[=&lt;bool&gt;]</em>: select whether non-trailer lines from the trailer
3275 block should be included.
3276 </p>
3277 </li>
3278 <li>
3280 <em>separator=&lt;sep&gt;</em>: specify a separator inserted between trailer
3281 lines. When this option is not given each trailer line is
3282 terminated with a line feed character. The string &lt;sep&gt; may contain
3283 the literal formatting codes described above. To use comma as
3284 separator one must use <code>%x2C</code> as it would otherwise be parsed as
3285 next option. E.g., <code>%(trailers:key=Ticket,separator=%x2C )</code>
3286 shows all trailer lines whose key is "Ticket" separated by a comma
3287 and a space.
3288 </p>
3289 </li>
3290 <li>
3292 <em>unfold[=&lt;bool&gt;]</em>: make it behave as if interpret-trailer&#8217;s <code>--unfold</code>
3293 option was given. E.g.,
3294 <code>%(trailers:only,unfold=true)</code> unfolds and shows all trailer lines.
3295 </p>
3296 </li>
3297 <li>
3299 <em>keyonly[=&lt;bool&gt;]</em>: only show the key part of the trailer.
3300 </p>
3301 </li>
3302 <li>
3304 <em>valueonly[=&lt;bool&gt;]</em>: only show the value part of the trailer.
3305 </p>
3306 </li>
3307 <li>
3309 <em>key_value_separator=&lt;sep&gt;</em>: specify a separator inserted between
3310 trailer lines. When this option is not given each trailer key-value
3311 pair is separated by ": ". Otherwise it shares the same semantics
3312 as <em>separator=&lt;sep&gt;</em> above.
3313 </p>
3314 </li>
3315 </ul></div>
3316 </dd>
3317 </dl></div>
3318 </li>
3319 </ul></div>
3320 </li>
3321 </ul></div>
3322 <div class="admonitionblock">
3323 <table><tr>
3324 <td class="icon">
3325 <div class="title">Note</div>
3326 </td>
3327 <td class="content">Some placeholders may depend on other options given to the
3328 revision traversal engine. For example, the <code>%g*</code> reflog options will
3329 insert an empty string unless we are traversing reflog entries (e.g., by
3330 <code>git log -g</code>). The <code>%d</code> and <code>%D</code> placeholders will use the "short"
3331 decoration format if <code>--decorate</code> was not already provided on the command
3332 line.</td>
3333 </tr></table>
3334 </div>
3335 <div class="paragraph"><p>The boolean options accept an optional value <code>[=&lt;bool-value&gt;]</code>. The values
3336 <code>true</code>, <code>false</code>, <code>on</code>, <code>off</code> etc. are all accepted. See the "boolean"
3337 sub-section in "EXAMPLES" in <a href="git-config.html">git-config(1)</a>. If a boolean
3338 option is given with no value, it&#8217;s enabled.</p></div>
3339 <div class="paragraph"><p>If you add a <code>+</code> (plus sign) after <em>%</em> of a placeholder, a line-feed
3340 is inserted immediately before the expansion if and only if the
3341 placeholder expands to a non-empty string.</p></div>
3342 <div class="paragraph"><p>If you add a <code>-</code> (minus sign) after <em>%</em> of a placeholder, all consecutive
3343 line-feeds immediately preceding the expansion are deleted if and only if the
3344 placeholder expands to an empty string.</p></div>
3345 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
3346 is inserted immediately before the expansion if and only if the
3347 placeholder expands to a non-empty string.</p></div>
3348 <div class="ulist"><ul>
3349 <li>
3351 <em>tformat:</em>
3352 </p>
3353 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
3354 provides "terminator" semantics instead of "separator" semantics. In
3355 other words, each commit has the message terminator character (usually a
3356 newline) appended, rather than a separator placed between entries.
3357 This means that the final entry of a single-line format will be properly
3358 terminated with a new line, just as the "oneline" format does.
3359 For example:</p></div>
3360 <div class="listingblock">
3361 <div class="content">
3362 <pre><code>$ git log -2 --pretty=format:%h 4da45bef \
3363 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
3364 4da45be
3365 7134973 -- NO NEWLINE
3367 $ git log -2 --pretty=tformat:%h 4da45bef \
3368 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
3369 4da45be
3370 7134973</code></pre>
3371 </div></div>
3372 <div class="paragraph"><p>In addition, any unrecognized string that has a <code>%</code> in it is interpreted
3373 as if it has <code>tformat:</code> in front of it. For example, these two are
3374 equivalent:</p></div>
3375 <div class="listingblock">
3376 <div class="content">
3377 <pre><code>$ git log -2 --pretty=tformat:%h 4da45bef
3378 $ git log -2 --pretty=%h 4da45bef</code></pre>
3379 </div></div>
3380 </li>
3381 </ul></div>
3382 </div>
3383 </div>
3384 <div class="sect1">
3385 <h2 id="_raw_output_format">Raw output format</h2>
3386 <div class="sectionbody">
3387 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
3388 "git-diff-files" and "git diff --raw" are very similar.</p></div>
3389 <div class="paragraph"><p>These commands all compare two sets of things; what is
3390 compared differs:</p></div>
3391 <div class="dlist"><dl>
3392 <dt class="hdlist1">
3393 git-diff-index &lt;tree-ish&gt;
3394 </dt>
3395 <dd>
3397 compares the &lt;tree-ish&gt; and the files on the filesystem.
3398 </p>
3399 </dd>
3400 <dt class="hdlist1">
3401 git-diff-index --cached &lt;tree-ish&gt;
3402 </dt>
3403 <dd>
3405 compares the &lt;tree-ish&gt; and the index.
3406 </p>
3407 </dd>
3408 <dt class="hdlist1">
3409 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
3410 </dt>
3411 <dd>
3413 compares the trees named by the two arguments.
3414 </p>
3415 </dd>
3416 <dt class="hdlist1">
3417 git-diff-files [&lt;pattern&gt;&#8230;]
3418 </dt>
3419 <dd>
3421 compares the index and the files on the filesystem.
3422 </p>
3423 </dd>
3424 </dl></div>
3425 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
3426 what is being compared. After that, all the commands print one output
3427 line per changed file.</p></div>
3428 <div class="paragraph"><p>An output line is formatted this way:</p></div>
3429 <div class="listingblock">
3430 <div class="content">
3431 <pre><code>in-place edit :100644 100644 bcd1234 0123456 M file0
3432 copy-edit :100644 100644 abcd123 1234567 C68 file1 file2
3433 rename-edit :100644 100644 abcd123 1234567 R86 file1 file3
3434 create :000000 100644 0000000 1234567 A file4
3435 delete :100644 000000 1234567 0000000 D file5
3436 unmerged :000000 000000 0000000 0000000 U file6</code></pre>
3437 </div></div>
3438 <div class="paragraph"><p>That is, from the left to the right:</p></div>
3439 <div class="olist arabic"><ol class="arabic">
3440 <li>
3442 a colon.
3443 </p>
3444 </li>
3445 <li>
3447 mode for "src"; 000000 if creation or unmerged.
3448 </p>
3449 </li>
3450 <li>
3452 a space.
3453 </p>
3454 </li>
3455 <li>
3457 mode for "dst"; 000000 if deletion or unmerged.
3458 </p>
3459 </li>
3460 <li>
3462 a space.
3463 </p>
3464 </li>
3465 <li>
3467 sha1 for "src"; 0{40} if creation or unmerged.
3468 </p>
3469 </li>
3470 <li>
3472 a space.
3473 </p>
3474 </li>
3475 <li>
3477 sha1 for "dst"; 0{40} if deletion, unmerged or "work tree out of sync with the index".
3478 </p>
3479 </li>
3480 <li>
3482 a space.
3483 </p>
3484 </li>
3485 <li>
3487 status, followed by optional "score" number.
3488 </p>
3489 </li>
3490 <li>
3492 a tab or a NUL when <code>-z</code> option is used.
3493 </p>
3494 </li>
3495 <li>
3497 path for "src"
3498 </p>
3499 </li>
3500 <li>
3502 a tab or a NUL when <code>-z</code> option is used; only exists for C or R.
3503 </p>
3504 </li>
3505 <li>
3507 path for "dst"; only exists for C or R.
3508 </p>
3509 </li>
3510 <li>
3512 an LF or a NUL when <code>-z</code> option is used, to terminate the record.
3513 </p>
3514 </li>
3515 </ol></div>
3516 <div class="paragraph"><p>Possible status letters are:</p></div>
3517 <div class="ulist"><ul>
3518 <li>
3520 A: addition of a file
3521 </p>
3522 </li>
3523 <li>
3525 C: copy of a file into a new one
3526 </p>
3527 </li>
3528 <li>
3530 D: deletion of a file
3531 </p>
3532 </li>
3533 <li>
3535 M: modification of the contents or mode of a file
3536 </p>
3537 </li>
3538 <li>
3540 R: renaming of a file
3541 </p>
3542 </li>
3543 <li>
3545 T: change in the type of the file (regular file, symbolic link or submodule)
3546 </p>
3547 </li>
3548 <li>
3550 U: file is unmerged (you must complete the merge before it can
3551 be committed)
3552 </p>
3553 </li>
3554 <li>
3556 X: "unknown" change type (most probably a bug, please report it)
3557 </p>
3558 </li>
3559 </ul></div>
3560 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
3561 percentage of similarity between the source and target of the move or
3562 copy). Status letter M may be followed by a score (denoting the
3563 percentage of dissimilarity) for file rewrites.</p></div>
3564 <div class="paragraph"><p>The sha1 for "dst" is shown as all 0&#8217;s if a file on the filesystem
3565 is out of sync with the index.</p></div>
3566 <div class="paragraph"><p>Example:</p></div>
3567 <div class="listingblock">
3568 <div class="content">
3569 <pre><code>:100644 100644 5be4a4a 0000000 M file.c</code></pre>
3570 </div></div>
3571 <div class="paragraph"><p>Without the <code>-z</code> option, pathnames with "unusual" characters are
3572 quoted as explained for the configuration variable <code>core.quotePath</code>
3573 (see <a href="git-config.html">git-config(1)</a>). Using <code>-z</code> the filename is output
3574 verbatim and the line is terminated by a NUL byte.</p></div>
3575 </div>
3576 </div>
3577 <div class="sect1">
3578 <h2 id="_diff_format_for_merges">diff format for merges</h2>
3579 <div class="sectionbody">
3580 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
3581 can take <code>-c</code> or <code>--cc</code> option
3582 to generate diff output also for merge commits. The output differs
3583 from the format described above in the following way:</p></div>
3584 <div class="olist arabic"><ol class="arabic">
3585 <li>
3587 there is a colon for each parent
3588 </p>
3589 </li>
3590 <li>
3592 there are more "src" modes and "src" sha1
3593 </p>
3594 </li>
3595 <li>
3597 status is concatenated status characters for each parent
3598 </p>
3599 </li>
3600 <li>
3602 no optional "score" number
3603 </p>
3604 </li>
3605 <li>
3607 tab-separated pathname(s) of the file
3608 </p>
3609 </li>
3610 </ol></div>
3611 <div class="paragraph"><p>For <code>-c</code> and <code>--cc</code>, only the destination or final path is shown even
3612 if the file was renamed on any side of history. With
3613 <code>--combined-all-paths</code>, the name of the path in each parent is shown
3614 followed by the name of the path in the merge commit.</p></div>
3615 <div class="paragraph"><p>Examples for <code>-c</code> and <code>--cc</code> without <code>--combined-all-paths</code>:</p></div>
3616 <div class="listingblock">
3617 <div class="content">
3618 <pre><code>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c
3619 ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh
3620 ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c</code></pre>
3621 </div></div>
3622 <div class="paragraph"><p>Examples when <code>--combined-all-paths</code> added to either <code>-c</code> or <code>--cc</code>:</p></div>
3623 <div class="listingblock">
3624 <div class="content">
3625 <pre><code>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c desc.c desc.c
3626 ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh
3627 ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey.c fuey.c phooey.c</code></pre>
3628 </div></div>
3629 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
3630 all parents.</p></div>
3631 </div>
3632 </div>
3633 <div class="sect1">
3634 <h2 id="generate_patch_text_with_p">Generating patch text with -p</h2>
3635 <div class="sectionbody">
3636 <div class="paragraph"><p>Running
3637 <a href="git-diff.html">git-diff(1)</a>,
3638 <a href="git-log.html">git-log(1)</a>,
3639 <a href="git-show.html">git-show(1)</a>,
3640 <a href="git-diff-index.html">git-diff-index(1)</a>,
3641 <a href="git-diff-tree.html">git-diff-tree(1)</a>, or
3642 <a href="git-diff-files.html">git-diff-files(1)</a>
3643 with the <code>-p</code> option produces patch text.
3644 You can customize the creation of patch text via the
3645 <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables
3646 (see <a href="git.html">git(1)</a>), and the <code>diff</code> attribute (see <a href="gitattributes.html">gitattributes(5)</a>).</p></div>
3647 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
3648 diff format:</p></div>
3649 <div class="olist arabic"><ol class="arabic">
3650 <li>
3652 It is preceded with a "git diff" header that looks like this:
3653 </p>
3654 <div class="literalblock">
3655 <div class="content">
3656 <pre><code>diff --git a/file1 b/file2</code></pre>
3657 </div></div>
3658 <div class="paragraph"><p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is
3659 involved. Especially, even for a creation or a deletion,
3660 <code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div>
3661 <div class="paragraph"><p>When rename/copy is involved, <code>file1</code> and <code>file2</code> show the
3662 name of the source file of the rename/copy and the name of
3663 the file that rename/copy produces, respectively.</p></div>
3664 </li>
3665 <li>
3667 It is followed by one or more extended header lines:
3668 </p>
3669 <div class="literalblock">
3670 <div class="content">
3671 <pre><code>old mode &lt;mode&gt;
3672 new mode &lt;mode&gt;
3673 deleted file mode &lt;mode&gt;
3674 new file mode &lt;mode&gt;
3675 copy from &lt;path&gt;
3676 copy to &lt;path&gt;
3677 rename from &lt;path&gt;
3678 rename to &lt;path&gt;
3679 similarity index &lt;number&gt;
3680 dissimilarity index &lt;number&gt;
3681 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</code></pre>
3682 </div></div>
3683 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
3684 and file permission bits.</p></div>
3685 <div class="paragraph"><p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p></div>
3686 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
3687 the dissimilarity index is the percentage of changed lines. It
3688 is a rounded down integer, followed by a percent sign. The
3689 similarity index value of 100% is thus reserved for two equal
3690 files, while 100% dissimilarity means that no line from the old
3691 file made it into the new one.</p></div>
3692 <div class="paragraph"><p>The index line includes the blob object names before and after the change.
3693 The &lt;mode&gt; is included if the file mode does not change; otherwise,
3694 separate lines indicate the old and the new mode.</p></div>
3695 </li>
3696 <li>
3698 Pathnames with "unusual" characters are quoted as explained for
3699 the configuration variable <code>core.quotePath</code> (see
3700 <a href="git-config.html">git-config(1)</a>).
3701 </p>
3702 </li>
3703 <li>
3705 All the <code>file1</code> files in the output refer to files before the
3706 commit, and all the <code>file2</code> files refer to files after the commit.
3707 It is incorrect to apply each change to each file sequentially. For
3708 example, this patch will swap a and b:
3709 </p>
3710 <div class="literalblock">
3711 <div class="content">
3712 <pre><code>diff --git a/a b/b
3713 rename from a
3714 rename to b
3715 diff --git a/b b/a
3716 rename from b
3717 rename to a</code></pre>
3718 </div></div>
3719 </li>
3720 <li>
3722 Hunk headers mention the name of the function to which the hunk
3723 applies. See "Defining a custom hunk-header" in
3724 <a href="gitattributes.html">gitattributes(5)</a> for details of how to tailor to this to
3725 specific languages.
3726 </p>
3727 </li>
3728 </ol></div>
3729 </div>
3730 </div>
3731 <div class="sect1">
3732 <h2 id="_combined_diff_format">Combined diff format</h2>
3733 <div class="sectionbody">
3734 <div class="paragraph"><p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to
3735 produce a <em>combined diff</em> when showing a merge. This is the default
3736 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
3737 <a href="git-show.html">git-show(1)</a>. Note also that you can give suitable
3738 <code>--diff-merges</code> option to any of these commands to force generation of
3739 diffs in specific format.</p></div>
3740 <div class="paragraph"><p>A "combined diff" format looks like this:</p></div>
3741 <div class="listingblock">
3742 <div class="content">
3743 <pre><code>diff --combined describe.c
3744 index fabadb8,cc95eb0..4866510
3745 --- a/describe.c
3746 +++ b/describe.c
3747 @@@ -98,20 -98,12 +98,20 @@@
3748 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
3751 - static void describe(char *arg)
3752 -static void describe(struct commit *cmit, int last_one)
3753 ++static void describe(char *arg, int last_one)
3755 + unsigned char sha1[20];
3756 + struct commit *cmit;
3757 struct commit_list *list;
3758 static int initialized = 0;
3759 struct commit_name *n;
3761 + if (get_sha1(arg, sha1) &lt; 0)
3762 + usage(describe_usage);
3763 + cmit = lookup_commit_reference(sha1);
3764 + if (!cmit)
3765 + usage(describe_usage);
3767 if (!initialized) {
3768 initialized = 1;
3769 for_each_ref(get_name);</code></pre>
3770 </div></div>
3771 <div class="olist arabic"><ol class="arabic">
3772 <li>
3774 It is preceded with a "git diff" header, that looks like
3775 this (when the <code>-c</code> option is used):
3776 </p>
3777 <div class="literalblock">
3778 <div class="content">
3779 <pre><code>diff --combined file</code></pre>
3780 </div></div>
3781 <div class="paragraph"><p>or like this (when the <code>--cc</code> option is used):</p></div>
3782 <div class="literalblock">
3783 <div class="content">
3784 <pre><code>diff --cc file</code></pre>
3785 </div></div>
3786 </li>
3787 <li>
3789 It is followed by one or more extended header lines
3790 (this example shows a merge with two parents):
3791 </p>
3792 <div class="literalblock">
3793 <div class="content">
3794 <pre><code>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
3795 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
3796 new file mode &lt;mode&gt;
3797 deleted file mode &lt;mode&gt;,&lt;mode&gt;</code></pre>
3798 </div></div>
3799 <div class="paragraph"><p>The <code>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</code> line appears only if at least one of
3800 the &lt;mode&gt; is different from the rest. Extended headers with
3801 information about detected contents movement (renames and
3802 copying detection) are designed to work with diff of two
3803 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
3804 </li>
3805 <li>
3807 It is followed by two-line from-file/to-file header
3808 </p>
3809 <div class="literalblock">
3810 <div class="content">
3811 <pre><code>--- a/file
3812 +++ b/file</code></pre>
3813 </div></div>
3814 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
3815 format, <code>/dev/null</code> is used to signal created or deleted
3816 files.</p></div>
3817 <div class="paragraph"><p>However, if the --combined-all-paths option is provided, instead of a
3818 two-line from-file/to-file you get a N+1 line from-file/to-file header,
3819 where N is the number of parents in the merge commit</p></div>
3820 <div class="literalblock">
3821 <div class="content">
3822 <pre><code>--- a/file
3823 --- a/file
3824 --- a/file
3825 +++ b/file</code></pre>
3826 </div></div>
3827 <div class="paragraph"><p>This extended format can be useful if rename or copy detection is
3828 active, to allow you to see the original name of the file in different
3829 parents.</p></div>
3830 </li>
3831 <li>
3833 Chunk header format is modified to prevent people from
3834 accidentally feeding it to <code>patch -p1</code>. Combined diff format
3835 was created for review of merge commit changes, and was not
3836 meant to be applied. The change is similar to the change in the
3837 extended <em>index</em> header:
3838 </p>
3839 <div class="literalblock">
3840 <div class="content">
3841 <pre><code>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</code></pre>
3842 </div></div>
3843 <div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk
3844 header for combined diff format.</p></div>
3845 </li>
3846 </ol></div>
3847 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
3848 files A and B with a single column that has <code>-</code> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <code>+</code> (plus&#8201;&#8212;&#8201;missing in A but
3849 added to B), or <code>" "</code> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
3850 compares two or more files file1, file2,&#8230; with one file X, and
3851 shows how X differs from each of fileN. One column for each of
3852 fileN is prepended to the output line to note how X&#8217;s line is
3853 different from it.</p></div>
3854 <div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in
3855 fileN but it does not appear in the result. A <code>+</code> character
3856 in the column N means that the line appears in the result,
3857 and fileN does not have that line (in other words, the line was
3858 added, from the point of view of that parent).</p></div>
3859 <div class="paragraph"><p>In the above example output, the function signature was changed
3860 from both files (hence two <code>-</code> removals from both file1 and
3861 file2, plus <code>++</code> to mean one line that was added does not appear
3862 in either file1 or file2). Also eight other lines are the same
3863 from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div>
3864 <div class="paragraph"><p>When shown by <code>git diff-tree -c</code>, it compares the parents of a
3865 merge commit with the merge result (i.e. file1..fileN are the
3866 parents). When shown by <code>git diff-files -c</code>, it compares the
3867 two unresolved merge parents with the working tree file
3868 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
3869 "their version").</p></div>
3870 </div>
3871 </div>
3872 <div class="sect1">
3873 <h2 id="_other_diff_formats">other diff formats</h2>
3874 <div class="sectionbody">
3875 <div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and
3876 copied files. The <code>--stat</code> option adds diffstat(1) graph to the
3877 output. These options can be combined with other options, such as
3878 <code>-p</code>, and are meant for human consumption.</p></div>
3879 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <code>--stat</code> output
3880 formats the pathnames compactly by combining common prefix and suffix of
3881 the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to
3882 <code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div>
3883 <div class="listingblock">
3884 <div class="content">
3885 <pre><code>arch/{i386 =&gt; x86}/Makefile | 4 +--</code></pre>
3886 </div></div>
3887 <div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed
3888 for easier machine consumption. An entry in <code>--numstat</code> output looks
3889 like this:</p></div>
3890 <div class="listingblock">
3891 <div class="content">
3892 <pre><code>1 2 README
3893 3 1 arch/{i386 =&gt; x86}/Makefile</code></pre>
3894 </div></div>
3895 <div class="paragraph"><p>That is, from left to right:</p></div>
3896 <div class="olist arabic"><ol class="arabic">
3897 <li>
3899 the number of added lines;
3900 </p>
3901 </li>
3902 <li>
3904 a tab;
3905 </p>
3906 </li>
3907 <li>
3909 the number of deleted lines;
3910 </p>
3911 </li>
3912 <li>
3914 a tab;
3915 </p>
3916 </li>
3917 <li>
3919 pathname (possibly with rename/copy information);
3920 </p>
3921 </li>
3922 <li>
3924 a newline.
3925 </p>
3926 </li>
3927 </ol></div>
3928 <div class="paragraph"><p>When <code>-z</code> output option is in effect, the output is formatted this way:</p></div>
3929 <div class="listingblock">
3930 <div class="content">
3931 <pre><code>1 2 README NUL
3932 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre>
3933 </div></div>
3934 <div class="paragraph"><p>That is:</p></div>
3935 <div class="olist arabic"><ol class="arabic">
3936 <li>
3938 the number of added lines;
3939 </p>
3940 </li>
3941 <li>
3943 a tab;
3944 </p>
3945 </li>
3946 <li>
3948 the number of deleted lines;
3949 </p>
3950 </li>
3951 <li>
3953 a tab;
3954 </p>
3955 </li>
3956 <li>
3958 a NUL (only exists if renamed/copied);
3959 </p>
3960 </li>
3961 <li>
3963 pathname in preimage;
3964 </p>
3965 </li>
3966 <li>
3968 a NUL (only exists if renamed/copied);
3969 </p>
3970 </li>
3971 <li>
3973 pathname in postimage (only exists if renamed/copied);
3974 </p>
3975 </li>
3976 <li>
3978 a NUL.
3979 </p>
3980 </li>
3981 </ol></div>
3982 <div class="paragraph"><p>The extra <code>NUL</code> before the preimage path in renamed case is to allow
3983 scripts that read the output to tell if the current record being read is
3984 a single-path record or a rename/copy record without reading ahead.
3985 After reading added and deleted lines, reading up to <code>NUL</code> would yield
3986 the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div>
3987 </div>
3988 </div>
3989 <div class="sect1">
3990 <h2 id="_git">GIT</h2>
3991 <div class="sectionbody">
3992 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
3993 </div>
3994 </div>
3995 </div>
3996 <div id="footnotes"><hr /></div>
3997 <div id="footer">
3998 <div id="footer-text">
3999 Last updated
4000 2021-12-10 14:52:02 PST
4001 </div>
4002 </div>
4003 </body>
4004 </html>