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">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.2.5" />
7 <style type=
"text/css">
9 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
11 border: 1px solid red;
16 margin: 1em 5% 1em 5%;
21 text-decoration: underline
;
39 h1
, h2
, h3
, h4
, h5
, h6
{
41 font-family: sans-serif
;
48 border-bottom: 2px solid silver
;
66 border: 1px solid silver
;
81 font-family: sans-serif
;
88 font-family: sans-serif
;
92 font-family: sans-serif
;
94 border-top: 2px solid silver
;
100 padding-bottom: 0.5em;
104 padding-bottom: 0.5em;
108 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
109 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
110 div
.admonitionblock
{
113 margin-bottom: 1.5em;
115 div
.admonitionblock
{
117 margin-bottom: 2.5em;
120 div
.content
{ /* Block element content. */
124 /* Block element titles. */
125 div
.title
, caption
.title
{
126 font-family: sans-serif
;
130 margin-bottom: 0.5em;
136 td div
.title:first-child
{
139 div
.content div
.title:first-child
{
142 div
.content
+ div
.title
{
146 div
.sidebarblock
> div
.content
{
148 border: 1px solid silver
;
155 div
.listingblock
> div
.content
{
156 border: 1px solid silver
;
161 div
.quoteblock
> div
.content
{
168 div
.verseblock
+ div
.attribution
{
172 div
.admonitionblock
.icon
{
176 text-decoration: underline
;
178 padding-right: 0.5em;
180 div
.admonitionblock td
.content
{
182 border-left: 2px solid silver
;
185 div
.exampleblock
> div
.content
{
186 border-left: 2px solid silver
;
190 div
.verseblock div
.content
{
194 div
.imageblock div
.content
{ padding-left: 0; }
195 div
.imageblock img
{ border: 1px solid silver
; }
196 span
.image img
{ border-style: none
; }
200 margin-bottom: 0.8em;
212 list-style-position: outside
;
215 list-style-type: lower-alpha
;
218 div
.tableblock
> table
{
219 border: 3px solid
#527bbd;
222 font-family: sans-serif
;
231 margin-bottom: 0.8em;
239 padding-right: 0.8em;
246 div#footer-badges
{ display: none
; }
251 font-family: sans-serif
;
255 margin-bottom: 0.1em;
258 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
274 include1::./stylesheets
/xhtml11-manpage
.css
[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div
.sidebar-content
{
279 border: 1px solid silver
;
282 div
.sidebar-title
, div
.image-title
{
283 font-family: sans-serif
;
286 margin-bottom: 0.5em;
289 div
.listingblock div
.content
{
290 border: 1px solid silver
;
295 div
.quoteblock-content
{
299 div
.exampleblock-content
{
300 border-left: 2px solid silver
;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc
a:visited
{ color: blue
; }
307 <title>git-show(
1)
</title>
312 git-show(
1) Manual Page
315 <div class=
"sectionbody">
317 Show various types of objects
322 <div class=
"sectionbody">
323 <div class=
"para"><p><em>git show
</em> [options]
<object
>…</p></div>
325 <h2 id=
"_description">DESCRIPTION
</h2>
326 <div class=
"sectionbody">
327 <div class=
"para"><p>Shows one or more objects (blobs, trees, tags and commits).
</p></div>
328 <div class=
"para"><p>For commits it shows the log message and textual diff. It also
329 presents the merge commit in a special format as produced by
330 <em>git-diff-tree --cc
</em>.
</p></div>
331 <div class=
"para"><p>For tags, it shows the tag message and the referenced objects.
</p></div>
332 <div class=
"para"><p>For trees, it shows the names (equivalent to
<em>git-ls-tree
</em>
333 with --name-only).
</p></div>
334 <div class=
"para"><p>For plain blobs, it shows the plain contents.
</p></div>
335 <div class=
"para"><p>The command takes options applicable to the
<em>git-diff-tree
</em> command to
336 control how the changes the commit introduces are shown.
</p></div>
337 <div class=
"para"><p>This manual page describes only the most frequently used options.
</p></div>
339 <h2 id=
"_options">OPTIONS
</h2>
340 <div class=
"sectionbody">
341 <div class=
"vlist"><dl>
343 <object
>…
347 The names of objects to show.
348 For a more complete list of ways to spell object names, see
349 "SPECIFYING REVISIONS" section in
<a href=
"git-rev-parse.html">git-rev-parse(
1)
</a>.
353 --pretty[=
<em><format
></em>]
356 --format[=
<em><format
></em>]
360 Pretty-print the contents of the commit logs in a given format,
361 where
<em><format
></em> can be one of
<em>oneline
</em>,
<em>short
</em>,
<em>medium
</em>,
362 <em>full
</em>,
<em>fuller
</em>,
<em>email
</em>,
<em>raw
</em> and
<em>format:
<string
></em>.
363 When omitted, the format defaults to
<em>medium
</em>.
365 <div class=
"para"><p>Note: you can specify the default pretty format in the repository
366 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
373 Instead of showing the full
40-byte hexadecimal commit object
374 name, show only a partial prefix. Non default number of
375 digits can be specified with
"--abbrev=<n>" (which also modifies
376 diff output, if it is displayed).
378 <div class=
"para"><p>This should make
"--pretty=oneline" a whole lot more readable for
379 people using
80-column terminals.
</p></div>
386 This is a shorthand for
"--pretty=oneline --abbrev-commit"
391 --encoding[=
<encoding
>]
395 The commit objects record the encoding used for the log message
396 in their encoding header; this option can be used to tell the
397 command to re-code the commit log message in the encoding
398 preferred by the user. For non plumbing commands this
404 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
405 <div class=
"sectionbody">
406 <div class=
"para"><p>If the commit is a merge, and if the pretty-format
407 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
408 inserted before the
<em>Author:
</em> line. This line begins with
409 "Merge: " and the sha1s of ancestral commits are printed,
410 separated by spaces. Note that the listed commits may not
411 necessarily be the list of the
<strong>direct
</strong> parent commits if you
412 have limited your view of history: for example, if you are
413 only interested in changes related to a certain directory or
415 <div class=
"para"><p>Here are some additional details for each format:
</p></div>
416 <div class=
"ilist"><ul>
421 <div class=
"literalblock">
422 <div class=
"content">
423 <pre><tt><sha1
> <title line
></tt></pre>
425 <div class=
"para"><p>This is designed to be as compact as possible.
</p></div>
431 <div class=
"literalblock">
432 <div class=
"content">
433 <pre><tt>commit
<sha1
>
434 Author:
<author
></tt></pre>
436 <div class=
"literalblock">
437 <div class=
"content">
438 <pre><tt><title line
></tt></pre>
445 <div class=
"literalblock">
446 <div class=
"content">
447 <pre><tt>commit
<sha1
>
448 Author:
<author
>
449 Date:
<author date
></tt></pre>
451 <div class=
"literalblock">
452 <div class=
"content">
453 <pre><tt><title line
></tt></pre>
455 <div class=
"literalblock">
456 <div class=
"content">
457 <pre><tt><full commit message
></tt></pre>
464 <div class=
"literalblock">
465 <div class=
"content">
466 <pre><tt>commit
<sha1
>
467 Author:
<author
>
468 Commit:
<committer
></tt></pre>
470 <div class=
"literalblock">
471 <div class=
"content">
472 <pre><tt><title line
></tt></pre>
474 <div class=
"literalblock">
475 <div class=
"content">
476 <pre><tt><full commit message
></tt></pre>
483 <div class=
"literalblock">
484 <div class=
"content">
485 <pre><tt>commit
<sha1
>
486 Author:
<author
>
487 AuthorDate:
<author date
>
488 Commit:
<committer
>
489 CommitDate:
<committer date
></tt></pre>
491 <div class=
"literalblock">
492 <div class=
"content">
493 <pre><tt><title line
></tt></pre>
495 <div class=
"literalblock">
496 <div class=
"content">
497 <pre><tt><full commit message
></tt></pre>
504 <div class=
"literalblock">
505 <div class=
"content">
506 <pre><tt>From
<sha1
> <date
>
508 Date:
<author date
>
509 Subject: [PATCH]
<title line
></tt></pre>
511 <div class=
"literalblock">
512 <div class=
"content">
513 <pre><tt><full commit message
></tt></pre>
520 <div class=
"para"><p>The
<em>raw
</em> format shows the entire commit exactly as
521 stored in the commit object. Notably, the SHA1s are
522 displayed in full, regardless of whether --abbrev or
523 --no-abbrev are used, and
<em>parents
</em> information show the
524 true parent commits, without taking grafts nor history
525 simplification into account.
</p></div>
531 <div class=
"para"><p>The
<em>format:
</em> format allows you to specify which information
532 you want to show. It works a little bit like printf format,
533 with the notable exception that you get a newline with
<em>%n
</em>
534 instead of
<em>\n
</em>.
</p></div>
535 <div class=
"para"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
536 would show something like this:
</p></div>
537 <div class=
"listingblock">
538 <div class=
"content">
539 <pre><tt>The author of fe6e0ee was Junio C Hamano,
23 hours ago
540 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<
543 <div class=
"para"><p>The placeholders are:
</p></div>
544 <div class=
"ilist"><ul>
547 <em>%H
</em>: commit hash
552 <em>%h
</em>: abbreviated commit hash
557 <em>%T
</em>: tree hash
562 <em>%t
</em>: abbreviated tree hash
567 <em>%P
</em>: parent hashes
572 <em>%p
</em>: abbreviated parent hashes
577 <em>%an
</em>: author name
582 <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>)
587 <em>%ae
</em>: author email
592 <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>)
597 <em>%ad
</em>: author date (format respects --date= option)
602 <em>%aD
</em>: author date, RFC2822 style
607 <em>%ar
</em>: author date, relative
612 <em>%at
</em>: author date, UNIX timestamp
617 <em>%ai
</em>: author date, ISO
8601 format
622 <em>%cn
</em>: committer name
627 <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>)
632 <em>%ce
</em>: committer email
637 <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>)
642 <em>%cd
</em>: committer date
647 <em>%cD
</em>: committer date, RFC2822 style
652 <em>%cr
</em>: committer date, relative
657 <em>%ct
</em>: committer date, UNIX timestamp
662 <em>%ci
</em>: committer date, ISO
8601 format
667 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
672 <em>%e
</em>: encoding
682 <em>%f
</em>: sanitized subject line, suitable for a filename
692 <em>%Cred
</em>: switch color to red
697 <em>%Cgreen
</em>: switch color to green
702 <em>%Cblue
</em>: switch color to blue
707 <em>%Creset
</em>: reset color
712 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
717 <em>%m
</em>: left, right or boundary mark
727 <em>%x00
</em>: print a byte from a hex code
736 <div class=
"para"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
737 provides
"terminator" semantics instead of
"separator" semantics. In
738 other words, each commit has the message terminator character (usually a
739 newline) appended, rather than a separator placed between entries.
740 This means that the final entry of a single-line format will be properly
741 terminated with a new line, just as the
"oneline" format does.
742 For example:
</p></div>
743 <div class=
"listingblock">
744 <div class=
"content">
745 <pre><tt>$ git log -
2 --pretty=format:%h
4da45bef \
746 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
748 7134973 -- NO NEWLINE
750 $ git log -
2 --pretty=tformat:%h
4da45bef \
751 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
755 <div class=
"para"><p>In addition, any unrecognized string that has a
<tt>%
</tt> in it is interpreted
756 as if it has
<tt>tformat:
</tt> in front of it. For example, these two are
757 equivalent:
</p></div>
758 <div class=
"listingblock">
759 <div class=
"content">
760 <pre><tt>$ git log -
2 --pretty=tformat:%h
4da45bef
761 $ git log -
2 --pretty=%h
4da45bef
</tt></pre>
766 <h2 id=
"_examples">EXAMPLES
</h2>
767 <div class=
"sectionbody">
768 <div class=
"vlist"><dl>
774 Shows the tag
<tt>v1.0
.0</tt>, along with the object the tags
779 git show v1.0
.0^{tree}
783 Shows the tree pointed to by the tag
<tt>v1.0
.0</tt>.
787 git show next~
10:Documentation/README
791 Shows the contents of the file
<tt>Documentation/README
</tt> as
792 they were current in the
10th last commit of the branch
797 git show master:Makefile master:t/Makefile
801 Concatenates the contents of said Makefiles in the head
802 of the branch
<tt>master
</tt>.
807 <h2 id=
"_discussion">Discussion
</h2>
808 <div class=
"sectionbody">
809 <div class=
"para"><p>At the core level, git is character encoding agnostic.
</p></div>
810 <div class=
"ilist"><ul>
813 The pathnames recorded in the index and in the tree objects
814 are treated as uninterpreted sequences of non-NUL bytes.
815 What readdir(
2) returns are what are recorded and compared
816 with the data git keeps track of, which in turn are expected
817 to be what lstat(
2) and creat(
2) accepts. There is no such
818 thing as pathname encoding translation.
823 The contents of the blob objects are uninterpreted sequences
824 of bytes. There is no encoding translation at the core
830 The commit log messages are uninterpreted sequences of non-NUL
835 <div class=
"para"><p>Although we encourage that the commit log messages are encoded
836 in UTF-
8, both the core and git Porcelain are designed not to
837 force UTF-
8 on projects. If all participants of a particular
838 project find it more convenient to use legacy encodings, git
839 does not forbid it. However, there are a few things to keep in
841 <div class=
"olist"><ol>
844 <em>git-commit
</em> and
<em>git-commit-tree
</em> issues
845 a warning if the commit log message given to it does not look
846 like a valid UTF-
8 string, unless you explicitly say your
847 project uses a legacy encoding. The way to say this is to
848 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
850 <div class=
"listingblock">
851 <div class=
"content">
853 commitencoding = ISO-
8859-
1</tt></pre>
855 <div class=
"para"><p>Commit objects created with the above setting record the value
856 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
857 help other people who look at them later. Lack of this header
858 implies that the commit log message is encoded in UTF-
8.
</p></div>
862 <em>git-log
</em>,
<em>git-show
</em>,
<em>git-blame
</em> and friends look at the
863 <tt>encoding
</tt> header of a commit object, and try to re-code the
864 log message into UTF-
8 unless otherwise specified. You can
865 specify the desired output encoding with
866 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
868 <div class=
"listingblock">
869 <div class=
"content">
871 logoutputencoding = ISO-
8859-
1</tt></pre>
873 <div class=
"para"><p>If you do not have this configuration variable, the value of
874 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
877 <div class=
"para"><p>Note that we deliberately chose not to re-code the commit log
878 message when a commit is made to force UTF-
8 at the commit
879 object level, because re-coding to UTF-
8 is not necessarily a
880 reversible operation.
</p></div>
882 <h2 id=
"_author">Author
</h2>
883 <div class=
"sectionbody">
884 <div class=
"para"><p>Written by Linus Torvalds
<torvalds@osdl.org
> and
885 Junio C Hamano
<gitster@pobox.com
>. Significantly enhanced by
886 Johannes Schindelin
<Johannes.Schindelin@gmx.de
>.
</p></div>
888 <h2 id=
"_documentation">Documentation
</h2>
889 <div class=
"sectionbody">
890 <div class=
"para"><p>Documentation by David Greaves, Petr Baudis and the git-list
<git@vger.kernel.org
>.
</p></div>
892 <h2 id=
"_git">GIT
</h2>
893 <div class=
"sectionbody">
894 <div class=
"para"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
897 <div id=
"footer-text">
898 Last updated
2009-
04-
06 08:
26:
31 UTC