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