Autogenerated HTML docs for v2.42.0-241-g6bdb5
[git-htmldocs.git] / git-diff-tree.html
blob3178ede316f1af98f31cad562b35c66cfb958bf8
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 <a href="#generate_patch_text_with_p">[generate_patch_text_with_p]</a>).
784 </p>
785 </dd>
786 <dt class="hdlist1">
788 </dt>
789 <dt class="hdlist1">
790 --no-patch
791 </dt>
792 <dd>
794 Suppress all output from the diff machinery. Useful for
795 commands like <code>git show</code> that show the patch by default to
796 squelch their output, or to cancel the effect of options like
797 <code>--patch</code>, <code>--stat</code> earlier on the command line in an alias.
798 </p>
799 </dd>
800 <dt class="hdlist1">
801 -U&lt;n&gt;
802 </dt>
803 <dt class="hdlist1">
804 --unified=&lt;n&gt;
805 </dt>
806 <dd>
808 Generate diffs with &lt;n&gt; lines of context instead of
809 the usual three.
810 Implies <code>--patch</code>.
811 </p>
812 </dd>
813 <dt class="hdlist1">
814 --output=&lt;file&gt;
815 </dt>
816 <dd>
818 Output to a specific file instead of stdout.
819 </p>
820 </dd>
821 <dt class="hdlist1">
822 --output-indicator-new=&lt;char&gt;
823 </dt>
824 <dt class="hdlist1">
825 --output-indicator-old=&lt;char&gt;
826 </dt>
827 <dt class="hdlist1">
828 --output-indicator-context=&lt;char&gt;
829 </dt>
830 <dd>
832 Specify the character used to indicate new, old or context
833 lines in the generated patch. Normally they are <em>+</em>, <em>-</em> and
834 ' ' respectively.
835 </p>
836 </dd>
837 <dt class="hdlist1">
838 --raw
839 </dt>
840 <dd>
842 Generate the diff in raw format.
843 This is the default.
844 </p>
845 </dd>
846 <dt class="hdlist1">
847 --patch-with-raw
848 </dt>
849 <dd>
851 Synonym for <code>-p --raw</code>.
852 </p>
853 </dd>
854 <dt class="hdlist1">
855 --indent-heuristic
856 </dt>
857 <dd>
859 Enable the heuristic that shifts diff hunk boundaries to make patches
860 easier to read. This is the default.
861 </p>
862 </dd>
863 <dt class="hdlist1">
864 --no-indent-heuristic
865 </dt>
866 <dd>
868 Disable the indent heuristic.
869 </p>
870 </dd>
871 <dt class="hdlist1">
872 --minimal
873 </dt>
874 <dd>
876 Spend extra time to make sure the smallest possible
877 diff is produced.
878 </p>
879 </dd>
880 <dt class="hdlist1">
881 --patience
882 </dt>
883 <dd>
885 Generate a diff using the "patience diff" algorithm.
886 </p>
887 </dd>
888 <dt class="hdlist1">
889 --histogram
890 </dt>
891 <dd>
893 Generate a diff using the "histogram diff" algorithm.
894 </p>
895 </dd>
896 <dt class="hdlist1">
897 --anchored=&lt;text&gt;
898 </dt>
899 <dd>
901 Generate a diff using the "anchored diff" algorithm.
902 </p>
903 <div class="paragraph"><p>This option may be specified more than once.</p></div>
904 <div class="paragraph"><p>If a line exists in both the source and destination, exists only once,
905 and starts with this text, this algorithm attempts to prevent it from
906 appearing as a deletion or addition in the output. It uses the "patience
907 diff" algorithm internally.</p></div>
908 </dd>
909 <dt class="hdlist1">
910 --diff-algorithm={patience|minimal|histogram|myers}
911 </dt>
912 <dd>
914 Choose a diff algorithm. The variants are as follows:
915 </p>
916 <div class="openblock">
917 <div class="content">
918 <div class="dlist"><dl>
919 <dt class="hdlist1">
920 <code>default</code>, <code>myers</code>
921 </dt>
922 <dd>
924 The basic greedy diff algorithm. Currently, this is the default.
925 </p>
926 </dd>
927 <dt class="hdlist1">
928 <code>minimal</code>
929 </dt>
930 <dd>
932 Spend extra time to make sure the smallest possible diff is
933 produced.
934 </p>
935 </dd>
936 <dt class="hdlist1">
937 <code>patience</code>
938 </dt>
939 <dd>
941 Use "patience diff" algorithm when generating patches.
942 </p>
943 </dd>
944 <dt class="hdlist1">
945 <code>histogram</code>
946 </dt>
947 <dd>
949 This algorithm extends the patience algorithm to "support
950 low-occurrence common elements".
951 </p>
952 </dd>
953 </dl></div>
954 </div></div>
955 <div class="paragraph"><p>For instance, if you configured the <code>diff.algorithm</code> variable to a
956 non-default value and want to use the default one, then you
957 have to use <code>--diff-algorithm=default</code> option.</p></div>
958 </dd>
959 <dt class="hdlist1">
960 --stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
961 </dt>
962 <dd>
964 Generate a diffstat. By default, as much space as necessary
965 will be used for the filename part, and the rest for the graph
966 part. Maximum width defaults to terminal width, or 80 columns
967 if not connected to a terminal, and can be overridden by
968 <code>&lt;width&gt;</code>. The width of the filename part can be limited by
969 giving another width <code>&lt;name-width&gt;</code> after a comma. The width
970 of the graph part can be limited by using
971 <code>--stat-graph-width=&lt;width&gt;</code> (affects all commands generating
972 a stat graph) or by setting <code>diff.statGraphWidth=&lt;width&gt;</code>
973 (does not affect <code>git format-patch</code>).
974 By giving a third parameter <code>&lt;count&gt;</code>, you can limit the
975 output to the first <code>&lt;count&gt;</code> lines, followed by <code>...</code> if
976 there are more.
977 </p>
978 <div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=&lt;width&gt;</code>,
979 <code>--stat-name-width=&lt;name-width&gt;</code> and <code>--stat-count=&lt;count&gt;</code>.</p></div>
980 </dd>
981 <dt class="hdlist1">
982 --compact-summary
983 </dt>
984 <dd>
986 Output a condensed summary of extended header information such
987 as file creations or deletions ("new" or "gone", optionally "+l"
988 if it&#8217;s a symlink) and mode changes ("+x" or "-x" for adding
989 or removing executable bit respectively) in diffstat. The
990 information is put between the filename part and the graph
991 part. Implies <code>--stat</code>.
992 </p>
993 </dd>
994 <dt class="hdlist1">
995 --numstat
996 </dt>
997 <dd>
999 Similar to <code>--stat</code>, but shows number of added and
1000 deleted lines in decimal notation and pathname without
1001 abbreviation, to make it more machine friendly. For
1002 binary files, outputs two <code>-</code> instead of saying
1003 <code>0 0</code>.
1004 </p>
1005 </dd>
1006 <dt class="hdlist1">
1007 --shortstat
1008 </dt>
1009 <dd>
1011 Output only the last line of the <code>--stat</code> format containing total
1012 number of modified files, as well as number of added and deleted
1013 lines.
1014 </p>
1015 </dd>
1016 <dt class="hdlist1">
1017 -X[&lt;param1,param2,&#8230;&gt;]
1018 </dt>
1019 <dt class="hdlist1">
1020 --dirstat[=&lt;param1,param2,&#8230;&gt;]
1021 </dt>
1022 <dd>
1024 Output the distribution of relative amount of changes for each
1025 sub-directory. The behavior of <code>--dirstat</code> can be customized by
1026 passing it a comma separated list of parameters.
1027 The defaults are controlled by the <code>diff.dirstat</code> configuration
1028 variable (see <a href="git-config.html">git-config(1)</a>).
1029 The following parameters are available:
1030 </p>
1031 <div class="openblock">
1032 <div class="content">
1033 <div class="dlist"><dl>
1034 <dt class="hdlist1">
1035 <code>changes</code>
1036 </dt>
1037 <dd>
1039 Compute the dirstat numbers by counting the lines that have been
1040 removed from the source, or added to the destination. This ignores
1041 the amount of pure code movements within a file. In other words,
1042 rearranging lines in a file is not counted as much as other changes.
1043 This is the default behavior when no parameter is given.
1044 </p>
1045 </dd>
1046 <dt class="hdlist1">
1047 <code>lines</code>
1048 </dt>
1049 <dd>
1051 Compute the dirstat numbers by doing the regular line-based diff
1052 analysis, and summing the removed/added line counts. (For binary
1053 files, count 64-byte chunks instead, since binary files have no
1054 natural concept of lines). This is a more expensive <code>--dirstat</code>
1055 behavior than the <code>changes</code> behavior, but it does count rearranged
1056 lines within a file as much as other changes. The resulting output
1057 is consistent with what you get from the other <code>--*stat</code> options.
1058 </p>
1059 </dd>
1060 <dt class="hdlist1">
1061 <code>files</code>
1062 </dt>
1063 <dd>
1065 Compute the dirstat numbers by counting the number of files changed.
1066 Each changed file counts equally in the dirstat analysis. This is
1067 the computationally cheapest <code>--dirstat</code> behavior, since it does
1068 not have to look at the file contents at all.
1069 </p>
1070 </dd>
1071 <dt class="hdlist1">
1072 <code>cumulative</code>
1073 </dt>
1074 <dd>
1076 Count changes in a child directory for the parent directory as well.
1077 Note that when using <code>cumulative</code>, the sum of the percentages
1078 reported may exceed 100%. The default (non-cumulative) behavior can
1079 be specified with the <code>noncumulative</code> parameter.
1080 </p>
1081 </dd>
1082 <dt class="hdlist1">
1083 &lt;limit&gt;
1084 </dt>
1085 <dd>
1087 An integer parameter specifies a cut-off percent (3% by default).
1088 Directories contributing less than this percentage of the changes
1089 are not shown in the output.
1090 </p>
1091 </dd>
1092 </dl></div>
1093 </div></div>
1094 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
1095 directories with less than 10% of the total amount of changed files,
1096 and accumulating child directory counts in the parent directories:
1097 <code>--dirstat=files,10,cumulative</code>.</p></div>
1098 </dd>
1099 <dt class="hdlist1">
1100 --cumulative
1101 </dt>
1102 <dd>
1104 Synonym for --dirstat=cumulative
1105 </p>
1106 </dd>
1107 <dt class="hdlist1">
1108 --dirstat-by-file[=&lt;param1,param2&gt;&#8230;]
1109 </dt>
1110 <dd>
1112 Synonym for --dirstat=files,param1,param2&#8230;
1113 </p>
1114 </dd>
1115 <dt class="hdlist1">
1116 --summary
1117 </dt>
1118 <dd>
1120 Output a condensed summary of extended header information
1121 such as creations, renames and mode changes.
1122 </p>
1123 </dd>
1124 <dt class="hdlist1">
1125 --patch-with-stat
1126 </dt>
1127 <dd>
1129 Synonym for <code>-p --stat</code>.
1130 </p>
1131 </dd>
1132 <dt class="hdlist1">
1134 </dt>
1135 <dd>
1137 When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been
1138 given, do not munge pathnames and use NULs as output field terminators.
1139 </p>
1140 <div class="paragraph"><p>Without this option, pathnames with "unusual" characters are quoted as
1141 explained for the configuration variable <code>core.quotePath</code> (see
1142 <a href="git-config.html">git-config(1)</a>).</p></div>
1143 </dd>
1144 <dt class="hdlist1">
1145 --name-only
1146 </dt>
1147 <dd>
1149 Show only names of changed files. The file names are often encoded in UTF-8.
1150 For more information see the discussion about encoding in the <a href="git-log.html">git-log(1)</a>
1151 manual page.
1152 </p>
1153 </dd>
1154 <dt class="hdlist1">
1155 --name-status
1156 </dt>
1157 <dd>
1159 Show only names and status of changed files. See the description
1160 of the <code>--diff-filter</code> option on what the status letters mean.
1161 Just like <code>--name-only</code> the file names are often encoded in UTF-8.
1162 </p>
1163 </dd>
1164 <dt class="hdlist1">
1165 --submodule[=&lt;format&gt;]
1166 </dt>
1167 <dd>
1169 Specify how differences in submodules are shown. When specifying
1170 <code>--submodule=short</code> the <em>short</em> format is used. This format just
1171 shows the names of the commits at the beginning and end of the range.
1172 When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em>
1173 format is used. This format lists the commits in the range like
1174 <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
1175 is specified, the <em>diff</em> format is used. This format shows an
1176 inline diff of the changes in the submodule contents between the
1177 commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format
1178 if the config option is unset.
1179 </p>
1180 </dd>
1181 <dt class="hdlist1">
1182 --color[=&lt;when&gt;]
1183 </dt>
1184 <dd>
1186 Show colored diff.
1187 <code>--color</code> (i.e. without <em>=&lt;when&gt;</em>) is the same as <code>--color=always</code>.
1188 <em>&lt;when&gt;</em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>.
1189 </p>
1190 </dd>
1191 <dt class="hdlist1">
1192 --no-color
1193 </dt>
1194 <dd>
1196 Turn off colored diff.
1197 It is the same as <code>--color=never</code>.
1198 </p>
1199 </dd>
1200 <dt class="hdlist1">
1201 --color-moved[=&lt;mode&gt;]
1202 </dt>
1203 <dd>
1205 Moved lines of code are colored differently.
1206 The &lt;mode&gt; defaults to <em>no</em> if the option is not given
1207 and to <em>zebra</em> if the option with no mode is given.
1208 The mode must be one of:
1209 </p>
1210 <div class="openblock">
1211 <div class="content">
1212 <div class="dlist"><dl>
1213 <dt class="hdlist1">
1215 </dt>
1216 <dd>
1218 Moved lines are not highlighted.
1219 </p>
1220 </dd>
1221 <dt class="hdlist1">
1222 default
1223 </dt>
1224 <dd>
1226 Is a synonym for <code>zebra</code>. This may change to a more sensible mode
1227 in the future.
1228 </p>
1229 </dd>
1230 <dt class="hdlist1">
1231 plain
1232 </dt>
1233 <dd>
1235 Any line that is added in one location and was removed
1236 in another location will be colored with <em>color.diff.newMoved</em>.
1237 Similarly <em>color.diff.oldMoved</em> will be used for removed lines
1238 that are added somewhere else in the diff. This mode picks up any
1239 moved line, but it is not very useful in a review to determine
1240 if a block of code was moved without permutation.
1241 </p>
1242 </dd>
1243 <dt class="hdlist1">
1244 blocks
1245 </dt>
1246 <dd>
1248 Blocks of moved text of at least 20 alphanumeric characters
1249 are detected greedily. The detected blocks are
1250 painted using either the <em>color.diff.{old,new}Moved</em> color.
1251 Adjacent blocks cannot be told apart.
1252 </p>
1253 </dd>
1254 <dt class="hdlist1">
1255 zebra
1256 </dt>
1257 <dd>
1259 Blocks of moved text are detected as in <em>blocks</em> mode. The blocks
1260 are painted using either the <em>color.diff.{old,new}Moved</em> color or
1261 <em>color.diff.{old,new}MovedAlternative</em>. The change between
1262 the two colors indicates that a new block was detected.
1263 </p>
1264 </dd>
1265 <dt class="hdlist1">
1266 dimmed-zebra
1267 </dt>
1268 <dd>
1270 Similar to <em>zebra</em>, but additional dimming of uninteresting parts
1271 of moved code is performed. The bordering lines of two adjacent
1272 blocks are considered interesting, the rest is uninteresting.
1273 <code>dimmed_zebra</code> is a deprecated synonym.
1274 </p>
1275 </dd>
1276 </dl></div>
1277 </div></div>
1278 </dd>
1279 <dt class="hdlist1">
1280 --no-color-moved
1281 </dt>
1282 <dd>
1284 Turn off move detection. This can be used to override configuration
1285 settings. It is the same as <code>--color-moved=no</code>.
1286 </p>
1287 </dd>
1288 <dt class="hdlist1">
1289 --color-moved-ws=&lt;modes&gt;
1290 </dt>
1291 <dd>
1293 This configures how whitespace is ignored when performing the
1294 move detection for <code>--color-moved</code>.
1295 These modes can be given as a comma separated list:
1296 </p>
1297 <div class="openblock">
1298 <div class="content">
1299 <div class="dlist"><dl>
1300 <dt class="hdlist1">
1302 </dt>
1303 <dd>
1305 Do not ignore whitespace when performing move detection.
1306 </p>
1307 </dd>
1308 <dt class="hdlist1">
1309 ignore-space-at-eol
1310 </dt>
1311 <dd>
1313 Ignore changes in whitespace at EOL.
1314 </p>
1315 </dd>
1316 <dt class="hdlist1">
1317 ignore-space-change
1318 </dt>
1319 <dd>
1321 Ignore changes in amount of whitespace. This ignores whitespace
1322 at line end, and considers all other sequences of one or
1323 more whitespace characters to be equivalent.
1324 </p>
1325 </dd>
1326 <dt class="hdlist1">
1327 ignore-all-space
1328 </dt>
1329 <dd>
1331 Ignore whitespace when comparing lines. This ignores differences
1332 even if one line has whitespace where the other line has none.
1333 </p>
1334 </dd>
1335 <dt class="hdlist1">
1336 allow-indentation-change
1337 </dt>
1338 <dd>
1340 Initially ignore any whitespace in the move detection, then
1341 group the moved code blocks only into a block if the change in
1342 whitespace is the same per line. This is incompatible with the
1343 other modes.
1344 </p>
1345 </dd>
1346 </dl></div>
1347 </div></div>
1348 </dd>
1349 <dt class="hdlist1">
1350 --no-color-moved-ws
1351 </dt>
1352 <dd>
1354 Do not ignore whitespace when performing move detection. This can be
1355 used to override configuration settings. It is the same as
1356 <code>--color-moved-ws=no</code>.
1357 </p>
1358 </dd>
1359 <dt class="hdlist1">
1360 --word-diff[=&lt;mode&gt;]
1361 </dt>
1362 <dd>
1364 Show a word diff, using the &lt;mode&gt; to delimit changed words.
1365 By default, words are delimited by whitespace; see
1366 <code>--word-diff-regex</code> below. The &lt;mode&gt; defaults to <em>plain</em>, and
1367 must be one of:
1368 </p>
1369 <div class="openblock">
1370 <div class="content">
1371 <div class="dlist"><dl>
1372 <dt class="hdlist1">
1373 color
1374 </dt>
1375 <dd>
1377 Highlight changed words using only colors. Implies <code>--color</code>.
1378 </p>
1379 </dd>
1380 <dt class="hdlist1">
1381 plain
1382 </dt>
1383 <dd>
1385 Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no
1386 attempts to escape the delimiters if they appear in the input,
1387 so the output may be ambiguous.
1388 </p>
1389 </dd>
1390 <dt class="hdlist1">
1391 porcelain
1392 </dt>
1393 <dd>
1395 Use a special line-based format intended for script
1396 consumption. Added/removed/unchanged runs are printed in the
1397 usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
1398 character at the beginning of the line and extending to the
1399 end of the line. Newlines in the input are represented by a
1400 tilde <code>~</code> on a line of its own.
1401 </p>
1402 </dd>
1403 <dt class="hdlist1">
1404 none
1405 </dt>
1406 <dd>
1408 Disable word diff again.
1409 </p>
1410 </dd>
1411 </dl></div>
1412 </div></div>
1413 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
1414 highlight the changed parts in all modes if enabled.</p></div>
1415 </dd>
1416 <dt class="hdlist1">
1417 --word-diff-regex=&lt;regex&gt;
1418 </dt>
1419 <dd>
1421 Use &lt;regex&gt; to decide what a word is, instead of considering
1422 runs of non-whitespace to be a word. Also implies
1423 <code>--word-diff</code> unless it was already enabled.
1424 </p>
1425 <div class="paragraph"><p>Every non-overlapping match of the
1426 &lt;regex&gt; is considered a word. Anything between these matches is
1427 considered whitespace and ignored(!) for the purposes of finding
1428 differences. You may want to append <code>|[^[:space:]]</code> to your regular
1429 expression to make sure that it matches all non-whitespace characters.
1430 A match that contains a newline is silently truncated(!) at the
1431 newline.</p></div>
1432 <div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
1433 and, correspondingly, show differences character by character.</p></div>
1434 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
1435 <a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
1436 overrides any diff driver or configuration setting. Diff drivers
1437 override configuration settings.</p></div>
1438 </dd>
1439 <dt class="hdlist1">
1440 --color-words[=&lt;regex&gt;]
1441 </dt>
1442 <dd>
1444 Equivalent to <code>--word-diff=color</code> plus (if a regex was
1445 specified) <code>--word-diff-regex=&lt;regex&gt;</code>.
1446 </p>
1447 </dd>
1448 <dt class="hdlist1">
1449 --no-renames
1450 </dt>
1451 <dd>
1453 Turn off rename detection, even when the configuration
1454 file gives the default to do so.
1455 </p>
1456 </dd>
1457 <dt class="hdlist1">
1458 --[no-]rename-empty
1459 </dt>
1460 <dd>
1462 Whether to use empty blobs as rename source.
1463 </p>
1464 </dd>
1465 <dt class="hdlist1">
1466 --check
1467 </dt>
1468 <dd>
1470 Warn if changes introduce conflict markers or whitespace errors.
1471 What are considered whitespace errors is controlled by <code>core.whitespace</code>
1472 configuration. By default, trailing whitespaces (including
1473 lines that consist solely of whitespaces) and a space character
1474 that is immediately followed by a tab character inside the
1475 initial indent of the line are considered whitespace errors.
1476 Exits with non-zero status if problems are found. Not compatible
1477 with --exit-code.
1478 </p>
1479 </dd>
1480 <dt class="hdlist1">
1481 --ws-error-highlight=&lt;kind&gt;
1482 </dt>
1483 <dd>
1485 Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code>
1486 lines of the diff. Multiple values are separated by comma,
1487 <code>none</code> resets previous values, <code>default</code> reset the list to
1488 <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When
1489 this option is not given, and the configuration variable
1490 <code>diff.wsErrorHighlight</code> is not set, only whitespace errors in
1491 <code>new</code> lines are highlighted. The whitespace errors are colored
1492 with <code>color.diff.whitespace</code>.
1493 </p>
1494 </dd>
1495 <dt class="hdlist1">
1496 --full-index
1497 </dt>
1498 <dd>
1500 Instead of the first handful of characters, show the full
1501 pre- and post-image blob object names on the "index"
1502 line when generating patch format output.
1503 </p>
1504 </dd>
1505 <dt class="hdlist1">
1506 --binary
1507 </dt>
1508 <dd>
1510 In addition to <code>--full-index</code>, output a binary diff that
1511 can be applied with <code>git-apply</code>.
1512 Implies <code>--patch</code>.
1513 </p>
1514 </dd>
1515 <dt class="hdlist1">
1516 --abbrev[=&lt;n&gt;]
1517 </dt>
1518 <dd>
1520 Instead of showing the full 40-byte hexadecimal object
1521 name in diff-raw format output and diff-tree header
1522 lines, show the shortest prefix that is at least <em>&lt;n&gt;</em>
1523 hexdigits long that uniquely refers the object.
1524 In diff-patch output format, <code>--full-index</code> takes higher
1525 precedence, i.e. if <code>--full-index</code> is specified, full blob
1526 names will be shown regardless of <code>--abbrev</code>.
1527 Non default number of digits can be specified with <code>--abbrev=&lt;n&gt;</code>.
1528 </p>
1529 </dd>
1530 <dt class="hdlist1">
1531 -B[&lt;n&gt;][/&lt;m&gt;]
1532 </dt>
1533 <dt class="hdlist1">
1534 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1535 </dt>
1536 <dd>
1538 Break complete rewrite changes into pairs of delete and
1539 create. This serves two purposes:
1540 </p>
1541 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
1542 not as a series of deletion and insertion mixed together with a very
1543 few lines that happen to match textually as the context, but as a
1544 single deletion of everything old followed by a single insertion of
1545 everything new, and the number <code>m</code> controls this aspect of the -B
1546 option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the
1547 original should remain in the result for Git to consider it a total
1548 rewrite (i.e. otherwise the resulting patch will be a series of
1549 deletion and insertion mixed together with context lines).</p></div>
1550 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
1551 source of a rename (usually -M only considers a file that disappeared
1552 as the source of a rename), and the number <code>n</code> controls this aspect of
1553 the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with
1554 addition and deletion compared to 20% or more of the file&#8217;s size are
1555 eligible for being picked up as a possible source of a rename to
1556 another file.</p></div>
1557 </dd>
1558 <dt class="hdlist1">
1559 -M[&lt;n&gt;]
1560 </dt>
1561 <dt class="hdlist1">
1562 --find-renames[=&lt;n&gt;]
1563 </dt>
1564 <dd>
1566 Detect renames.
1567 If <code>n</code> is specified, it is a threshold on the similarity
1568 index (i.e. amount of addition/deletions compared to the
1569 file&#8217;s size). For example, <code>-M90%</code> means Git should consider a
1570 delete/add pair to be a rename if more than 90% of the file
1571 hasn&#8217;t changed. Without a <code>%</code> sign, the number is to be read as
1572 a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
1573 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is
1574 the same as <code>-M5%</code>. To limit detection to exact renames, use
1575 <code>-M100%</code>. The default similarity index is 50%.
1576 </p>
1577 </dd>
1578 <dt class="hdlist1">
1579 -C[&lt;n&gt;]
1580 </dt>
1581 <dt class="hdlist1">
1582 --find-copies[=&lt;n&gt;]
1583 </dt>
1584 <dd>
1586 Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1587 If <code>n</code> is specified, it has the same meaning as for <code>-M&lt;n&gt;</code>.
1588 </p>
1589 </dd>
1590 <dt class="hdlist1">
1591 --find-copies-harder
1592 </dt>
1593 <dd>
1595 For performance reasons, by default, <code>-C</code> option finds copies only
1596 if the original file of the copy was modified in the same
1597 changeset. This flag makes the command
1598 inspect unmodified files as candidates for the source of
1599 copy. This is a very expensive operation for large
1600 projects, so use it with caution. Giving more than one
1601 <code>-C</code> option has the same effect.
1602 </p>
1603 </dd>
1604 <dt class="hdlist1">
1606 </dt>
1607 <dt class="hdlist1">
1608 --irreversible-delete
1609 </dt>
1610 <dd>
1612 Omit the preimage for deletes, i.e. print only the header but not
1613 the diff between the preimage and <code>/dev/null</code>. The resulting patch
1614 is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is
1615 solely for people who want to just concentrate on reviewing the
1616 text after the change. In addition, the output obviously lacks
1617 enough information to apply such a patch in reverse, even manually,
1618 hence the name of the option.
1619 </p>
1620 <div class="paragraph"><p>When used together with <code>-B</code>, omit also the preimage in the deletion part
1621 of a delete/create pair.</p></div>
1622 </dd>
1623 <dt class="hdlist1">
1624 -l&lt;num&gt;
1625 </dt>
1626 <dd>
1628 The <code>-M</code> and <code>-C</code> options involve some preliminary steps that
1629 can detect subsets of renames/copies cheaply, followed by an
1630 exhaustive fallback portion that compares all remaining
1631 unpaired destinations to all relevant sources. (For renames,
1632 only remaining unpaired sources are relevant; for copies, all
1633 original sources are relevant.) For N sources and
1634 destinations, this exhaustive check is O(N^2). This option
1635 prevents the exhaustive portion of rename/copy detection from
1636 running if the number of source/destination files involved
1637 exceeds the specified number. Defaults to diff.renameLimit.
1638 Note that a value of 0 is treated as unlimited.
1639 </p>
1640 </dd>
1641 <dt class="hdlist1">
1642 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1643 </dt>
1644 <dd>
1646 Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1647 Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1648 type (i.e. regular file, symlink, submodule, &#8230;) changed (<code>T</code>),
1649 are Unmerged (<code>U</code>), are
1650 Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
1651 Any combination of the filter characters (including none) can be used.
1652 When <code>*</code> (All-or-none) is added to the combination, all
1653 paths are selected if there is any file that matches
1654 other criteria in the comparison; if there is no file
1655 that matches other criteria, nothing is selected.
1656 </p>
1657 <div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1658 <code>--diff-filter=ad</code> excludes added and deleted paths.</p></div>
1659 <div class="paragraph"><p>Note that not all diffs can feature all types. For instance, copied and
1660 renamed entries cannot appear if detection for those types is disabled.</p></div>
1661 </dd>
1662 <dt class="hdlist1">
1663 -S&lt;string&gt;
1664 </dt>
1665 <dd>
1667 Look for differences that change the number of occurrences of
1668 the specified string (i.e. addition/deletion) in a file.
1669 Intended for the scripter&#8217;s use.
1670 </p>
1671 <div class="paragraph"><p>It is useful when you&#8217;re looking for an exact block of code (like a
1672 struct), and want to know the history of that block since it first
1673 came into being: use the feature iteratively to feed the interesting
1674 block in the preimage back into <code>-S</code>, and keep going until you get the
1675 very first version of the block.</p></div>
1676 <div class="paragraph"><p>Binary files are searched as well.</p></div>
1677 </dd>
1678 <dt class="hdlist1">
1679 -G&lt;regex&gt;
1680 </dt>
1681 <dd>
1683 Look for differences whose patch text contains added/removed
1684 lines that match &lt;regex&gt;.
1685 </p>
1686 <div class="paragraph"><p>To illustrate the difference between <code>-S&lt;regex&gt; --pickaxe-regex</code> and
1687 <code>-G&lt;regex&gt;</code>, consider a commit with the following diff in the same
1688 file:</p></div>
1689 <div class="listingblock">
1690 <div class="content">
1691 <pre><code>+ return frotz(nitfol, two-&gt;ptr, 1, 0);
1693 - hit = frotz(nitfol, mf2.ptr, 1, 0);</code></pre>
1694 </div></div>
1695 <div class="paragraph"><p>While <code>git log -G"frotz\(nitfol"</code> will show this commit, <code>git log
1696 -S"frotz\(nitfol" --pickaxe-regex</code> will not (because the number of
1697 occurrences of that string did not change).</p></div>
1698 <div class="paragraph"><p>Unless <code>--text</code> is supplied patches of binary files without a textconv
1699 filter will be ignored.</p></div>
1700 <div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1701 information.</p></div>
1702 </dd>
1703 <dt class="hdlist1">
1704 --find-object=&lt;object-id&gt;
1705 </dt>
1706 <dd>
1708 Look for differences that change the number of occurrences of
1709 the specified object. Similar to <code>-S</code>, just the argument is different
1710 in that it doesn&#8217;t search for a specific string but for a specific
1711 object id.
1712 </p>
1713 <div class="paragraph"><p>The object can be a blob or a submodule commit. It implies the <code>-t</code> option in
1714 <code>git-log</code> to also find trees.</p></div>
1715 </dd>
1716 <dt class="hdlist1">
1717 --pickaxe-all
1718 </dt>
1719 <dd>
1721 When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
1722 changeset, not just the files that contain the change
1723 in &lt;string&gt;.
1724 </p>
1725 </dd>
1726 <dt class="hdlist1">
1727 --pickaxe-regex
1728 </dt>
1729 <dd>
1731 Treat the &lt;string&gt; given to <code>-S</code> as an extended POSIX regular
1732 expression to match.
1733 </p>
1734 </dd>
1735 <dt class="hdlist1">
1736 -O&lt;orderfile&gt;
1737 </dt>
1738 <dd>
1740 Control the order in which files appear in the output.
1741 This overrides the <code>diff.orderFile</code> configuration variable
1742 (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
1743 use <code>-O/dev/null</code>.
1744 </p>
1745 <div class="paragraph"><p>The output order is determined by the order of glob patterns in
1746 &lt;orderfile&gt;.
1747 All files with pathnames that match the first pattern are output
1748 first, all files with pathnames that match the second pattern (but not
1749 the first) are output next, and so on.
1750 All files with pathnames that do not match any pattern are output
1751 last, as if there was an implicit match-all pattern at the end of the
1752 file.
1753 If multiple pathnames have the same rank (they match the same pattern
1754 but no earlier patterns), their output order relative to each other is
1755 the normal order.</p></div>
1756 <div class="paragraph"><p>&lt;orderfile&gt; is parsed as follows:</p></div>
1757 <div class="openblock">
1758 <div class="content">
1759 <div class="ulist"><ul>
1760 <li>
1762 Blank lines are ignored, so they can be used as separators for
1763 readability.
1764 </p>
1765 </li>
1766 <li>
1768 Lines starting with a hash ("<code>#</code>") are ignored, so they can be used
1769 for comments. Add a backslash ("<code>\</code>") to the beginning of the
1770 pattern if it starts with a hash.
1771 </p>
1772 </li>
1773 <li>
1775 Each other line contains a single pattern.
1776 </p>
1777 </li>
1778 </ul></div>
1779 </div></div>
1780 <div class="paragraph"><p>Patterns have the same syntax and semantics as patterns used for
1781 fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
1782 matches a pattern if removing any number of the final pathname
1783 components matches the pattern. For example, the pattern "<code>foo*bar</code>"
1784 matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p></div>
1785 </dd>
1786 <dt class="hdlist1">
1787 --skip-to=&lt;file&gt;
1788 </dt>
1789 <dt class="hdlist1">
1790 --rotate-to=&lt;file&gt;
1791 </dt>
1792 <dd>
1794 Discard the files before the named &lt;file&gt; from the output
1795 (i.e. <em>skip to</em>), or move them to the end of the output
1796 (i.e. <em>rotate to</em>). These were invented primarily for use
1797 of the <code>git difftool</code> command, and may not be very useful
1798 otherwise.
1799 </p>
1800 </dd>
1801 <dt class="hdlist1">
1803 </dt>
1804 <dd>
1806 Swap two inputs; that is, show differences from index or
1807 on-disk file to tree contents.
1808 </p>
1809 </dd>
1810 <dt class="hdlist1">
1811 --relative[=&lt;path&gt;]
1812 </dt>
1813 <dt class="hdlist1">
1814 --no-relative
1815 </dt>
1816 <dd>
1818 When run from a subdirectory of the project, it can be
1819 told to exclude changes outside the directory and show
1820 pathnames relative to it with this option. When you are
1821 not in a subdirectory (e.g. in a bare repository), you
1822 can name which subdirectory to make the output relative
1823 to by giving a &lt;path&gt; as an argument.
1824 <code>--no-relative</code> can be used to countermand both <code>diff.relative</code> config
1825 option and previous <code>--relative</code>.
1826 </p>
1827 </dd>
1828 <dt class="hdlist1">
1830 </dt>
1831 <dt class="hdlist1">
1832 --text
1833 </dt>
1834 <dd>
1836 Treat all files as text.
1837 </p>
1838 </dd>
1839 <dt class="hdlist1">
1840 --ignore-cr-at-eol
1841 </dt>
1842 <dd>
1844 Ignore carriage-return at the end of line when doing a comparison.
1845 </p>
1846 </dd>
1847 <dt class="hdlist1">
1848 --ignore-space-at-eol
1849 </dt>
1850 <dd>
1852 Ignore changes in whitespace at EOL.
1853 </p>
1854 </dd>
1855 <dt class="hdlist1">
1857 </dt>
1858 <dt class="hdlist1">
1859 --ignore-space-change
1860 </dt>
1861 <dd>
1863 Ignore changes in amount of whitespace. This ignores whitespace
1864 at line end, and considers all other sequences of one or
1865 more whitespace characters to be equivalent.
1866 </p>
1867 </dd>
1868 <dt class="hdlist1">
1870 </dt>
1871 <dt class="hdlist1">
1872 --ignore-all-space
1873 </dt>
1874 <dd>
1876 Ignore whitespace when comparing lines. This ignores
1877 differences even if one line has whitespace where the other
1878 line has none.
1879 </p>
1880 </dd>
1881 <dt class="hdlist1">
1882 --ignore-blank-lines
1883 </dt>
1884 <dd>
1886 Ignore changes whose lines are all blank.
1887 </p>
1888 </dd>
1889 <dt class="hdlist1">
1890 -I&lt;regex&gt;
1891 </dt>
1892 <dt class="hdlist1">
1893 --ignore-matching-lines=&lt;regex&gt;
1894 </dt>
1895 <dd>
1897 Ignore changes whose all lines match &lt;regex&gt;. This option may
1898 be specified more than once.
1899 </p>
1900 </dd>
1901 <dt class="hdlist1">
1902 --inter-hunk-context=&lt;lines&gt;
1903 </dt>
1904 <dd>
1906 Show the context between diff hunks, up to the specified number
1907 of lines, thereby fusing hunks that are close to each other.
1908 Defaults to <code>diff.interHunkContext</code> or 0 if the config option
1909 is unset.
1910 </p>
1911 </dd>
1912 <dt class="hdlist1">
1914 </dt>
1915 <dt class="hdlist1">
1916 --function-context
1917 </dt>
1918 <dd>
1920 Show whole function as context lines for each change.
1921 The function names are determined in the same way as
1922 <code>git diff</code> works out patch hunk headers (see <em>Defining a
1923 custom hunk-header</em> in <a href="gitattributes.html">gitattributes(5)</a>).
1924 </p>
1925 </dd>
1926 <dt class="hdlist1">
1927 --exit-code
1928 </dt>
1929 <dd>
1931 Make the program exit with codes similar to diff(1).
1932 That is, it exits with 1 if there were differences and
1933 0 means no differences.
1934 </p>
1935 </dd>
1936 <dt class="hdlist1">
1937 --quiet
1938 </dt>
1939 <dd>
1941 Disable all output of the program. Implies <code>--exit-code</code>.
1942 </p>
1943 </dd>
1944 <dt class="hdlist1">
1945 --ext-diff
1946 </dt>
1947 <dd>
1949 Allow an external diff helper to be executed. If you set an
1950 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1951 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
1952 </p>
1953 </dd>
1954 <dt class="hdlist1">
1955 --no-ext-diff
1956 </dt>
1957 <dd>
1959 Disallow external diff drivers.
1960 </p>
1961 </dd>
1962 <dt class="hdlist1">
1963 --textconv
1964 </dt>
1965 <dt class="hdlist1">
1966 --no-textconv
1967 </dt>
1968 <dd>
1970 Allow (or disallow) external text conversion filters to be run
1971 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
1972 details. Because textconv filters are typically a one-way
1973 conversion, the resulting diff is suitable for human
1974 consumption, but cannot be applied. For this reason, textconv
1975 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1976 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
1977 diff plumbing commands.
1978 </p>
1979 </dd>
1980 <dt class="hdlist1">
1981 --ignore-submodules[=&lt;when&gt;]
1982 </dt>
1983 <dd>
1985 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
1986 either "none", "untracked", "dirty" or "all", which is the default.
1987 Using "none" will consider the submodule modified when it either contains
1988 untracked or modified files or its HEAD differs from the commit recorded
1989 in the superproject and can be used to override any settings of the
1990 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
1991 "untracked" is used submodules are not considered dirty when they only
1992 contain untracked content (but they are still scanned for modified
1993 content). Using "dirty" ignores all changes to the work tree of submodules,
1994 only changes to the commits stored in the superproject are shown (this was
1995 the behavior until 1.7.0). Using "all" hides all changes to submodules.
1996 </p>
1997 </dd>
1998 <dt class="hdlist1">
1999 --src-prefix=&lt;prefix&gt;
2000 </dt>
2001 <dd>
2003 Show the given source prefix instead of "a/".
2004 </p>
2005 </dd>
2006 <dt class="hdlist1">
2007 --dst-prefix=&lt;prefix&gt;
2008 </dt>
2009 <dd>
2011 Show the given destination prefix instead of "b/".
2012 </p>
2013 </dd>
2014 <dt class="hdlist1">
2015 --no-prefix
2016 </dt>
2017 <dd>
2019 Do not show any source or destination prefix.
2020 </p>
2021 </dd>
2022 <dt class="hdlist1">
2023 --default-prefix
2024 </dt>
2025 <dd>
2027 Use the default source and destination prefixes ("a/" and "b/").
2028 This is usually the default already, but may be used to override
2029 config such as <code>diff.noprefix</code>.
2030 </p>
2031 </dd>
2032 <dt class="hdlist1">
2033 --line-prefix=&lt;prefix&gt;
2034 </dt>
2035 <dd>
2037 Prepend an additional prefix to every line of output.
2038 </p>
2039 </dd>
2040 <dt class="hdlist1">
2041 --ita-invisible-in-index
2042 </dt>
2043 <dd>
2045 By default entries added by "git add -N" appear as an existing
2046 empty file in "git diff" and a new file in "git diff --cached".
2047 This option makes the entry appear as a new file in "git diff"
2048 and non-existent in "git diff --cached". This option could be
2049 reverted with <code>--ita-visible-in-index</code>. Both options are
2050 experimental and could be removed in future.
2051 </p>
2052 </dd>
2053 </dl></div>
2054 <div class="paragraph"><p>For more detailed explanation on these common options, see also
2055 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
2056 <div class="dlist"><dl>
2057 <dt class="hdlist1">
2058 &lt;tree-ish&gt;
2059 </dt>
2060 <dd>
2062 The id of a tree object.
2063 </p>
2064 </dd>
2065 <dt class="hdlist1">
2066 &lt;path&gt;&#8230;
2067 </dt>
2068 <dd>
2070 If provided, the results are limited to a subset of files
2071 matching one of the provided pathspecs.
2072 </p>
2073 </dd>
2074 <dt class="hdlist1">
2076 </dt>
2077 <dd>
2079 recurse into sub-trees
2080 </p>
2081 </dd>
2082 <dt class="hdlist1">
2084 </dt>
2085 <dd>
2087 show tree entry itself as well as subtrees. Implies -r.
2088 </p>
2089 </dd>
2090 <dt class="hdlist1">
2091 --root
2092 </dt>
2093 <dd>
2095 When <code>--root</code> is specified the initial commit will be shown as a big
2096 creation event. This is equivalent to a diff against the NULL tree.
2097 </p>
2098 </dd>
2099 <dt class="hdlist1">
2100 --merge-base
2101 </dt>
2102 <dd>
2104 Instead of comparing the &lt;tree-ish&gt;s directly, use the merge
2105 base between the two &lt;tree-ish&gt;s as the "before" side. There
2106 must be two &lt;tree-ish&gt;s given and they must both be commits.
2107 </p>
2108 </dd>
2109 <dt class="hdlist1">
2110 --stdin
2111 </dt>
2112 <dd>
2114 When <code>--stdin</code> is specified, the command does not take
2115 &lt;tree-ish&gt; arguments from the command line. Instead, it
2116 reads lines containing either two &lt;tree&gt;, one &lt;commit&gt;, or a
2117 list of &lt;commit&gt; from its standard input. (Use a single space
2118 as separator.)
2119 </p>
2120 <div class="paragraph"><p>When two trees are given, it compares the first tree with the second.
2121 When a single commit is given, it compares the commit with its
2122 parents. The remaining commits, when given, are used as if they are
2123 parents of the first commit.</p></div>
2124 <div class="paragraph"><p>When comparing two trees, the ID of both trees (separated by a space
2125 and terminated by a newline) is printed before the difference. When
2126 comparing commits, the ID of the first (or only) commit, followed by a
2127 newline, is printed.</p></div>
2128 <div class="paragraph"><p>The following flags further affect the behavior when comparing
2129 commits (but not trees).</p></div>
2130 </dd>
2131 <dt class="hdlist1">
2133 </dt>
2134 <dd>
2136 By default, <em>git diff-tree --stdin</em> does not show
2137 differences for merge commits. With this flag, it shows
2138 differences to that commit from all of its parents. See
2139 also <code>-c</code>.
2140 </p>
2141 </dd>
2142 <dt class="hdlist1">
2144 </dt>
2145 <dd>
2147 By default, <em>git diff-tree --stdin</em> shows differences,
2148 either in machine-readable form (without <code>-p</code>) or in patch
2149 form (with <code>-p</code>). This output can be suppressed. It is
2150 only useful with <code>-v</code> flag.
2151 </p>
2152 </dd>
2153 <dt class="hdlist1">
2155 </dt>
2156 <dd>
2158 This flag causes <em>git diff-tree --stdin</em> to also show
2159 the commit message before the differences.
2160 </p>
2161 </dd>
2162 <dt class="hdlist1">
2163 --pretty[=&lt;format&gt;]
2164 </dt>
2165 <dt class="hdlist1">
2166 --format=&lt;format&gt;
2167 </dt>
2168 <dd>
2170 Pretty-print the contents of the commit logs in a given format,
2171 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
2172 <em>full</em>, <em>fuller</em>, <em>reference</em>, <em>email</em>, <em>raw</em>, <em>format:&lt;string&gt;</em>
2173 and <em>tformat:&lt;string&gt;</em>. When <em>&lt;format&gt;</em> is none of the above,
2174 and has <em>%placeholder</em> in it, it acts as if
2175 <em>--pretty=tformat:&lt;format&gt;</em> were given.
2176 </p>
2177 <div class="paragraph"><p>See the "PRETTY FORMATS" section for some additional details for each
2178 format. When <em>=&lt;format&gt;</em> part is omitted, it defaults to <em>medium</em>.</p></div>
2179 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
2180 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
2181 </dd>
2182 <dt class="hdlist1">
2183 --abbrev-commit
2184 </dt>
2185 <dd>
2187 Instead of showing the full 40-byte hexadecimal commit object
2188 name, show a prefix that names the object uniquely.
2189 "--abbrev=&lt;n&gt;" (which also modifies diff output, if it is displayed)
2190 option can be used to specify the minimum length of the prefix.
2191 </p>
2192 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
2193 people using 80-column terminals.</p></div>
2194 </dd>
2195 <dt class="hdlist1">
2196 --no-abbrev-commit
2197 </dt>
2198 <dd>
2200 Show the full 40-byte hexadecimal commit object name. This negates
2201 <code>--abbrev-commit</code>, either explicit or implied by other options such
2202 as "--oneline". It also overrides the <code>log.abbrevCommit</code> variable.
2203 </p>
2204 </dd>
2205 <dt class="hdlist1">
2206 --oneline
2207 </dt>
2208 <dd>
2210 This is a shorthand for "--pretty=oneline --abbrev-commit"
2211 used together.
2212 </p>
2213 </dd>
2214 <dt class="hdlist1">
2215 --encoding=&lt;encoding&gt;
2216 </dt>
2217 <dd>
2219 Commit objects record the character encoding used for the log message
2220 in their encoding header; this option can be used to tell the
2221 command to re-code the commit log message in the encoding
2222 preferred by the user. For non plumbing commands this
2223 defaults to UTF-8. Note that if an object claims to be encoded
2224 in <code>X</code> and we are outputting in <code>X</code>, we will output the object
2225 verbatim; this means that invalid sequences in the original
2226 commit may be copied to the output. Likewise, if iconv(3) fails
2227 to convert the commit, we will quietly output the original
2228 object verbatim.
2229 </p>
2230 </dd>
2231 <dt class="hdlist1">
2232 --expand-tabs=&lt;n&gt;
2233 </dt>
2234 <dt class="hdlist1">
2235 --expand-tabs
2236 </dt>
2237 <dt class="hdlist1">
2238 --no-expand-tabs
2239 </dt>
2240 <dd>
2242 Perform a tab expansion (replace each tab with enough spaces
2243 to fill to the next display column that is multiple of <em>&lt;n&gt;</em>)
2244 in the log message before showing it in the output.
2245 <code>--expand-tabs</code> is a short-hand for <code>--expand-tabs=8</code>, and
2246 <code>--no-expand-tabs</code> is a short-hand for <code>--expand-tabs=0</code>,
2247 which disables tab expansion.
2248 </p>
2249 <div class="paragraph"><p>By default, tabs are expanded in pretty formats that indent the log
2250 message by 4 spaces (i.e. <em>medium</em>, which is the default, <em>full</em>,
2251 and <em>fuller</em>).</p></div>
2252 </dd>
2253 <dt class="hdlist1">
2254 --notes[=&lt;ref&gt;]
2255 </dt>
2256 <dd>
2258 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
2259 commit, when showing the commit log message. This is the default
2260 for <code>git log</code>, <code>git show</code> and <code>git whatchanged</code> commands when
2261 there is no <code>--pretty</code>, <code>--format</code>, or <code>--oneline</code> option given
2262 on the command line.
2263 </p>
2264 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
2265 <code>core.notesRef</code> and <code>notes.displayRef</code> variables (or corresponding
2266 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
2267 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, use the ref to find the notes
2268 to display. The ref can specify the full refname when it begins
2269 with <code>refs/notes/</code>; when it begins with <code>notes/</code>, <code>refs/</code> and otherwise
2270 <code>refs/notes/</code> is prefixed to form a full name of the ref.</p></div>
2271 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
2272 being displayed. Examples: "--notes=foo" will show only notes from
2273 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
2274 "refs/notes/foo" and from the default notes ref(s).</p></div>
2275 </dd>
2276 <dt class="hdlist1">
2277 --no-notes
2278 </dt>
2279 <dd>
2281 Do not show notes. This negates the above <code>--notes</code> option, by
2282 resetting the list of notes refs from which notes are shown.
2283 Options are parsed in the order given on the command line, so e.g.
2284 "--notes --notes=foo --no-notes --notes=bar" will only show notes
2285 from "refs/notes/bar".
2286 </p>
2287 </dd>
2288 <dt class="hdlist1">
2289 --show-notes[=&lt;ref&gt;]
2290 </dt>
2291 <dt class="hdlist1">
2292 --[no-]standard-notes
2293 </dt>
2294 <dd>
2296 These options are deprecated. Use the above --notes/--no-notes
2297 options instead.
2298 </p>
2299 </dd>
2300 <dt class="hdlist1">
2301 --show-signature
2302 </dt>
2303 <dd>
2305 Check the validity of a signed commit object by passing the signature
2306 to <code>gpg --verify</code> and show the output.
2307 </p>
2308 </dd>
2309 <dt class="hdlist1">
2310 --no-commit-id
2311 </dt>
2312 <dd>
2314 <em>git diff-tree</em> outputs a line with the commit ID when
2315 applicable. This flag suppressed the commit ID output.
2316 </p>
2317 </dd>
2318 <dt class="hdlist1">
2320 </dt>
2321 <dd>
2323 This flag changes the way a merge commit is displayed
2324 (which means it is useful only when the command is given
2325 one &lt;tree-ish&gt;, or <code>--stdin</code>). It shows the differences
2326 from each of the parents to the merge result simultaneously
2327 instead of showing pairwise diff between a parent and the
2328 result one at a time (which is what the <code>-m</code> option does).
2329 Furthermore, it lists only files which were modified
2330 from all parents.
2331 </p>
2332 </dd>
2333 <dt class="hdlist1">
2334 --cc
2335 </dt>
2336 <dd>
2338 This flag changes the way a merge commit patch is displayed,
2339 in a similar way to the <code>-c</code> option. It implies the <code>-c</code>
2340 and <code>-p</code> options and further compresses the patch output
2341 by omitting uninteresting hunks whose the contents in the parents
2342 have only two variants and the merge result picks one of them
2343 without modification. When all hunks are uninteresting, the commit
2344 itself and the commit log message is not shown, just like in any other
2345 "empty diff" case.
2346 </p>
2347 </dd>
2348 <dt class="hdlist1">
2349 --combined-all-paths
2350 </dt>
2351 <dd>
2353 This flag causes combined diffs (used for merge commits) to
2354 list the name of the file from all parents. It thus only has
2355 effect when -c or --cc are specified, and is likely only
2356 useful if filename changes are detected (i.e. when either
2357 rename or copy detection have been requested).
2358 </p>
2359 </dd>
2360 <dt class="hdlist1">
2361 --always
2362 </dt>
2363 <dd>
2365 Show the commit itself and the commit log message even
2366 if the diff itself is empty.
2367 </p>
2368 </dd>
2369 </dl></div>
2370 </div>
2371 </div>
2372 <div class="sect1">
2373 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
2374 <div class="sectionbody">
2375 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
2376 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
2377 inserted before the <em>Author:</em> line. This line begins with
2378 "Merge: " and the hashes of ancestral commits are printed,
2379 separated by spaces. Note that the listed commits may not
2380 necessarily be the list of the <strong>direct</strong> parent commits if you
2381 have limited your view of history: for example, if you are
2382 only interested in changes related to a certain directory or
2383 file.</p></div>
2384 <div class="paragraph"><p>There are several built-in formats, and you can define
2385 additional formats by setting a pretty.&lt;name&gt;
2386 config option to either another format name, or a
2387 <em>format:</em> string, as described below (see
2388 <a href="git-config.html">git-config(1)</a>). Here are the details of the
2389 built-in formats:</p></div>
2390 <div class="ulist"><ul>
2391 <li>
2393 <em>oneline</em>
2394 </p>
2395 <div class="literalblock">
2396 <div class="content">
2397 <pre><code>&lt;hash&gt; &lt;title-line&gt;</code></pre>
2398 </div></div>
2399 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
2400 </li>
2401 <li>
2403 <em>short</em>
2404 </p>
2405 <div class="literalblock">
2406 <div class="content">
2407 <pre><code>commit &lt;hash&gt;
2408 Author: &lt;author&gt;</code></pre>
2409 </div></div>
2410 <div class="literalblock">
2411 <div class="content">
2412 <pre><code>&lt;title-line&gt;</code></pre>
2413 </div></div>
2414 </li>
2415 <li>
2417 <em>medium</em>
2418 </p>
2419 <div class="literalblock">
2420 <div class="content">
2421 <pre><code>commit &lt;hash&gt;
2422 Author: &lt;author&gt;
2423 Date: &lt;author-date&gt;</code></pre>
2424 </div></div>
2425 <div class="literalblock">
2426 <div class="content">
2427 <pre><code>&lt;title-line&gt;</code></pre>
2428 </div></div>
2429 <div class="literalblock">
2430 <div class="content">
2431 <pre><code>&lt;full-commit-message&gt;</code></pre>
2432 </div></div>
2433 </li>
2434 <li>
2436 <em>full</em>
2437 </p>
2438 <div class="literalblock">
2439 <div class="content">
2440 <pre><code>commit &lt;hash&gt;
2441 Author: &lt;author&gt;
2442 Commit: &lt;committer&gt;</code></pre>
2443 </div></div>
2444 <div class="literalblock">
2445 <div class="content">
2446 <pre><code>&lt;title-line&gt;</code></pre>
2447 </div></div>
2448 <div class="literalblock">
2449 <div class="content">
2450 <pre><code>&lt;full-commit-message&gt;</code></pre>
2451 </div></div>
2452 </li>
2453 <li>
2455 <em>fuller</em>
2456 </p>
2457 <div class="literalblock">
2458 <div class="content">
2459 <pre><code>commit &lt;hash&gt;
2460 Author: &lt;author&gt;
2461 AuthorDate: &lt;author-date&gt;
2462 Commit: &lt;committer&gt;
2463 CommitDate: &lt;committer-date&gt;</code></pre>
2464 </div></div>
2465 <div class="literalblock">
2466 <div class="content">
2467 <pre><code>&lt;title-line&gt;</code></pre>
2468 </div></div>
2469 <div class="literalblock">
2470 <div class="content">
2471 <pre><code>&lt;full-commit-message&gt;</code></pre>
2472 </div></div>
2473 </li>
2474 <li>
2476 <em>reference</em>
2477 </p>
2478 <div class="literalblock">
2479 <div class="content">
2480 <pre><code>&lt;abbrev-hash&gt; (&lt;title-line&gt;, &lt;short-author-date&gt;)</code></pre>
2481 </div></div>
2482 <div class="paragraph"><p>This format is used to refer to another commit in a commit message and
2483 is the same as <code>--pretty='format:%C(auto)%h (%s, %ad)'</code>. By default,
2484 the date is formatted with <code>--date=short</code> unless another <code>--date</code> option
2485 is explicitly specified. As with any <code>format:</code> with format
2486 placeholders, its output is not affected by other options like
2487 <code>--decorate</code> and <code>--walk-reflogs</code>.</p></div>
2488 </li>
2489 <li>
2491 <em>email</em>
2492 </p>
2493 <div class="literalblock">
2494 <div class="content">
2495 <pre><code>From &lt;hash&gt; &lt;date&gt;
2496 From: &lt;author&gt;
2497 Date: &lt;author-date&gt;
2498 Subject: [PATCH] &lt;title-line&gt;</code></pre>
2499 </div></div>
2500 <div class="literalblock">
2501 <div class="content">
2502 <pre><code>&lt;full-commit-message&gt;</code></pre>
2503 </div></div>
2504 </li>
2505 <li>
2507 <em>mboxrd</em>
2508 </p>
2509 <div class="paragraph"><p>Like <em>email</em>, but lines in the commit message starting with "From "
2510 (preceded by zero or more "&gt;") are quoted with "&gt;" so they aren&#8217;t
2511 confused as starting a new commit.</p></div>
2512 </li>
2513 <li>
2515 <em>raw</em>
2516 </p>
2517 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
2518 stored in the commit object. Notably, the hashes are
2519 displayed in full, regardless of whether --abbrev or
2520 --no-abbrev are used, and <em>parents</em> information show the
2521 true parent commits, without taking grafts or history
2522 simplification into account. Note that this format affects the way
2523 commits are displayed, but not the way the diff is shown e.g. with
2524 <code>git log --raw</code>. To get full object names in a raw diff format,
2525 use <code>--no-abbrev</code>.</p></div>
2526 </li>
2527 <li>
2529 <em>format:&lt;format-string&gt;</em>
2530 </p>
2531 <div class="paragraph"><p>The <em>format:&lt;format-string&gt;</em> format allows you to specify which information
2532 you want to show. It works a little bit like printf format,
2533 with the notable exception that you get a newline with <em>%n</em>
2534 instead of <em>\n</em>.</p></div>
2535 <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>
2536 would show something like this:</p></div>
2537 <div class="listingblock">
2538 <div class="content">
2539 <pre><code>The author of fe6e0ee was Junio C Hamano, 23 hours ago
2540 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</code></pre>
2541 </div></div>
2542 <div class="paragraph"><p>The placeholders are:</p></div>
2543 <div class="ulist"><ul>
2544 <li>
2546 Placeholders that expand to a single literal character:
2547 </p>
2548 <div class="dlist"><dl>
2549 <dt class="hdlist1">
2550 <em>%n</em>
2551 </dt>
2552 <dd>
2554 newline
2555 </p>
2556 </dd>
2557 <dt class="hdlist1">
2558 <em>%%</em>
2559 </dt>
2560 <dd>
2562 a raw <em>%</em>
2563 </p>
2564 </dd>
2565 <dt class="hdlist1">
2566 <em>%x00</em>
2567 </dt>
2568 <dd>
2570 <em>%x</em> followed by two hexadecimal digits is replaced with a
2571 byte with the hexadecimal digits' value (we will call this
2572 "literal formatting code" in the rest of this document).
2573 </p>
2574 </dd>
2575 </dl></div>
2576 </li>
2577 <li>
2579 Placeholders that affect formatting of later placeholders:
2580 </p>
2581 <div class="dlist"><dl>
2582 <dt class="hdlist1">
2583 <em>%Cred</em>
2584 </dt>
2585 <dd>
2587 switch color to red
2588 </p>
2589 </dd>
2590 <dt class="hdlist1">
2591 <em>%Cgreen</em>
2592 </dt>
2593 <dd>
2595 switch color to green
2596 </p>
2597 </dd>
2598 <dt class="hdlist1">
2599 <em>%Cblue</em>
2600 </dt>
2601 <dd>
2603 switch color to blue
2604 </p>
2605 </dd>
2606 <dt class="hdlist1">
2607 <em>%Creset</em>
2608 </dt>
2609 <dd>
2611 reset color
2612 </p>
2613 </dd>
2614 <dt class="hdlist1">
2615 <em>%C(&#8230;)</em>
2616 </dt>
2617 <dd>
2619 color specification, as described under Values in the
2620 "CONFIGURATION FILE" section of <a href="git-config.html">git-config(1)</a>. By
2621 default, colors are shown only when enabled for log output
2622 (by <code>color.diff</code>, <code>color.ui</code>, or <code>--color</code>, and respecting
2623 the <code>auto</code> settings of the former if we are going to a
2624 terminal). <code>%C(auto,...)</code> is accepted as a historical
2625 synonym for the default (e.g., <code>%C(auto,red)</code>). Specifying
2626 <code>%C(always,...)</code> will show the colors even when color is
2627 not otherwise enabled (though consider just using
2628 <code>--color=always</code> to enable color for the whole output,
2629 including this format and anything else git might color).
2630 <code>auto</code> alone (i.e. <code>%C(auto)</code>) will turn on auto coloring
2631 on the next placeholders until the color is switched
2632 again.
2633 </p>
2634 </dd>
2635 <dt class="hdlist1">
2636 <em>%m</em>
2637 </dt>
2638 <dd>
2640 left (<code>&lt;</code>), right (<code>&gt;</code>) or boundary (<code>-</code>) mark
2641 </p>
2642 </dd>
2643 <dt class="hdlist1">
2644 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>
2645 </dt>
2646 <dd>
2648 switch line wrapping, like the -w option of
2649 <a href="git-shortlog.html">git-shortlog(1)</a>.
2650 </p>
2651 </dd>
2652 <dt class="hdlist1">
2653 <em>%&lt;( &lt;N&gt; [,trunc|ltrunc|mtrunc])</em>
2654 </dt>
2655 <dd>
2657 make the next placeholder take at
2658 least N column widths, padding spaces on
2659 the right if necessary. Optionally
2660 truncate (with ellipsis <em>..</em>) at the left (ltrunc) <code>..ft</code>,
2661 the middle (mtrunc) <code>mi..le</code>, or the end
2662 (trunc) <code>rig..</code>, if the output is longer than
2663 N columns.
2664 Note 1: that truncating
2665 only works correctly with N &gt;= 2.
2666 Note 2: spaces around the N and M (see below)
2667 values are optional.
2668 Note 3: Emojis and other wide characters
2669 will take two display columns, which may
2670 over-run column boundaries.
2671 Note 4: decomposed character combining marks
2672 may be misplaced at padding boundaries.
2673 </p>
2674 </dd>
2675 <dt class="hdlist1">
2676 <em>%&lt;|( &lt;M&gt; )</em>
2677 </dt>
2678 <dd>
2680 make the next placeholder take at least until Mth
2681 display column, padding spaces on the right if necessary.
2682 Use negative M values for column positions measured
2683 from the right hand edge of the terminal window.
2684 </p>
2685 </dd>
2686 <dt class="hdlist1">
2687 <em>%&gt;( &lt;N&gt; )</em>, <em>%&gt;|( &lt;M&gt; )</em>
2688 </dt>
2689 <dd>
2691 similar to <em>%&lt;( &lt;N&gt; )</em>, <em>%&lt;|( &lt;M&gt; )</em> respectively,
2692 but padding spaces on the left
2693 </p>
2694 </dd>
2695 <dt class="hdlist1">
2696 <em>%&gt;&gt;( &lt;N&gt; )</em>, <em>%&gt;&gt;|( &lt;M&gt; )</em>
2697 </dt>
2698 <dd>
2700 similar to <em>%&gt;( &lt;N&gt; )</em>, <em>%&gt;|( &lt;M&gt; )</em>
2701 respectively, except that if the next
2702 placeholder takes more spaces than given and
2703 there are spaces on its left, use those
2704 spaces
2705 </p>
2706 </dd>
2707 <dt class="hdlist1">
2708 <em>%&gt;&lt;( &lt;N&gt; )</em>, <em>%&gt;&lt;|( &lt;M&gt; )</em>
2709 </dt>
2710 <dd>
2712 similar to <em>%&lt;( &lt;N&gt; )</em>, <em>%&lt;|( &lt;M&gt; )</em>
2713 respectively, but padding both sides
2714 (i.e. the text is centered)
2715 </p>
2716 </dd>
2717 </dl></div>
2718 </li>
2719 <li>
2721 Placeholders that expand to information extracted from the commit:
2722 </p>
2723 <div class="dlist"><dl>
2724 <dt class="hdlist1">
2725 <em>%H</em>
2726 </dt>
2727 <dd>
2729 commit hash
2730 </p>
2731 </dd>
2732 <dt class="hdlist1">
2733 <em>%h</em>
2734 </dt>
2735 <dd>
2737 abbreviated commit hash
2738 </p>
2739 </dd>
2740 <dt class="hdlist1">
2741 <em>%T</em>
2742 </dt>
2743 <dd>
2745 tree hash
2746 </p>
2747 </dd>
2748 <dt class="hdlist1">
2749 <em>%t</em>
2750 </dt>
2751 <dd>
2753 abbreviated tree hash
2754 </p>
2755 </dd>
2756 <dt class="hdlist1">
2757 <em>%P</em>
2758 </dt>
2759 <dd>
2761 parent hashes
2762 </p>
2763 </dd>
2764 <dt class="hdlist1">
2765 <em>%p</em>
2766 </dt>
2767 <dd>
2769 abbreviated parent hashes
2770 </p>
2771 </dd>
2772 <dt class="hdlist1">
2773 <em>%an</em>
2774 </dt>
2775 <dd>
2777 author name
2778 </p>
2779 </dd>
2780 <dt class="hdlist1">
2781 <em>%aN</em>
2782 </dt>
2783 <dd>
2785 author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a>
2786 or <a href="git-blame.html">git-blame(1)</a>)
2787 </p>
2788 </dd>
2789 <dt class="hdlist1">
2790 <em>%ae</em>
2791 </dt>
2792 <dd>
2794 author email
2795 </p>
2796 </dd>
2797 <dt class="hdlist1">
2798 <em>%aE</em>
2799 </dt>
2800 <dd>
2802 author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a>
2803 or <a href="git-blame.html">git-blame(1)</a>)
2804 </p>
2805 </dd>
2806 <dt class="hdlist1">
2807 <em>%al</em>
2808 </dt>
2809 <dd>
2811 author email local-part (the part before the <em>@</em> sign)
2812 </p>
2813 </dd>
2814 <dt class="hdlist1">
2815 <em>%aL</em>
2816 </dt>
2817 <dd>
2819 author local-part (see <em>%al</em>) respecting .mailmap, see
2820 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2821 </p>
2822 </dd>
2823 <dt class="hdlist1">
2824 <em>%ad</em>
2825 </dt>
2826 <dd>
2828 author date (format respects --date= option)
2829 </p>
2830 </dd>
2831 <dt class="hdlist1">
2832 <em>%aD</em>
2833 </dt>
2834 <dd>
2836 author date, RFC2822 style
2837 </p>
2838 </dd>
2839 <dt class="hdlist1">
2840 <em>%ar</em>
2841 </dt>
2842 <dd>
2844 author date, relative
2845 </p>
2846 </dd>
2847 <dt class="hdlist1">
2848 <em>%at</em>
2849 </dt>
2850 <dd>
2852 author date, UNIX timestamp
2853 </p>
2854 </dd>
2855 <dt class="hdlist1">
2856 <em>%ai</em>
2857 </dt>
2858 <dd>
2860 author date, ISO 8601-like format
2861 </p>
2862 </dd>
2863 <dt class="hdlist1">
2864 <em>%aI</em>
2865 </dt>
2866 <dd>
2868 author date, strict ISO 8601 format
2869 </p>
2870 </dd>
2871 <dt class="hdlist1">
2872 <em>%as</em>
2873 </dt>
2874 <dd>
2876 author date, short format (<code>YYYY-MM-DD</code>)
2877 </p>
2878 </dd>
2879 <dt class="hdlist1">
2880 <em>%ah</em>
2881 </dt>
2882 <dd>
2884 author date, human style (like the <code>--date=human</code> option of
2885 <a href="git-rev-list.html">git-rev-list(1)</a>)
2886 </p>
2887 </dd>
2888 <dt class="hdlist1">
2889 <em>%cn</em>
2890 </dt>
2891 <dd>
2893 committer name
2894 </p>
2895 </dd>
2896 <dt class="hdlist1">
2897 <em>%cN</em>
2898 </dt>
2899 <dd>
2901 committer name (respecting .mailmap, see
2902 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2903 </p>
2904 </dd>
2905 <dt class="hdlist1">
2906 <em>%ce</em>
2907 </dt>
2908 <dd>
2910 committer email
2911 </p>
2912 </dd>
2913 <dt class="hdlist1">
2914 <em>%cE</em>
2915 </dt>
2916 <dd>
2918 committer email (respecting .mailmap, see
2919 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2920 </p>
2921 </dd>
2922 <dt class="hdlist1">
2923 <em>%cl</em>
2924 </dt>
2925 <dd>
2927 committer email local-part (the part before the <em>@</em> sign)
2928 </p>
2929 </dd>
2930 <dt class="hdlist1">
2931 <em>%cL</em>
2932 </dt>
2933 <dd>
2935 committer local-part (see <em>%cl</em>) respecting .mailmap, see
2936 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
2937 </p>
2938 </dd>
2939 <dt class="hdlist1">
2940 <em>%cd</em>
2941 </dt>
2942 <dd>
2944 committer date (format respects --date= option)
2945 </p>
2946 </dd>
2947 <dt class="hdlist1">
2948 <em>%cD</em>
2949 </dt>
2950 <dd>
2952 committer date, RFC2822 style
2953 </p>
2954 </dd>
2955 <dt class="hdlist1">
2956 <em>%cr</em>
2957 </dt>
2958 <dd>
2960 committer date, relative
2961 </p>
2962 </dd>
2963 <dt class="hdlist1">
2964 <em>%ct</em>
2965 </dt>
2966 <dd>
2968 committer date, UNIX timestamp
2969 </p>
2970 </dd>
2971 <dt class="hdlist1">
2972 <em>%ci</em>
2973 </dt>
2974 <dd>
2976 committer date, ISO 8601-like format
2977 </p>
2978 </dd>
2979 <dt class="hdlist1">
2980 <em>%cI</em>
2981 </dt>
2982 <dd>
2984 committer date, strict ISO 8601 format
2985 </p>
2986 </dd>
2987 <dt class="hdlist1">
2988 <em>%cs</em>
2989 </dt>
2990 <dd>
2992 committer date, short format (<code>YYYY-MM-DD</code>)
2993 </p>
2994 </dd>
2995 <dt class="hdlist1">
2996 <em>%ch</em>
2997 </dt>
2998 <dd>
3000 committer date, human style (like the <code>--date=human</code> option of
3001 <a href="git-rev-list.html">git-rev-list(1)</a>)
3002 </p>
3003 </dd>
3004 <dt class="hdlist1">
3005 <em>%d</em>
3006 </dt>
3007 <dd>
3009 ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
3010 </p>
3011 </dd>
3012 <dt class="hdlist1">
3013 <em>%D</em>
3014 </dt>
3015 <dd>
3017 ref names without the " (", ")" wrapping.
3018 </p>
3019 </dd>
3020 <dt class="hdlist1">
3021 <em>%(decorate[:&lt;options&gt;])</em>
3022 </dt>
3023 <dd>
3025 ref names with custom decorations. The <code>decorate</code> string may be followed by a
3026 colon and zero or more comma-separated options. Option values may contain
3027 literal formatting codes. These must be used for commas (<code>%x2C</code>) and closing
3028 parentheses (<code>%x29</code>), due to their role in the option syntax.
3029 </p>
3030 <div class="ulist"><ul>
3031 <li>
3033 <em>prefix=&lt;value&gt;</em>: Shown before the list of ref names. Defaults to "&#160;<code>(</code>".
3034 </p>
3035 </li>
3036 <li>
3038 <em>suffix=&lt;value&gt;</em>: Shown after the list of ref names. Defaults to "<code>)</code>".
3039 </p>
3040 </li>
3041 <li>
3043 <em>separator=&lt;value&gt;</em>: Shown between ref names. Defaults to "<code>,</code>&#160;".
3044 </p>
3045 </li>
3046 <li>
3048 <em>pointer=&lt;value&gt;</em>: Shown between HEAD and the branch it points to, if any.
3049 Defaults to "&#160;<code>-&gt;</code>&#160;".
3050 </p>
3051 </li>
3052 <li>
3054 <em>tag=&lt;value&gt;</em>: Shown before tag names. Defaults to "<code>tag:</code>&#160;".
3055 </p>
3056 </li>
3057 </ul></div>
3058 <div class="paragraph"><p>For example, to produce decorations with no wrapping
3059 or tag annotations, and spaces as separators:</p></div>
3060 <div class="paragraph"><p><code>%(decorate:prefix=,suffix=,tag=,separator= )</code></p></div>
3061 </dd>
3062 <dt class="hdlist1">
3063 <em>%(describe[:&lt;options&gt;])</em>
3064 </dt>
3065 <dd>
3067 human-readable name, like <a href="git-describe.html">git-describe(1)</a>; empty string for
3068 undescribable commits. The <code>describe</code> string may be followed by a colon and
3069 zero or more comma-separated options. Descriptions can be inconsistent when
3070 tags are added or removed at the same time.
3071 </p>
3072 <div class="ulist"><ul>
3073 <li>
3075 <em>tags[=&lt;bool-value&gt;]</em>: Instead of only considering annotated tags,
3076 consider lightweight tags as well.
3077 </p>
3078 </li>
3079 <li>
3081 <em>abbrev=&lt;number&gt;</em>: Instead of using the default number of hexadecimal digits
3082 (which will vary according to the number of objects in the repository with a
3083 default of 7) of the abbreviated object name, use &lt;number&gt; digits, or as many
3084 digits as needed to form a unique object name.
3085 </p>
3086 </li>
3087 <li>
3089 <em>match=&lt;pattern&gt;</em>: Only consider tags matching the given
3090 <code>glob(7)</code> pattern, excluding the "refs/tags/" prefix.
3091 </p>
3092 </li>
3093 <li>
3095 <em>exclude=&lt;pattern&gt;</em>: Do not consider tags matching the given
3096 <code>glob(7)</code> pattern, excluding the "refs/tags/" prefix.
3097 </p>
3098 </li>
3099 </ul></div>
3100 </dd>
3101 <dt class="hdlist1">
3102 <em>%S</em>
3103 </dt>
3104 <dd>
3106 ref name given on the command line by which the commit was reached
3107 (like <code>git log --source</code>), only works with <code>git log</code>
3108 </p>
3109 </dd>
3110 <dt class="hdlist1">
3111 <em>%e</em>
3112 </dt>
3113 <dd>
3115 encoding
3116 </p>
3117 </dd>
3118 <dt class="hdlist1">
3119 <em>%s</em>
3120 </dt>
3121 <dd>
3123 subject
3124 </p>
3125 </dd>
3126 <dt class="hdlist1">
3127 <em>%f</em>
3128 </dt>
3129 <dd>
3131 sanitized subject line, suitable for a filename
3132 </p>
3133 </dd>
3134 <dt class="hdlist1">
3135 <em>%b</em>
3136 </dt>
3137 <dd>
3139 body
3140 </p>
3141 </dd>
3142 <dt class="hdlist1">
3143 <em>%B</em>
3144 </dt>
3145 <dd>
3147 raw body (unwrapped subject and body)
3148 </p>
3149 </dd>
3150 <dt class="hdlist1">
3151 <em>%N</em>
3152 </dt>
3153 <dd>
3155 commit notes
3156 </p>
3157 </dd>
3158 <dt class="hdlist1">
3159 <em>%GG</em>
3160 </dt>
3161 <dd>
3163 raw verification message from GPG for a signed commit
3164 </p>
3165 </dd>
3166 <dt class="hdlist1">
3167 <em>%G?</em>
3168 </dt>
3169 <dd>
3171 show "G" for a good (valid) signature,
3172 "B" for a bad signature,
3173 "U" for a good signature with unknown validity,
3174 "X" for a good signature that has expired,
3175 "Y" for a good signature made by an expired key,
3176 "R" for a good signature made by a revoked key,
3177 "E" if the signature cannot be checked (e.g. missing key)
3178 and "N" for no signature
3179 </p>
3180 </dd>
3181 <dt class="hdlist1">
3182 <em>%GS</em>
3183 </dt>
3184 <dd>
3186 show the name of the signer for a signed commit
3187 </p>
3188 </dd>
3189 <dt class="hdlist1">
3190 <em>%GK</em>
3191 </dt>
3192 <dd>
3194 show the key used to sign a signed commit
3195 </p>
3196 </dd>
3197 <dt class="hdlist1">
3198 <em>%GF</em>
3199 </dt>
3200 <dd>
3202 show the fingerprint of the key used to sign a signed commit
3203 </p>
3204 </dd>
3205 <dt class="hdlist1">
3206 <em>%GP</em>
3207 </dt>
3208 <dd>
3210 show the fingerprint of the primary key whose subkey was used
3211 to sign a signed commit
3212 </p>
3213 </dd>
3214 <dt class="hdlist1">
3215 <em>%GT</em>
3216 </dt>
3217 <dd>
3219 show the trust level for the key used to sign a signed commit
3220 </p>
3221 </dd>
3222 <dt class="hdlist1">
3223 <em>%gD</em>
3224 </dt>
3225 <dd>
3227 reflog selector, e.g., <code>refs/stash@{1}</code> or <code>refs/stash@{2
3228 minutes ago}</code>; the format follows the rules described for the
3229 <code>-g</code> option. The portion before the <code>@</code> is the refname as
3230 given on the command line (so <code>git log -g refs/heads/master</code>
3231 would yield <code>refs/heads/master@{0}</code>).
3232 </p>
3233 </dd>
3234 <dt class="hdlist1">
3235 <em>%gd</em>
3236 </dt>
3237 <dd>
3239 shortened reflog selector; same as <code>%gD</code>, but the refname
3240 portion is shortened for human readability (so
3241 <code>refs/heads/master</code> becomes just <code>master</code>).
3242 </p>
3243 </dd>
3244 <dt class="hdlist1">
3245 <em>%gn</em>
3246 </dt>
3247 <dd>
3249 reflog identity name
3250 </p>
3251 </dd>
3252 <dt class="hdlist1">
3253 <em>%gN</em>
3254 </dt>
3255 <dd>
3257 reflog identity name (respecting .mailmap, see
3258 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
3259 </p>
3260 </dd>
3261 <dt class="hdlist1">
3262 <em>%ge</em>
3263 </dt>
3264 <dd>
3266 reflog identity email
3267 </p>
3268 </dd>
3269 <dt class="hdlist1">
3270 <em>%gE</em>
3271 </dt>
3272 <dd>
3274 reflog identity email (respecting .mailmap, see
3275 <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
3276 </p>
3277 </dd>
3278 <dt class="hdlist1">
3279 <em>%gs</em>
3280 </dt>
3281 <dd>
3283 reflog subject
3284 </p>
3285 </dd>
3286 <dt class="hdlist1">
3287 <em>%(trailers[:&lt;options&gt;])</em>
3288 </dt>
3289 <dd>
3291 display the trailers of the body as interpreted by
3292 <a href="git-interpret-trailers.html">git-interpret-trailers(1)</a>. The <code>trailers</code> string may be followed by
3293 a colon and zero or more comma-separated options. If any option is provided
3294 multiple times, the last occurrence wins.
3295 </p>
3296 <div class="ulist"><ul>
3297 <li>
3299 <em>key=&lt;key&gt;</em>: only show trailers with specified &lt;key&gt;. Matching is done
3300 case-insensitively and trailing colon is optional. If option is
3301 given multiple times trailer lines matching any of the keys are
3302 shown. This option automatically enables the <code>only</code> option so that
3303 non-trailer lines in the trailer block are hidden. If that is not
3304 desired it can be disabled with <code>only=false</code>. E.g.,
3305 <code>%(trailers:key=Reviewed-by)</code> shows trailer lines with key
3306 <code>Reviewed-by</code>.
3307 </p>
3308 </li>
3309 <li>
3311 <em>only[=&lt;bool&gt;]</em>: select whether non-trailer lines from the trailer
3312 block should be included.
3313 </p>
3314 </li>
3315 <li>
3317 <em>separator=&lt;sep&gt;</em>: specify a separator inserted between trailer
3318 lines. When this option is not given each trailer line is
3319 terminated with a line feed character. The string &lt;sep&gt; may contain
3320 the literal formatting codes described above. To use comma as
3321 separator one must use <code>%x2C</code> as it would otherwise be parsed as
3322 next option. E.g., <code>%(trailers:key=Ticket,separator=%x2C )</code>
3323 shows all trailer lines whose key is "Ticket" separated by a comma
3324 and a space.
3325 </p>
3326 </li>
3327 <li>
3329 <em>unfold[=&lt;bool&gt;]</em>: make it behave as if interpret-trailer&#8217;s <code>--unfold</code>
3330 option was given. E.g.,
3331 <code>%(trailers:only,unfold=true)</code> unfolds and shows all trailer lines.
3332 </p>
3333 </li>
3334 <li>
3336 <em>keyonly[=&lt;bool&gt;]</em>: only show the key part of the trailer.
3337 </p>
3338 </li>
3339 <li>
3341 <em>valueonly[=&lt;bool&gt;]</em>: only show the value part of the trailer.
3342 </p>
3343 </li>
3344 <li>
3346 <em>key_value_separator=&lt;sep&gt;</em>: specify a separator inserted between
3347 trailer lines. When this option is not given each trailer key-value
3348 pair is separated by ": ". Otherwise it shares the same semantics
3349 as <em>separator=&lt;sep&gt;</em> above.
3350 </p>
3351 </li>
3352 </ul></div>
3353 </dd>
3354 </dl></div>
3355 </li>
3356 </ul></div>
3357 </li>
3358 </ul></div>
3359 <div class="admonitionblock">
3360 <table><tr>
3361 <td class="icon">
3362 <div class="title">Note</div>
3363 </td>
3364 <td class="content">Some placeholders may depend on other options given to the
3365 revision traversal engine. For example, the <code>%g*</code> reflog options will
3366 insert an empty string unless we are traversing reflog entries (e.g., by
3367 <code>git log -g</code>). The <code>%d</code> and <code>%D</code> placeholders will use the "short"
3368 decoration format if <code>--decorate</code> was not already provided on the command
3369 line.</td>
3370 </tr></table>
3371 </div>
3372 <div class="paragraph"><p>The boolean options accept an optional value <code>[=&lt;bool-value&gt;]</code>. The values
3373 <code>true</code>, <code>false</code>, <code>on</code>, <code>off</code> etc. are all accepted. See the "boolean"
3374 sub-section in "EXAMPLES" in <a href="git-config.html">git-config(1)</a>. If a boolean
3375 option is given with no value, it&#8217;s enabled.</p></div>
3376 <div class="paragraph"><p>If you add a <code>+</code> (plus sign) after <em>%</em> of a placeholder, a line-feed
3377 is inserted immediately before the expansion if and only if the
3378 placeholder expands to a non-empty string.</p></div>
3379 <div class="paragraph"><p>If you add a <code>-</code> (minus sign) after <em>%</em> of a placeholder, all consecutive
3380 line-feeds immediately preceding the expansion are deleted if and only if the
3381 placeholder expands to an empty string.</p></div>
3382 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
3383 is inserted immediately before the expansion if and only if the
3384 placeholder expands to a non-empty string.</p></div>
3385 <div class="ulist"><ul>
3386 <li>
3388 <em>tformat:</em>
3389 </p>
3390 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
3391 provides "terminator" semantics instead of "separator" semantics. In
3392 other words, each commit has the message terminator character (usually a
3393 newline) appended, rather than a separator placed between entries.
3394 This means that the final entry of a single-line format will be properly
3395 terminated with a new line, just as the "oneline" format does.
3396 For example:</p></div>
3397 <div class="listingblock">
3398 <div class="content">
3399 <pre><code>$ git log -2 --pretty=format:%h 4da45bef \
3400 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
3401 4da45be
3402 7134973 -- NO NEWLINE
3404 $ git log -2 --pretty=tformat:%h 4da45bef \
3405 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
3406 4da45be
3407 7134973</code></pre>
3408 </div></div>
3409 <div class="paragraph"><p>In addition, any unrecognized string that has a <code>%</code> in it is interpreted
3410 as if it has <code>tformat:</code> in front of it. For example, these two are
3411 equivalent:</p></div>
3412 <div class="listingblock">
3413 <div class="content">
3414 <pre><code>$ git log -2 --pretty=tformat:%h 4da45bef
3415 $ git log -2 --pretty=%h 4da45bef</code></pre>
3416 </div></div>
3417 </li>
3418 </ul></div>
3419 </div>
3420 </div>
3421 <div class="sect1">
3422 <h2 id="_raw_output_format">Raw output format</h2>
3423 <div class="sectionbody">
3424 <div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
3425 "git-diff-files" and "git diff --raw" are very similar.</p></div>
3426 <div class="paragraph"><p>These commands all compare two sets of things; what is
3427 compared differs:</p></div>
3428 <div class="dlist"><dl>
3429 <dt class="hdlist1">
3430 git-diff-index &lt;tree-ish&gt;
3431 </dt>
3432 <dd>
3434 compares the &lt;tree-ish&gt; and the files on the filesystem.
3435 </p>
3436 </dd>
3437 <dt class="hdlist1">
3438 git-diff-index --cached &lt;tree-ish&gt;
3439 </dt>
3440 <dd>
3442 compares the &lt;tree-ish&gt; and the index.
3443 </p>
3444 </dd>
3445 <dt class="hdlist1">
3446 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
3447 </dt>
3448 <dd>
3450 compares the trees named by the two arguments.
3451 </p>
3452 </dd>
3453 <dt class="hdlist1">
3454 git-diff-files [&lt;pattern&gt;&#8230;]
3455 </dt>
3456 <dd>
3458 compares the index and the files on the filesystem.
3459 </p>
3460 </dd>
3461 </dl></div>
3462 <div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
3463 what is being compared. After that, all the commands print one output
3464 line per changed file.</p></div>
3465 <div class="paragraph"><p>An output line is formatted this way:</p></div>
3466 <div class="listingblock">
3467 <div class="content">
3468 <pre><code>in-place edit :100644 100644 bcd1234 0123456 M file0
3469 copy-edit :100644 100644 abcd123 1234567 C68 file1 file2
3470 rename-edit :100644 100644 abcd123 1234567 R86 file1 file3
3471 create :000000 100644 0000000 1234567 A file4
3472 delete :100644 000000 1234567 0000000 D file5
3473 unmerged :000000 000000 0000000 0000000 U file6</code></pre>
3474 </div></div>
3475 <div class="paragraph"><p>That is, from the left to the right:</p></div>
3476 <div class="olist arabic"><ol class="arabic">
3477 <li>
3479 a colon.
3480 </p>
3481 </li>
3482 <li>
3484 mode for "src"; 000000 if creation or unmerged.
3485 </p>
3486 </li>
3487 <li>
3489 a space.
3490 </p>
3491 </li>
3492 <li>
3494 mode for "dst"; 000000 if deletion or unmerged.
3495 </p>
3496 </li>
3497 <li>
3499 a space.
3500 </p>
3501 </li>
3502 <li>
3504 sha1 for "src"; 0{40} if creation or unmerged.
3505 </p>
3506 </li>
3507 <li>
3509 a space.
3510 </p>
3511 </li>
3512 <li>
3514 sha1 for "dst"; 0{40} if deletion, unmerged or "work tree out of sync with the index".
3515 </p>
3516 </li>
3517 <li>
3519 a space.
3520 </p>
3521 </li>
3522 <li>
3524 status, followed by optional "score" number.
3525 </p>
3526 </li>
3527 <li>
3529 a tab or a NUL when <code>-z</code> option is used.
3530 </p>
3531 </li>
3532 <li>
3534 path for "src"
3535 </p>
3536 </li>
3537 <li>
3539 a tab or a NUL when <code>-z</code> option is used; only exists for C or R.
3540 </p>
3541 </li>
3542 <li>
3544 path for "dst"; only exists for C or R.
3545 </p>
3546 </li>
3547 <li>
3549 an LF or a NUL when <code>-z</code> option is used, to terminate the record.
3550 </p>
3551 </li>
3552 </ol></div>
3553 <div class="paragraph"><p>Possible status letters are:</p></div>
3554 <div class="ulist"><ul>
3555 <li>
3557 A: addition of a file
3558 </p>
3559 </li>
3560 <li>
3562 C: copy of a file into a new one
3563 </p>
3564 </li>
3565 <li>
3567 D: deletion of a file
3568 </p>
3569 </li>
3570 <li>
3572 M: modification of the contents or mode of a file
3573 </p>
3574 </li>
3575 <li>
3577 R: renaming of a file
3578 </p>
3579 </li>
3580 <li>
3582 T: change in the type of the file (regular file, symbolic link or submodule)
3583 </p>
3584 </li>
3585 <li>
3587 U: file is unmerged (you must complete the merge before it can
3588 be committed)
3589 </p>
3590 </li>
3591 <li>
3593 X: "unknown" change type (most probably a bug, please report it)
3594 </p>
3595 </li>
3596 </ul></div>
3597 <div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
3598 percentage of similarity between the source and target of the move or
3599 copy). Status letter M may be followed by a score (denoting the
3600 percentage of dissimilarity) for file rewrites.</p></div>
3601 <div class="paragraph"><p>The sha1 for "dst" is shown as all 0&#8217;s if a file on the filesystem
3602 is out of sync with the index.</p></div>
3603 <div class="paragraph"><p>Example:</p></div>
3604 <div class="listingblock">
3605 <div class="content">
3606 <pre><code>:100644 100644 5be4a4a 0000000 M file.c</code></pre>
3607 </div></div>
3608 <div class="paragraph"><p>Without the <code>-z</code> option, pathnames with "unusual" characters are
3609 quoted as explained for the configuration variable <code>core.quotePath</code>
3610 (see <a href="git-config.html">git-config(1)</a>). Using <code>-z</code> the filename is output
3611 verbatim and the line is terminated by a NUL byte.</p></div>
3612 </div>
3613 </div>
3614 <div class="sect1">
3615 <h2 id="_diff_format_for_merges">diff format for merges</h2>
3616 <div class="sectionbody">
3617 <div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
3618 can take <code>-c</code> or <code>--cc</code> option
3619 to generate diff output also for merge commits. The output differs
3620 from the format described above in the following way:</p></div>
3621 <div class="olist arabic"><ol class="arabic">
3622 <li>
3624 there is a colon for each parent
3625 </p>
3626 </li>
3627 <li>
3629 there are more "src" modes and "src" sha1
3630 </p>
3631 </li>
3632 <li>
3634 status is concatenated status characters for each parent
3635 </p>
3636 </li>
3637 <li>
3639 no optional "score" number
3640 </p>
3641 </li>
3642 <li>
3644 tab-separated pathname(s) of the file
3645 </p>
3646 </li>
3647 </ol></div>
3648 <div class="paragraph"><p>For <code>-c</code> and <code>--cc</code>, only the destination or final path is shown even
3649 if the file was renamed on any side of history. With
3650 <code>--combined-all-paths</code>, the name of the path in each parent is shown
3651 followed by the name of the path in the merge commit.</p></div>
3652 <div class="paragraph"><p>Examples for <code>-c</code> and <code>--cc</code> without <code>--combined-all-paths</code>:</p></div>
3653 <div class="listingblock">
3654 <div class="content">
3655 <pre><code>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c
3656 ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh
3657 ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c</code></pre>
3658 </div></div>
3659 <div class="paragraph"><p>Examples when <code>--combined-all-paths</code> added to either <code>-c</code> or <code>--cc</code>:</p></div>
3660 <div class="listingblock">
3661 <div class="content">
3662 <pre><code>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c desc.c desc.c
3663 ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh
3664 ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey.c fuey.c phooey.c</code></pre>
3665 </div></div>
3666 <div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
3667 all parents.</p></div>
3668 </div>
3669 </div>
3670 <div class="sect1">
3671 <h2 id="generate_patch_text_with_p">Generating patch text with -p</h2>
3672 <div class="sectionbody">
3673 <div class="paragraph"><p>Running
3674 <a href="git-diff.html">git-diff(1)</a>,
3675 <a href="git-log.html">git-log(1)</a>,
3676 <a href="git-show.html">git-show(1)</a>,
3677 <a href="git-diff-index.html">git-diff-index(1)</a>,
3678 <a href="git-diff-tree.html">git-diff-tree(1)</a>, or
3679 <a href="git-diff-files.html">git-diff-files(1)</a>
3680 with the <code>-p</code> option produces patch text.
3681 You can customize the creation of patch text via the
3682 <code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables
3683 (see <a href="git.html">git(1)</a>), and the <code>diff</code> attribute (see <a href="gitattributes.html">gitattributes(5)</a>).</p></div>
3684 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
3685 diff format:</p></div>
3686 <div class="olist arabic"><ol class="arabic">
3687 <li>
3689 It is preceded with a "git diff" header that looks like this:
3690 </p>
3691 <div class="literalblock">
3692 <div class="content">
3693 <pre><code>diff --git a/file1 b/file2</code></pre>
3694 </div></div>
3695 <div class="paragraph"><p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is
3696 involved. Especially, even for a creation or a deletion,
3697 <code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div>
3698 <div class="paragraph"><p>When rename/copy is involved, <code>file1</code> and <code>file2</code> show the
3699 name of the source file of the rename/copy and the name of
3700 the file that rename/copy produces, respectively.</p></div>
3701 </li>
3702 <li>
3704 It is followed by one or more extended header lines:
3705 </p>
3706 <div class="literalblock">
3707 <div class="content">
3708 <pre><code>old mode &lt;mode&gt;
3709 new mode &lt;mode&gt;
3710 deleted file mode &lt;mode&gt;
3711 new file mode &lt;mode&gt;
3712 copy from &lt;path&gt;
3713 copy to &lt;path&gt;
3714 rename from &lt;path&gt;
3715 rename to &lt;path&gt;
3716 similarity index &lt;number&gt;
3717 dissimilarity index &lt;number&gt;
3718 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</code></pre>
3719 </div></div>
3720 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
3721 and file permission bits.</p></div>
3722 <div class="paragraph"><p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p></div>
3723 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
3724 the dissimilarity index is the percentage of changed lines. It
3725 is a rounded down integer, followed by a percent sign. The
3726 similarity index value of 100% is thus reserved for two equal
3727 files, while 100% dissimilarity means that no line from the old
3728 file made it into the new one.</p></div>
3729 <div class="paragraph"><p>The index line includes the blob object names before and after the change.
3730 The &lt;mode&gt; is included if the file mode does not change; otherwise,
3731 separate lines indicate the old and the new mode.</p></div>
3732 </li>
3733 <li>
3735 Pathnames with "unusual" characters are quoted as explained for
3736 the configuration variable <code>core.quotePath</code> (see
3737 <a href="git-config.html">git-config(1)</a>).
3738 </p>
3739 </li>
3740 <li>
3742 All the <code>file1</code> files in the output refer to files before the
3743 commit, and all the <code>file2</code> files refer to files after the commit.
3744 It is incorrect to apply each change to each file sequentially. For
3745 example, this patch will swap a and b:
3746 </p>
3747 <div class="literalblock">
3748 <div class="content">
3749 <pre><code>diff --git a/a b/b
3750 rename from a
3751 rename to b
3752 diff --git a/b b/a
3753 rename from b
3754 rename to a</code></pre>
3755 </div></div>
3756 </li>
3757 <li>
3759 Hunk headers mention the name of the function to which the hunk
3760 applies. See "Defining a custom hunk-header" in
3761 <a href="gitattributes.html">gitattributes(5)</a> for details of how to tailor to this to
3762 specific languages.
3763 </p>
3764 </li>
3765 </ol></div>
3766 </div>
3767 </div>
3768 <div class="sect1">
3769 <h2 id="_combined_diff_format">Combined diff format</h2>
3770 <div class="sectionbody">
3771 <div class="paragraph"><p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to
3772 produce a <em>combined diff</em> when showing a merge. This is the default
3773 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
3774 <a href="git-show.html">git-show(1)</a>. Note also that you can give suitable
3775 <code>--diff-merges</code> option to any of these commands to force generation of
3776 diffs in specific format.</p></div>
3777 <div class="paragraph"><p>A "combined diff" format looks like this:</p></div>
3778 <div class="listingblock">
3779 <div class="content">
3780 <pre><code>diff --combined describe.c
3781 index fabadb8,cc95eb0..4866510
3782 --- a/describe.c
3783 +++ b/describe.c
3784 @@@ -98,20 -98,12 +98,20 @@@
3785 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
3788 - static void describe(char *arg)
3789 -static void describe(struct commit *cmit, int last_one)
3790 ++static void describe(char *arg, int last_one)
3792 + unsigned char sha1[20];
3793 + struct commit *cmit;
3794 struct commit_list *list;
3795 static int initialized = 0;
3796 struct commit_name *n;
3798 + if (get_sha1(arg, sha1) &lt; 0)
3799 + usage(describe_usage);
3800 + cmit = lookup_commit_reference(sha1);
3801 + if (!cmit)
3802 + usage(describe_usage);
3804 if (!initialized) {
3805 initialized = 1;
3806 for_each_ref(get_name);</code></pre>
3807 </div></div>
3808 <div class="olist arabic"><ol class="arabic">
3809 <li>
3811 It is preceded with a "git diff" header, that looks like
3812 this (when the <code>-c</code> option is used):
3813 </p>
3814 <div class="literalblock">
3815 <div class="content">
3816 <pre><code>diff --combined file</code></pre>
3817 </div></div>
3818 <div class="paragraph"><p>or like this (when the <code>--cc</code> option is used):</p></div>
3819 <div class="literalblock">
3820 <div class="content">
3821 <pre><code>diff --cc file</code></pre>
3822 </div></div>
3823 </li>
3824 <li>
3826 It is followed by one or more extended header lines
3827 (this example shows a merge with two parents):
3828 </p>
3829 <div class="literalblock">
3830 <div class="content">
3831 <pre><code>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
3832 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
3833 new file mode &lt;mode&gt;
3834 deleted file mode &lt;mode&gt;,&lt;mode&gt;</code></pre>
3835 </div></div>
3836 <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
3837 the &lt;mode&gt; is different from the rest. Extended headers with
3838 information about detected contents movement (renames and
3839 copying detection) are designed to work with diff of two
3840 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
3841 </li>
3842 <li>
3844 It is followed by two-line from-file/to-file header
3845 </p>
3846 <div class="literalblock">
3847 <div class="content">
3848 <pre><code>--- a/file
3849 +++ b/file</code></pre>
3850 </div></div>
3851 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
3852 format, <code>/dev/null</code> is used to signal created or deleted
3853 files.</p></div>
3854 <div class="paragraph"><p>However, if the --combined-all-paths option is provided, instead of a
3855 two-line from-file/to-file you get a N+1 line from-file/to-file header,
3856 where N is the number of parents in the merge commit</p></div>
3857 <div class="literalblock">
3858 <div class="content">
3859 <pre><code>--- a/file
3860 --- a/file
3861 --- a/file
3862 +++ b/file</code></pre>
3863 </div></div>
3864 <div class="paragraph"><p>This extended format can be useful if rename or copy detection is
3865 active, to allow you to see the original name of the file in different
3866 parents.</p></div>
3867 </li>
3868 <li>
3870 Chunk header format is modified to prevent people from
3871 accidentally feeding it to <code>patch -p1</code>. Combined diff format
3872 was created for review of merge commit changes, and was not
3873 meant to be applied. The change is similar to the change in the
3874 extended <em>index</em> header:
3875 </p>
3876 <div class="literalblock">
3877 <div class="content">
3878 <pre><code>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</code></pre>
3879 </div></div>
3880 <div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk
3881 header for combined diff format.</p></div>
3882 </li>
3883 </ol></div>
3884 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
3885 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
3886 added to B), or <code>" "</code> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
3887 compares two or more files file1, file2,&#8230; with one file X, and
3888 shows how X differs from each of fileN. One column for each of
3889 fileN is prepended to the output line to note how X&#8217;s line is
3890 different from it.</p></div>
3891 <div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in
3892 fileN but it does not appear in the result. A <code>+</code> character
3893 in the column N means that the line appears in the result,
3894 and fileN does not have that line (in other words, the line was
3895 added, from the point of view of that parent).</p></div>
3896 <div class="paragraph"><p>In the above example output, the function signature was changed
3897 from both files (hence two <code>-</code> removals from both file1 and
3898 file2, plus <code>++</code> to mean one line that was added does not appear
3899 in either file1 or file2). Also eight other lines are the same
3900 from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div>
3901 <div class="paragraph"><p>When shown by <code>git diff-tree -c</code>, it compares the parents of a
3902 merge commit with the merge result (i.e. file1..fileN are the
3903 parents). When shown by <code>git diff-files -c</code>, it compares the
3904 two unresolved merge parents with the working tree file
3905 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
3906 "their version").</p></div>
3907 </div>
3908 </div>
3909 <div class="sect1">
3910 <h2 id="_other_diff_formats">other diff formats</h2>
3911 <div class="sectionbody">
3912 <div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and
3913 copied files. The <code>--stat</code> option adds diffstat(1) graph to the
3914 output. These options can be combined with other options, such as
3915 <code>-p</code>, and are meant for human consumption.</p></div>
3916 <div class="paragraph"><p>When showing a change that involves a rename or a copy, <code>--stat</code> output
3917 formats the pathnames compactly by combining common prefix and suffix of
3918 the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to
3919 <code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div>
3920 <div class="listingblock">
3921 <div class="content">
3922 <pre><code>arch/{i386 =&gt; x86}/Makefile | 4 +--</code></pre>
3923 </div></div>
3924 <div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed
3925 for easier machine consumption. An entry in <code>--numstat</code> output looks
3926 like this:</p></div>
3927 <div class="listingblock">
3928 <div class="content">
3929 <pre><code>1 2 README
3930 3 1 arch/{i386 =&gt; x86}/Makefile</code></pre>
3931 </div></div>
3932 <div class="paragraph"><p>That is, from left to right:</p></div>
3933 <div class="olist arabic"><ol class="arabic">
3934 <li>
3936 the number of added lines;
3937 </p>
3938 </li>
3939 <li>
3941 a tab;
3942 </p>
3943 </li>
3944 <li>
3946 the number of deleted lines;
3947 </p>
3948 </li>
3949 <li>
3951 a tab;
3952 </p>
3953 </li>
3954 <li>
3956 pathname (possibly with rename/copy information);
3957 </p>
3958 </li>
3959 <li>
3961 a newline.
3962 </p>
3963 </li>
3964 </ol></div>
3965 <div class="paragraph"><p>When <code>-z</code> output option is in effect, the output is formatted this way:</p></div>
3966 <div class="listingblock">
3967 <div class="content">
3968 <pre><code>1 2 README NUL
3969 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre>
3970 </div></div>
3971 <div class="paragraph"><p>That is:</p></div>
3972 <div class="olist arabic"><ol class="arabic">
3973 <li>
3975 the number of added lines;
3976 </p>
3977 </li>
3978 <li>
3980 a tab;
3981 </p>
3982 </li>
3983 <li>
3985 the number of deleted lines;
3986 </p>
3987 </li>
3988 <li>
3990 a tab;
3991 </p>
3992 </li>
3993 <li>
3995 a NUL (only exists if renamed/copied);
3996 </p>
3997 </li>
3998 <li>
4000 pathname in preimage;
4001 </p>
4002 </li>
4003 <li>
4005 a NUL (only exists if renamed/copied);
4006 </p>
4007 </li>
4008 <li>
4010 pathname in postimage (only exists if renamed/copied);
4011 </p>
4012 </li>
4013 <li>
4015 a NUL.
4016 </p>
4017 </li>
4018 </ol></div>
4019 <div class="paragraph"><p>The extra <code>NUL</code> before the preimage path in renamed case is to allow
4020 scripts that read the output to tell if the current record being read is
4021 a single-path record or a rename/copy record without reading ahead.
4022 After reading added and deleted lines, reading up to <code>NUL</code> would yield
4023 the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div>
4024 </div>
4025 </div>
4026 <div class="sect1">
4027 <h2 id="_git">GIT</h2>
4028 <div class="sectionbody">
4029 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
4030 </div>
4031 </div>
4032 </div>
4033 <div id="footnotes"><hr /></div>
4034 <div id="footer">
4035 <div id="footer-text">
4036 Last updated
4037 2021-12-10 14:52:02 PST
4038 </div>
4039 </div>
4040 </body>
4041 </html>