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