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