Autogenerated HTML docs for v1.7.7-325-g05f6ed
[git/jnareb-git.git] / git-show.html
blob9995aa930b53054c6e56d6b44badbb8754ea0f87
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.5.2" />
7 <title>git-show(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.0em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
131 div.content { /* Block element content. */
132 padding: 0;
135 /* Block element titles. */
136 div.title, caption.title {
137 color: #527bbd;
138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
144 div.title + * {
145 margin-top: 0;
148 td div.title:first-child {
149 margin-top: 0.0em;
151 div.content div.title:first-child {
152 margin-top: 0.0em;
154 div.content + div.title {
155 margin-top: 0.0em;
158 div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
164 div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
170 div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
173 margin-right: 10%;
174 border-left: 5px solid #dddddd;
175 color: #777777;
178 div.quoteblock > div.attribution {
179 padding-top: 0.5em;
180 text-align: right;
183 div.verseblock > div.content {
184 white-space: pre;
186 div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div.verseblock + div.attribution {
192 text-align: left;
195 div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
203 div.admonitionblock td.content {
204 padding-left: 0.5em;
205 border-left: 3px solid #dddddd;
208 div.exampleblock > div.content {
209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
213 div.imageblock div.content { padding-left: 0; }
214 span.image img { border-style: none; }
215 a.image:visited { color: white; }
217 dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
221 dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
224 font-style: normal;
225 color: navy;
227 dd > *:first-child {
228 margin-top: 0.1em;
231 ul, ol {
232 list-style-position: outside;
234 ol.arabic {
235 list-style-type: decimal;
237 ol.loweralpha {
238 list-style-type: lower-alpha;
240 ol.upperalpha {
241 list-style-type: upper-alpha;
243 ol.lowerroman {
244 list-style-type: lower-roman;
246 ol.upperroman {
247 list-style-type: upper-roman;
250 div.compact ul, div.compact ol,
251 div.compact p, div.compact p,
252 div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
257 div.tableblock > table {
258 border: 3px solid #527bbd;
260 thead, p.table.header {
261 font-family: sans-serif;
262 font-weight: bold;
264 tfoot {
265 font-weight: bold;
267 td > div.verse {
268 white-space: pre;
270 p.table {
271 margin-top: 0;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div.tableblock > table[frame="void"] {
275 border-style: none;
277 div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
281 div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
287 div.hdlist {
288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
291 div.hdlist tr {
292 padding-bottom: 15px;
294 dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
297 td.hdlist1 {
298 vertical-align: top;
299 font-style: normal;
300 padding-right: 0.8em;
301 color: navy;
303 td.hdlist2 {
304 vertical-align: top;
306 div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
311 .comment {
312 background: yellow;
315 .footnote, .footnoteref {
316 font-size: 0.8em;
319 span.footnote, span.footnoteref {
320 vertical-align: super;
323 #footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
328 #footnotes div.footnote {
329 margin: 0 0 5px 0;
332 #footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
343 @media print {
344 div#footer-badges { display: none; }
347 div#toc {
348 margin-bottom: 2.5em;
351 div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
376 /* Overrides for manpage documents */
377 h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
383 h2 {
384 border-style: none;
386 div.sectionbody {
387 margin-left: 5%;
390 @media print {
391 div#toc { display: none; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
401 div.sidebar-title, div.image-title {
402 color: #527bbd;
403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
409 div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
415 div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
420 div.verseblock-content {
421 white-space: pre;
423 div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
428 div.exampleblock-content {
429 border-left: 3px solid #dddddd;
430 padding-left: 0.5em;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc a:visited { color: blue; }
435 </style>
436 <script type="text/javascript">
437 /*<![CDATA[*/
438 window.onload = function(){asciidoc.footnotes();}
439 var asciidoc = { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
449 * Version: 0.4
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
458 // toclevels = 1..4.
459 toc: function (toclevels) {
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
469 return text;
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
491 iterate(i);
495 iterate(el);
496 return result;
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
567 /*]]>*/
568 </script>
569 </head>
570 <body>
571 <div id="header">
572 <h1>
573 git-show(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-show -
578 Show various types of objects
579 </p>
580 </div>
581 </div>
582 <div id="content">
583 <h2 id="_synopsis">SYNOPSIS</h2>
584 <div class="sectionbody">
585 <div class="verseblock">
586 <div class="verseblock-content"><em>git show</em> [options] &lt;object&gt;&#8230;</div>
587 <div class="verseblock-attribution">
588 </div></div>
589 </div>
590 <h2 id="_description">DESCRIPTION</h2>
591 <div class="sectionbody">
592 <div class="paragraph"><p>Shows one or more objects (blobs, trees, tags and commits).</p></div>
593 <div class="paragraph"><p>For commits it shows the log message and textual diff. It also
594 presents the merge commit in a special format as produced by
595 <em>git diff-tree --cc</em>.</p></div>
596 <div class="paragraph"><p>For tags, it shows the tag message and the referenced objects.</p></div>
597 <div class="paragraph"><p>For trees, it shows the names (equivalent to <em>git ls-tree</em>
598 with --name-only).</p></div>
599 <div class="paragraph"><p>For plain blobs, it shows the plain contents.</p></div>
600 <div class="paragraph"><p>The command takes options applicable to the <em>git diff-tree</em> command to
601 control how the changes the commit introduces are shown.</p></div>
602 <div class="paragraph"><p>This manual page describes only the most frequently used options.</p></div>
603 </div>
604 <h2 id="_options">OPTIONS</h2>
605 <div class="sectionbody">
606 <div class="dlist"><dl>
607 <dt class="hdlist1">
608 &lt;object&gt;&#8230;
609 </dt>
610 <dd>
612 The names of objects to show.
613 For a more complete list of ways to spell object names, see
614 "SPECIFYING REVISIONS" section in <a href="gitrevisions.html">gitrevisions(7)</a>.
615 </p>
616 </dd>
617 <dt class="hdlist1">
618 --pretty[=&lt;format&gt;]
619 </dt>
620 <dt class="hdlist1">
621 --format=&lt;format&gt;
622 </dt>
623 <dd>
625 Pretty-print the contents of the commit logs in a given format,
626 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
627 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>. See
628 the "PRETTY FORMATS" section for some additional details for each
629 format. When omitted, the format defaults to <em>medium</em>.
630 </p>
631 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
632 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
633 </dd>
634 <dt class="hdlist1">
635 --abbrev-commit
636 </dt>
637 <dd>
639 Instead of showing the full 40-byte hexadecimal commit object
640 name, show only a partial prefix. Non default number of
641 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
642 diff output, if it is displayed).
643 </p>
644 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
645 people using 80-column terminals.</p></div>
646 </dd>
647 <dt class="hdlist1">
648 --no-abbrev-commit
649 </dt>
650 <dd>
652 Show the full 40-byte hexadecimal commit object name. This negates
653 <tt>--abbrev-commit</tt> and those options which imply it such as
654 "--oneline". It also overrides the <em>log.abbrevCommit</em> variable.
655 </p>
656 </dd>
657 <dt class="hdlist1">
658 --oneline
659 </dt>
660 <dd>
662 This is a shorthand for "--pretty=oneline --abbrev-commit"
663 used together.
664 </p>
665 </dd>
666 <dt class="hdlist1">
667 --encoding[=&lt;encoding&gt;]
668 </dt>
669 <dd>
671 The commit objects record the encoding used for the log message
672 in their encoding header; this option can be used to tell the
673 command to re-code the commit log message in the encoding
674 preferred by the user. For non plumbing commands this
675 defaults to UTF-8.
676 </p>
677 </dd>
678 <dt class="hdlist1">
679 --notes[=&lt;ref&gt;]
680 </dt>
681 <dd>
683 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
684 commit, when showing the commit log message. This is the default
685 for <tt>git log</tt>, <tt>git show</tt> and <tt>git whatchanged</tt> commands when
686 there is no <tt>--pretty</tt>, <tt>--format</tt> nor <tt>--oneline</tt> option given
687 on the command line.
688 </p>
689 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
690 <em>core.notesRef</em> and <em>notes.displayRef</em> variables (or corresponding
691 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
692 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, show this notes ref instead of the
693 default notes ref(s). The ref is taken to be in <tt>refs/notes/</tt> if it
694 is not qualified.</p></div>
695 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
696 being displayed. Examples: "--notes=foo" will show only notes from
697 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
698 "refs/notes/foo" and from the default notes ref(s).</p></div>
699 </dd>
700 <dt class="hdlist1">
701 --no-notes
702 </dt>
703 <dd>
705 Do not show notes. This negates the above <tt>--notes</tt> option, by
706 resetting the list of notes refs from which notes are shown.
707 Options are parsed in the order given on the command line, so e.g.
708 "--notes --notes=foo --no-notes --notes=bar" will only show notes
709 from "refs/notes/bar".
710 </p>
711 </dd>
712 <dt class="hdlist1">
713 --show-notes[=&lt;ref&gt;]
714 </dt>
715 <dt class="hdlist1">
716 --[no-]standard-notes
717 </dt>
718 <dd>
720 These options are deprecated. Use the above --notes/--no-notes
721 options instead.
722 </p>
723 </dd>
724 </dl></div>
725 </div>
726 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
727 <div class="sectionbody">
728 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
729 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
730 inserted before the <em>Author:</em> line. This line begins with
731 "Merge: " and the sha1s of ancestral commits are printed,
732 separated by spaces. Note that the listed commits may not
733 necessarily be the list of the <strong>direct</strong> parent commits if you
734 have limited your view of history: for example, if you are
735 only interested in changes related to a certain directory or
736 file.</p></div>
737 <div class="paragraph"><p>There are several built-in formats, and you can define
738 additional formats by setting a pretty.&lt;name&gt;
739 config option to either another format name, or a
740 <em>format:</em> string, as described below (see
741 <a href="git-config.html">git-config(1)</a>). Here are the details of the
742 built-in formats:</p></div>
743 <div class="ulist"><ul>
744 <li>
746 <em>oneline</em>
747 </p>
748 <div class="literalblock">
749 <div class="content">
750 <pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
751 </div></div>
752 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
753 </li>
754 <li>
756 <em>short</em>
757 </p>
758 <div class="literalblock">
759 <div class="content">
760 <pre><tt>commit &lt;sha1&gt;
761 Author: &lt;author&gt;</tt></pre>
762 </div></div>
763 <div class="literalblock">
764 <div class="content">
765 <pre><tt>&lt;title line&gt;</tt></pre>
766 </div></div>
767 </li>
768 <li>
770 <em>medium</em>
771 </p>
772 <div class="literalblock">
773 <div class="content">
774 <pre><tt>commit &lt;sha1&gt;
775 Author: &lt;author&gt;
776 Date: &lt;author date&gt;</tt></pre>
777 </div></div>
778 <div class="literalblock">
779 <div class="content">
780 <pre><tt>&lt;title line&gt;</tt></pre>
781 </div></div>
782 <div class="literalblock">
783 <div class="content">
784 <pre><tt>&lt;full commit message&gt;</tt></pre>
785 </div></div>
786 </li>
787 <li>
789 <em>full</em>
790 </p>
791 <div class="literalblock">
792 <div class="content">
793 <pre><tt>commit &lt;sha1&gt;
794 Author: &lt;author&gt;
795 Commit: &lt;committer&gt;</tt></pre>
796 </div></div>
797 <div class="literalblock">
798 <div class="content">
799 <pre><tt>&lt;title line&gt;</tt></pre>
800 </div></div>
801 <div class="literalblock">
802 <div class="content">
803 <pre><tt>&lt;full commit message&gt;</tt></pre>
804 </div></div>
805 </li>
806 <li>
808 <em>fuller</em>
809 </p>
810 <div class="literalblock">
811 <div class="content">
812 <pre><tt>commit &lt;sha1&gt;
813 Author: &lt;author&gt;
814 AuthorDate: &lt;author date&gt;
815 Commit: &lt;committer&gt;
816 CommitDate: &lt;committer date&gt;</tt></pre>
817 </div></div>
818 <div class="literalblock">
819 <div class="content">
820 <pre><tt>&lt;title line&gt;</tt></pre>
821 </div></div>
822 <div class="literalblock">
823 <div class="content">
824 <pre><tt>&lt;full commit message&gt;</tt></pre>
825 </div></div>
826 </li>
827 <li>
829 <em>email</em>
830 </p>
831 <div class="literalblock">
832 <div class="content">
833 <pre><tt>From &lt;sha1&gt; &lt;date&gt;
834 From: &lt;author&gt;
835 Date: &lt;author date&gt;
836 Subject: [PATCH] &lt;title line&gt;</tt></pre>
837 </div></div>
838 <div class="literalblock">
839 <div class="content">
840 <pre><tt>&lt;full commit message&gt;</tt></pre>
841 </div></div>
842 </li>
843 <li>
845 <em>raw</em>
846 </p>
847 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
848 stored in the commit object. Notably, the SHA1s are
849 displayed in full, regardless of whether --abbrev or
850 --no-abbrev are used, and <em>parents</em> information show the
851 true parent commits, without taking grafts nor history
852 simplification into account.</p></div>
853 </li>
854 <li>
856 <em>format:&lt;string&gt;</em>
857 </p>
858 <div class="paragraph"><p>The <em>format:&lt;string&gt;</em> format allows you to specify which information
859 you want to show. It works a little bit like printf format,
860 with the notable exception that you get a newline with <em>%n</em>
861 instead of <em>\n</em>.</p></div>
862 <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>
863 would show something like this:</p></div>
864 <div class="listingblock">
865 <div class="content">
866 <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
867 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</tt></pre>
868 </div></div>
869 <div class="paragraph"><p>The placeholders are:</p></div>
870 <div class="ulist"><ul>
871 <li>
873 <em>%H</em>: commit hash
874 </p>
875 </li>
876 <li>
878 <em>%h</em>: abbreviated commit hash
879 </p>
880 </li>
881 <li>
883 <em>%T</em>: tree hash
884 </p>
885 </li>
886 <li>
888 <em>%t</em>: abbreviated tree hash
889 </p>
890 </li>
891 <li>
893 <em>%P</em>: parent hashes
894 </p>
895 </li>
896 <li>
898 <em>%p</em>: abbreviated parent hashes
899 </p>
900 </li>
901 <li>
903 <em>%an</em>: author name
904 </p>
905 </li>
906 <li>
908 <em>%aN</em>: author name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
909 </p>
910 </li>
911 <li>
913 <em>%ae</em>: author email
914 </p>
915 </li>
916 <li>
918 <em>%aE</em>: author email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
919 </p>
920 </li>
921 <li>
923 <em>%ad</em>: author date (format respects --date= option)
924 </p>
925 </li>
926 <li>
928 <em>%aD</em>: author date, RFC2822 style
929 </p>
930 </li>
931 <li>
933 <em>%ar</em>: author date, relative
934 </p>
935 </li>
936 <li>
938 <em>%at</em>: author date, UNIX timestamp
939 </p>
940 </li>
941 <li>
943 <em>%ai</em>: author date, ISO 8601 format
944 </p>
945 </li>
946 <li>
948 <em>%cn</em>: committer name
949 </p>
950 </li>
951 <li>
953 <em>%cN</em>: committer name (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
954 </p>
955 </li>
956 <li>
958 <em>%ce</em>: committer email
959 </p>
960 </li>
961 <li>
963 <em>%cE</em>: committer email (respecting .mailmap, see <a href="git-shortlog.html">git-shortlog(1)</a> or <a href="git-blame.html">git-blame(1)</a>)
964 </p>
965 </li>
966 <li>
968 <em>%cd</em>: committer date
969 </p>
970 </li>
971 <li>
973 <em>%cD</em>: committer date, RFC2822 style
974 </p>
975 </li>
976 <li>
978 <em>%cr</em>: committer date, relative
979 </p>
980 </li>
981 <li>
983 <em>%ct</em>: committer date, UNIX timestamp
984 </p>
985 </li>
986 <li>
988 <em>%ci</em>: committer date, ISO 8601 format
989 </p>
990 </li>
991 <li>
993 <em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
994 </p>
995 </li>
996 <li>
998 <em>%e</em>: encoding
999 </p>
1000 </li>
1001 <li>
1003 <em>%s</em>: subject
1004 </p>
1005 </li>
1006 <li>
1008 <em>%f</em>: sanitized subject line, suitable for a filename
1009 </p>
1010 </li>
1011 <li>
1013 <em>%b</em>: body
1014 </p>
1015 </li>
1016 <li>
1018 <em>%B</em>: raw body (unwrapped subject and body)
1019 </p>
1020 </li>
1021 <li>
1023 <em>%N</em>: commit notes
1024 </p>
1025 </li>
1026 <li>
1028 <em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
1029 </p>
1030 </li>
1031 <li>
1033 <em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
1034 </p>
1035 </li>
1036 <li>
1038 <em>%gs</em>: reflog subject
1039 </p>
1040 </li>
1041 <li>
1043 <em>%Cred</em>: switch color to red
1044 </p>
1045 </li>
1046 <li>
1048 <em>%Cgreen</em>: switch color to green
1049 </p>
1050 </li>
1051 <li>
1053 <em>%Cblue</em>: switch color to blue
1054 </p>
1055 </li>
1056 <li>
1058 <em>%Creset</em>: reset color
1059 </p>
1060 </li>
1061 <li>
1063 <em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
1064 </p>
1065 </li>
1066 <li>
1068 <em>%m</em>: left, right or boundary mark
1069 </p>
1070 </li>
1071 <li>
1073 <em>%n</em>: newline
1074 </p>
1075 </li>
1076 <li>
1078 <em>%%</em>: a raw <em>%</em>
1079 </p>
1080 </li>
1081 <li>
1083 <em>%x00</em>: print a byte from a hex code
1084 </p>
1085 </li>
1086 <li>
1088 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
1089 <a href="git-shortlog.html">git-shortlog(1)</a>.
1090 </p>
1091 </li>
1092 </ul></div>
1093 </li>
1094 </ul></div>
1095 <div class="admonitionblock">
1096 <table><tr>
1097 <td class="icon">
1098 <div class="title">Note</div>
1099 </td>
1100 <td class="content">Some placeholders may depend on other options given to the
1101 revision traversal engine. For example, the <tt>%g*</tt> reflog options will
1102 insert an empty string unless we are traversing reflog entries (e.g., by
1103 <tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
1104 format if <tt>--decorate</tt> was not already provided on the command line.</td>
1105 </tr></table>
1106 </div>
1107 <div class="paragraph"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
1108 is inserted immediately before the expansion if and only if the
1109 placeholder expands to a non-empty string.</p></div>
1110 <div class="paragraph"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
1111 immediately precede the expansion are deleted if and only if the
1112 placeholder expands to an empty string.</p></div>
1113 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
1114 is inserted immediately before the expansion if and only if the
1115 placeholder expands to a non-empty string.</p></div>
1116 <div class="ulist"><ul>
1117 <li>
1119 <em>tformat:</em>
1120 </p>
1121 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
1122 provides "terminator" semantics instead of "separator" semantics. In
1123 other words, each commit has the message terminator character (usually a
1124 newline) appended, rather than a separator placed between entries.
1125 This means that the final entry of a single-line format will be properly
1126 terminated with a new line, just as the "oneline" format does.
1127 For example:</p></div>
1128 <div class="listingblock">
1129 <div class="content">
1130 <pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
1131 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1132 4da45be
1133 7134973 -- NO NEWLINE
1135 $ git log -2 --pretty=tformat:%h 4da45bef \
1136 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1137 4da45be
1138 7134973</tt></pre>
1139 </div></div>
1140 <div class="paragraph"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
1141 as if it has <tt>tformat:</tt> in front of it. For example, these two are
1142 equivalent:</p></div>
1143 <div class="listingblock">
1144 <div class="content">
1145 <pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
1146 $ git log -2 --pretty=%h 4da45bef</tt></pre>
1147 </div></div>
1148 </li>
1149 </ul></div>
1150 </div>
1151 <h2 id="_examples">EXAMPLES</h2>
1152 <div class="sectionbody">
1153 <div class="dlist"><dl>
1154 <dt class="hdlist1">
1155 <tt>git show v1.0.0</tt>
1156 </dt>
1157 <dd>
1159 Shows the tag <tt>v1.0.0</tt>, along with the object the tags
1160 points at.
1161 </p>
1162 </dd>
1163 <dt class="hdlist1">
1164 <tt>git show v1.0.0^{tree}</tt>
1165 </dt>
1166 <dd>
1168 Shows the tree pointed to by the tag <tt>v1.0.0</tt>.
1169 </p>
1170 </dd>
1171 <dt class="hdlist1">
1172 <tt>git show -s --format=%s v1.0.0^{commit}</tt>
1173 </dt>
1174 <dd>
1176 Shows the subject of the commit pointed to by the
1177 tag <tt>v1.0.0</tt>.
1178 </p>
1179 </dd>
1180 <dt class="hdlist1">
1181 <tt>git show next~10:Documentation/README</tt>
1182 </dt>
1183 <dd>
1185 Shows the contents of the file <tt>Documentation/README</tt> as
1186 they were current in the 10th last commit of the branch
1187 <tt>next</tt>.
1188 </p>
1189 </dd>
1190 <dt class="hdlist1">
1191 <tt>git show master:Makefile master:t/Makefile</tt>
1192 </dt>
1193 <dd>
1195 Concatenates the contents of said Makefiles in the head
1196 of the branch <tt>master</tt>.
1197 </p>
1198 </dd>
1199 </dl></div>
1200 </div>
1201 <h2 id="_discussion">Discussion</h2>
1202 <div class="sectionbody">
1203 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1204 <div class="ulist"><ul>
1205 <li>
1207 The pathnames recorded in the index and in the tree objects
1208 are treated as uninterpreted sequences of non-NUL bytes.
1209 What readdir(2) returns are what are recorded and compared
1210 with the data git keeps track of, which in turn are expected
1211 to be what lstat(2) and creat(2) accepts. There is no such
1212 thing as pathname encoding translation.
1213 </p>
1214 </li>
1215 <li>
1217 The contents of the blob objects are uninterpreted sequences
1218 of bytes. There is no encoding translation at the core
1219 level.
1220 </p>
1221 </li>
1222 <li>
1224 The commit log messages are uninterpreted sequences of non-NUL
1225 bytes.
1226 </p>
1227 </li>
1228 </ul></div>
1229 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1230 in UTF-8, both the core and git Porcelain are designed not to
1231 force UTF-8 on projects. If all participants of a particular
1232 project find it more convenient to use legacy encodings, git
1233 does not forbid it. However, there are a few things to keep in
1234 mind.</p></div>
1235 <div class="olist arabic"><ol class="arabic">
1236 <li>
1238 <em>git commit</em> and <em>git commit-tree</em> issues
1239 a warning if the commit log message given to it does not look
1240 like a valid UTF-8 string, unless you explicitly say your
1241 project uses a legacy encoding. The way to say this is to
1242 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
1243 </p>
1244 <div class="listingblock">
1245 <div class="content">
1246 <pre><tt>[i18n]
1247 commitencoding = ISO-8859-1</tt></pre>
1248 </div></div>
1249 <div class="paragraph"><p>Commit objects created with the above setting record the value
1250 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
1251 help other people who look at them later. Lack of this header
1252 implies that the commit log message is encoded in UTF-8.</p></div>
1253 </li>
1254 <li>
1256 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1257 <tt>encoding</tt> header of a commit object, and try to re-code the
1258 log message into UTF-8 unless otherwise specified. You can
1259 specify the desired output encoding with
1260 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
1261 </p>
1262 <div class="listingblock">
1263 <div class="content">
1264 <pre><tt>[i18n]
1265 logoutputencoding = ISO-8859-1</tt></pre>
1266 </div></div>
1267 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1268 <tt>i18n.commitencoding</tt> is used instead.</p></div>
1269 </li>
1270 </ol></div>
1271 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1272 message when a commit is made to force UTF-8 at the commit
1273 object level, because re-coding to UTF-8 is not necessarily a
1274 reversible operation.</p></div>
1275 </div>
1276 <h2 id="_git">GIT</h2>
1277 <div class="sectionbody">
1278 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1279 </div>
1280 </div>
1281 <div id="footnotes"><hr /></div>
1282 <div id="footer">
1283 <div id="footer-text">
1284 Last updated 2011-09-21 23:01:14 PDT
1285 </div>
1286 </div>
1287 </body>
1288 </html>