Autogenerated HTML docs for v1.7.6-549-gf85a0
[git/jnareb-git.git] / git-show.html
blob4db79765b2aaaf610016273d9bd93901e9f450e4
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.4.5" />
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.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-show(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-show -
411 Show various types of objects
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git show</em> [options] &lt;object&gt;&#8230;</div>
419 <div class="verseblock-attribution">
420 </div></div>
421 </div>
422 <h2 id="_description">DESCRIPTION</h2>
423 <div class="sectionbody">
424 <div class="paragraph"><p>Shows one or more objects (blobs, trees, tags and commits).</p></div>
425 <div class="paragraph"><p>For commits it shows the log message and textual diff. It also
426 presents the merge commit in a special format as produced by
427 <em>git diff-tree --cc</em>.</p></div>
428 <div class="paragraph"><p>For tags, it shows the tag message and the referenced objects.</p></div>
429 <div class="paragraph"><p>For trees, it shows the names (equivalent to <em>git ls-tree</em>
430 with --name-only).</p></div>
431 <div class="paragraph"><p>For plain blobs, it shows the plain contents.</p></div>
432 <div class="paragraph"><p>The command takes options applicable to the <em>git diff-tree</em> command to
433 control how the changes the commit introduces are shown.</p></div>
434 <div class="paragraph"><p>This manual page describes only the most frequently used options.</p></div>
435 </div>
436 <h2 id="_options">OPTIONS</h2>
437 <div class="sectionbody">
438 <div class="dlist"><dl>
439 <dt class="hdlist1">
440 &lt;object&gt;&#8230;
441 </dt>
442 <dd>
444 The names of objects to show.
445 For a more complete list of ways to spell object names, see
446 "SPECIFYING REVISIONS" section in <a href="gitrevisions.html">gitrevisions(7)</a>.
447 </p>
448 </dd>
449 <dt class="hdlist1">
450 --pretty[=&lt;format&gt;]
451 </dt>
452 <dt class="hdlist1">
453 --format=&lt;format&gt;
454 </dt>
455 <dd>
457 Pretty-print the contents of the commit logs in a given format,
458 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
459 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>. See
460 the "PRETTY FORMATS" section for some additional details for each
461 format. When omitted, the format defaults to <em>medium</em>.
462 </p>
463 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
464 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
465 </dd>
466 <dt class="hdlist1">
467 --abbrev-commit
468 </dt>
469 <dd>
471 Instead of showing the full 40-byte hexadecimal commit object
472 name, show only a partial prefix. Non default number of
473 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
474 diff output, if it is displayed).
475 </p>
476 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
477 people using 80-column terminals.</p></div>
478 </dd>
479 <dt class="hdlist1">
480 --no-abbrev-commit
481 </dt>
482 <dd>
484 Show the full 40-byte hexadecimal commit object name. This negates
485 <tt>--abbrev-commit</tt> and those options which imply it such as
486 "--oneline". It also overrides the <em>log.abbrevCommit</em> variable.
487 </p>
488 </dd>
489 <dt class="hdlist1">
490 --oneline
491 </dt>
492 <dd>
494 This is a shorthand for "--pretty=oneline --abbrev-commit"
495 used together.
496 </p>
497 </dd>
498 <dt class="hdlist1">
499 --encoding[=&lt;encoding&gt;]
500 </dt>
501 <dd>
503 The commit objects record the encoding used for the log message
504 in their encoding header; this option can be used to tell the
505 command to re-code the commit log message in the encoding
506 preferred by the user. For non plumbing commands this
507 defaults to UTF-8.
508 </p>
509 </dd>
510 <dt class="hdlist1">
511 --notes[=&lt;ref&gt;]
512 </dt>
513 <dd>
515 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
516 commit, when showing the commit log message. This is the default
517 for <tt>git log</tt>, <tt>git show</tt> and <tt>git whatchanged</tt> commands when
518 there is no <tt>--pretty</tt>, <tt>--format</tt> nor <tt>--oneline</tt> option given
519 on the command line.
520 </p>
521 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
522 <em>core.notesRef</em> and <em>notes.displayRef</em> variables (or corresponding
523 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
524 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, show this notes ref instead of the
525 default notes ref(s). The ref is taken to be in <tt>refs/notes/</tt> if it
526 is not qualified.</p></div>
527 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
528 being displayed. Examples: "--notes=foo" will show only notes from
529 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
530 "refs/notes/foo" and from the default notes ref(s).</p></div>
531 </dd>
532 <dt class="hdlist1">
533 --no-notes
534 </dt>
535 <dd>
537 Do not show notes. This negates the above <tt>--notes</tt> option, by
538 resetting the list of notes refs from which notes are shown.
539 Options are parsed in the order given on the command line, so e.g.
540 "--notes --notes=foo --no-notes --notes=bar" will only show notes
541 from "refs/notes/bar".
542 </p>
543 </dd>
544 <dt class="hdlist1">
545 --show-notes[=&lt;ref&gt;]
546 </dt>
547 <dt class="hdlist1">
548 --[no-]standard-notes
549 </dt>
550 <dd>
552 These options are deprecated. Use the above --notes/--no-notes
553 options instead.
554 </p>
555 </dd>
556 </dl></div>
557 </div>
558 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
559 <div class="sectionbody">
560 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
561 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
562 inserted before the <em>Author:</em> line. This line begins with
563 "Merge: " and the sha1s of ancestral commits are printed,
564 separated by spaces. Note that the listed commits may not
565 necessarily be the list of the <strong>direct</strong> parent commits if you
566 have limited your view of history: for example, if you are
567 only interested in changes related to a certain directory or
568 file.</p></div>
569 <div class="paragraph"><p>There are several built-in formats, and you can define
570 additional formats by setting a pretty.&lt;name&gt;
571 config option to either another format name, or a
572 <em>format:</em> string, as described below (see
573 <a href="git-config.html">git-config(1)</a>). Here are the details of the
574 built-in formats:</p></div>
575 <div class="ulist"><ul>
576 <li>
578 <em>oneline</em>
579 </p>
580 <div class="literalblock">
581 <div class="content">
582 <pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
583 </div></div>
584 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
585 </li>
586 <li>
588 <em>short</em>
589 </p>
590 <div class="literalblock">
591 <div class="content">
592 <pre><tt>commit &lt;sha1&gt;
593 Author: &lt;author&gt;</tt></pre>
594 </div></div>
595 <div class="literalblock">
596 <div class="content">
597 <pre><tt>&lt;title line&gt;</tt></pre>
598 </div></div>
599 </li>
600 <li>
602 <em>medium</em>
603 </p>
604 <div class="literalblock">
605 <div class="content">
606 <pre><tt>commit &lt;sha1&gt;
607 Author: &lt;author&gt;
608 Date: &lt;author date&gt;</tt></pre>
609 </div></div>
610 <div class="literalblock">
611 <div class="content">
612 <pre><tt>&lt;title line&gt;</tt></pre>
613 </div></div>
614 <div class="literalblock">
615 <div class="content">
616 <pre><tt>&lt;full commit message&gt;</tt></pre>
617 </div></div>
618 </li>
619 <li>
621 <em>full</em>
622 </p>
623 <div class="literalblock">
624 <div class="content">
625 <pre><tt>commit &lt;sha1&gt;
626 Author: &lt;author&gt;
627 Commit: &lt;committer&gt;</tt></pre>
628 </div></div>
629 <div class="literalblock">
630 <div class="content">
631 <pre><tt>&lt;title line&gt;</tt></pre>
632 </div></div>
633 <div class="literalblock">
634 <div class="content">
635 <pre><tt>&lt;full commit message&gt;</tt></pre>
636 </div></div>
637 </li>
638 <li>
640 <em>fuller</em>
641 </p>
642 <div class="literalblock">
643 <div class="content">
644 <pre><tt>commit &lt;sha1&gt;
645 Author: &lt;author&gt;
646 AuthorDate: &lt;author date&gt;
647 Commit: &lt;committer&gt;
648 CommitDate: &lt;committer date&gt;</tt></pre>
649 </div></div>
650 <div class="literalblock">
651 <div class="content">
652 <pre><tt>&lt;title line&gt;</tt></pre>
653 </div></div>
654 <div class="literalblock">
655 <div class="content">
656 <pre><tt>&lt;full commit message&gt;</tt></pre>
657 </div></div>
658 </li>
659 <li>
661 <em>email</em>
662 </p>
663 <div class="literalblock">
664 <div class="content">
665 <pre><tt>From &lt;sha1&gt; &lt;date&gt;
666 From: &lt;author&gt;
667 Date: &lt;author date&gt;
668 Subject: [PATCH] &lt;title line&gt;</tt></pre>
669 </div></div>
670 <div class="literalblock">
671 <div class="content">
672 <pre><tt>&lt;full commit message&gt;</tt></pre>
673 </div></div>
674 </li>
675 <li>
677 <em>raw</em>
678 </p>
679 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
680 stored in the commit object. Notably, the SHA1s are
681 displayed in full, regardless of whether --abbrev or
682 --no-abbrev are used, and <em>parents</em> information show the
683 true parent commits, without taking grafts nor history
684 simplification into account.</p></div>
685 </li>
686 <li>
688 <em>format:&lt;string&gt;</em>
689 </p>
690 <div class="paragraph"><p>The <em>format:&lt;string&gt;</em> format allows you to specify which information
691 you want to show. It works a little bit like printf format,
692 with the notable exception that you get a newline with <em>%n</em>
693 instead of <em>\n</em>.</p></div>
694 <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>
695 would show something like this:</p></div>
696 <div class="listingblock">
697 <div class="content">
698 <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
699 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</tt></pre>
700 </div></div>
701 <div class="paragraph"><p>The placeholders are:</p></div>
702 <div class="ulist"><ul>
703 <li>
705 <em>%H</em>: commit hash
706 </p>
707 </li>
708 <li>
710 <em>%h</em>: abbreviated commit hash
711 </p>
712 </li>
713 <li>
715 <em>%T</em>: tree hash
716 </p>
717 </li>
718 <li>
720 <em>%t</em>: abbreviated tree hash
721 </p>
722 </li>
723 <li>
725 <em>%P</em>: parent hashes
726 </p>
727 </li>
728 <li>
730 <em>%p</em>: abbreviated parent hashes
731 </p>
732 </li>
733 <li>
735 <em>%an</em>: author name
736 </p>
737 </li>
738 <li>
740 <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>)
741 </p>
742 </li>
743 <li>
745 <em>%ae</em>: author email
746 </p>
747 </li>
748 <li>
750 <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>)
751 </p>
752 </li>
753 <li>
755 <em>%ad</em>: author date (format respects --date= option)
756 </p>
757 </li>
758 <li>
760 <em>%aD</em>: author date, RFC2822 style
761 </p>
762 </li>
763 <li>
765 <em>%ar</em>: author date, relative
766 </p>
767 </li>
768 <li>
770 <em>%at</em>: author date, UNIX timestamp
771 </p>
772 </li>
773 <li>
775 <em>%ai</em>: author date, ISO 8601 format
776 </p>
777 </li>
778 <li>
780 <em>%cn</em>: committer name
781 </p>
782 </li>
783 <li>
785 <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>)
786 </p>
787 </li>
788 <li>
790 <em>%ce</em>: committer email
791 </p>
792 </li>
793 <li>
795 <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>)
796 </p>
797 </li>
798 <li>
800 <em>%cd</em>: committer date
801 </p>
802 </li>
803 <li>
805 <em>%cD</em>: committer date, RFC2822 style
806 </p>
807 </li>
808 <li>
810 <em>%cr</em>: committer date, relative
811 </p>
812 </li>
813 <li>
815 <em>%ct</em>: committer date, UNIX timestamp
816 </p>
817 </li>
818 <li>
820 <em>%ci</em>: committer date, ISO 8601 format
821 </p>
822 </li>
823 <li>
825 <em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
826 </p>
827 </li>
828 <li>
830 <em>%e</em>: encoding
831 </p>
832 </li>
833 <li>
835 <em>%s</em>: subject
836 </p>
837 </li>
838 <li>
840 <em>%f</em>: sanitized subject line, suitable for a filename
841 </p>
842 </li>
843 <li>
845 <em>%b</em>: body
846 </p>
847 </li>
848 <li>
850 <em>%B</em>: raw body (unwrapped subject and body)
851 </p>
852 </li>
853 <li>
855 <em>%N</em>: commit notes
856 </p>
857 </li>
858 <li>
860 <em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
861 </p>
862 </li>
863 <li>
865 <em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
866 </p>
867 </li>
868 <li>
870 <em>%gs</em>: reflog subject
871 </p>
872 </li>
873 <li>
875 <em>%Cred</em>: switch color to red
876 </p>
877 </li>
878 <li>
880 <em>%Cgreen</em>: switch color to green
881 </p>
882 </li>
883 <li>
885 <em>%Cblue</em>: switch color to blue
886 </p>
887 </li>
888 <li>
890 <em>%Creset</em>: reset color
891 </p>
892 </li>
893 <li>
895 <em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
896 </p>
897 </li>
898 <li>
900 <em>%m</em>: left, right or boundary mark
901 </p>
902 </li>
903 <li>
905 <em>%n</em>: newline
906 </p>
907 </li>
908 <li>
910 <em>%%</em>: a raw <em>%</em>
911 </p>
912 </li>
913 <li>
915 <em>%x00</em>: print a byte from a hex code
916 </p>
917 </li>
918 <li>
920 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
921 <a href="git-shortlog.html">git-shortlog(1)</a>.
922 </p>
923 </li>
924 </ul></div>
925 </li>
926 </ul></div>
927 <div class="admonitionblock">
928 <table><tr>
929 <td class="icon">
930 <div class="title">Note</div>
931 </td>
932 <td class="content">Some placeholders may depend on other options given to the
933 revision traversal engine. For example, the <tt>%g*</tt> reflog options will
934 insert an empty string unless we are traversing reflog entries (e.g., by
935 <tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
936 format if <tt>--decorate</tt> was not already provided on the command line.</td>
937 </tr></table>
938 </div>
939 <div class="paragraph"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
940 is inserted immediately before the expansion if and only if the
941 placeholder expands to a non-empty string.</p></div>
942 <div class="paragraph"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
943 immediately precede the expansion are deleted if and only if the
944 placeholder expands to an empty string.</p></div>
945 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
946 is inserted immediately before the expansion if and only if the
947 placeholder expands to a non-empty string.</p></div>
948 <div class="ulist"><ul>
949 <li>
951 <em>tformat:</em>
952 </p>
953 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
954 provides "terminator" semantics instead of "separator" semantics. In
955 other words, each commit has the message terminator character (usually a
956 newline) appended, rather than a separator placed between entries.
957 This means that the final entry of a single-line format will be properly
958 terminated with a new line, just as the "oneline" format does.
959 For example:</p></div>
960 <div class="listingblock">
961 <div class="content">
962 <pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
963 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
964 4da45be
965 7134973 -- NO NEWLINE
967 $ git log -2 --pretty=tformat:%h 4da45bef \
968 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
969 4da45be
970 7134973</tt></pre>
971 </div></div>
972 <div class="paragraph"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
973 as if it has <tt>tformat:</tt> in front of it. For example, these two are
974 equivalent:</p></div>
975 <div class="listingblock">
976 <div class="content">
977 <pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
978 $ git log -2 --pretty=%h 4da45bef</tt></pre>
979 </div></div>
980 </li>
981 </ul></div>
982 </div>
983 <h2 id="_examples">EXAMPLES</h2>
984 <div class="sectionbody">
985 <div class="dlist"><dl>
986 <dt class="hdlist1">
987 <tt>git show v1.0.0</tt>
988 </dt>
989 <dd>
991 Shows the tag <tt>v1.0.0</tt>, along with the object the tags
992 points at.
993 </p>
994 </dd>
995 <dt class="hdlist1">
996 <tt>git show v1.0.0^{tree}</tt>
997 </dt>
998 <dd>
1000 Shows the tree pointed to by the tag <tt>v1.0.0</tt>.
1001 </p>
1002 </dd>
1003 <dt class="hdlist1">
1004 <tt>git show -s --format=%s v1.0.0^{commit}</tt>
1005 </dt>
1006 <dd>
1008 Shows the subject of the commit pointed to by the
1009 tag <tt>v1.0.0</tt>.
1010 </p>
1011 </dd>
1012 <dt class="hdlist1">
1013 <tt>git show next~10:Documentation/README</tt>
1014 </dt>
1015 <dd>
1017 Shows the contents of the file <tt>Documentation/README</tt> as
1018 they were current in the 10th last commit of the branch
1019 <tt>next</tt>.
1020 </p>
1021 </dd>
1022 <dt class="hdlist1">
1023 <tt>git show master:Makefile master:t/Makefile</tt>
1024 </dt>
1025 <dd>
1027 Concatenates the contents of said Makefiles in the head
1028 of the branch <tt>master</tt>.
1029 </p>
1030 </dd>
1031 </dl></div>
1032 </div>
1033 <h2 id="_discussion">Discussion</h2>
1034 <div class="sectionbody">
1035 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
1036 <div class="ulist"><ul>
1037 <li>
1039 The pathnames recorded in the index and in the tree objects
1040 are treated as uninterpreted sequences of non-NUL bytes.
1041 What readdir(2) returns are what are recorded and compared
1042 with the data git keeps track of, which in turn are expected
1043 to be what lstat(2) and creat(2) accepts. There is no such
1044 thing as pathname encoding translation.
1045 </p>
1046 </li>
1047 <li>
1049 The contents of the blob objects are uninterpreted sequences
1050 of bytes. There is no encoding translation at the core
1051 level.
1052 </p>
1053 </li>
1054 <li>
1056 The commit log messages are uninterpreted sequences of non-NUL
1057 bytes.
1058 </p>
1059 </li>
1060 </ul></div>
1061 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
1062 in UTF-8, both the core and git Porcelain are designed not to
1063 force UTF-8 on projects. If all participants of a particular
1064 project find it more convenient to use legacy encodings, git
1065 does not forbid it. However, there are a few things to keep in
1066 mind.</p></div>
1067 <div class="olist arabic"><ol class="arabic">
1068 <li>
1070 <em>git commit</em> and <em>git commit-tree</em> issues
1071 a warning if the commit log message given to it does not look
1072 like a valid UTF-8 string, unless you explicitly say your
1073 project uses a legacy encoding. The way to say this is to
1074 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
1075 </p>
1076 <div class="listingblock">
1077 <div class="content">
1078 <pre><tt>[i18n]
1079 commitencoding = ISO-8859-1</tt></pre>
1080 </div></div>
1081 <div class="paragraph"><p>Commit objects created with the above setting record the value
1082 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
1083 help other people who look at them later. Lack of this header
1084 implies that the commit log message is encoded in UTF-8.</p></div>
1085 </li>
1086 <li>
1088 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
1089 <tt>encoding</tt> header of a commit object, and try to re-code the
1090 log message into UTF-8 unless otherwise specified. You can
1091 specify the desired output encoding with
1092 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
1093 </p>
1094 <div class="listingblock">
1095 <div class="content">
1096 <pre><tt>[i18n]
1097 logoutputencoding = ISO-8859-1</tt></pre>
1098 </div></div>
1099 <div class="paragraph"><p>If you do not have this configuration variable, the value of
1100 <tt>i18n.commitencoding</tt> is used instead.</p></div>
1101 </li>
1102 </ol></div>
1103 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
1104 message when a commit is made to force UTF-8 at the commit
1105 object level, because re-coding to UTF-8 is not necessarily a
1106 reversible operation.</p></div>
1107 </div>
1108 <h2 id="_git">GIT</h2>
1109 <div class="sectionbody">
1110 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1111 </div>
1112 <div id="footer">
1113 <div id="footer-text">
1114 Last updated 2011-08-05 00:04:52 UTC
1115 </div>
1116 </div>
1117 </body>
1118 </html>