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.4.5" />
7 <title>git-show(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.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
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
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
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
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
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-show(
1) Manual Page
409 <div class=
"sectionbody">
411 Show various types of objects
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"paragraph"><p><em>git show
</em> [options]
<object
>…</p></div>
419 <h2 id=
"_description">DESCRIPTION
</h2>
420 <div class=
"sectionbody">
421 <div class=
"paragraph"><p>Shows one or more objects (blobs, trees, tags and commits).
</p></div>
422 <div class=
"paragraph"><p>For commits it shows the log message and textual diff. It also
423 presents the merge commit in a special format as produced by
424 <em>git diff-tree --cc
</em>.
</p></div>
425 <div class=
"paragraph"><p>For tags, it shows the tag message and the referenced objects.
</p></div>
426 <div class=
"paragraph"><p>For trees, it shows the names (equivalent to
<em>git ls-tree
</em>
427 with --name-only).
</p></div>
428 <div class=
"paragraph"><p>For plain blobs, it shows the plain contents.
</p></div>
429 <div class=
"paragraph"><p>The command takes options applicable to the
<em>git diff-tree
</em> command to
430 control how the changes the commit introduces are shown.
</p></div>
431 <div class=
"paragraph"><p>This manual page describes only the most frequently used options.
</p></div>
433 <h2 id=
"_options">OPTIONS
</h2>
434 <div class=
"sectionbody">
435 <div class=
"dlist"><dl>
437 <object
>…
441 The names of objects to show.
442 For a more complete list of ways to spell object names, see
443 "SPECIFYING REVISIONS" section in
<a href=
"gitrevisions.html">gitrevisions(
7)
</a>.
447 --pretty[=
<format
>]
450 --format=
<format
>
454 Pretty-print the contents of the commit logs in a given format,
455 where
<em><format
></em> can be one of
<em>oneline
</em>,
<em>short
</em>,
<em>medium
</em>,
456 <em>full
</em>,
<em>fuller
</em>,
<em>email
</em>,
<em>raw
</em> and
<em>format:
<string
></em>. See
457 the
"PRETTY FORMATS" section for some additional details for each
458 format. When omitted, the format defaults to
<em>medium
</em>.
460 <div class=
"paragraph"><p>Note: you can specify the default pretty format in the repository
461 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
468 Instead of showing the full
40-byte hexadecimal commit object
469 name, show only a partial prefix. Non default number of
470 digits can be specified with
"--abbrev=<n>" (which also modifies
471 diff output, if it is displayed).
473 <div class=
"paragraph"><p>This should make
"--pretty=oneline" a whole lot more readable for
474 people using
80-column terminals.
</p></div>
481 Show the full
40-byte hexadecimal commit object name. This negates
482 <tt>--abbrev-commit
</tt> and those options which imply it such as
483 "--oneline". It also overrides the
<em>log.abbrevCommit
</em> variable.
491 This is a shorthand for
"--pretty=oneline --abbrev-commit"
496 --encoding[=
<encoding
>]
500 The commit objects record the encoding used for the log message
501 in their encoding header; this option can be used to tell the
502 command to re-code the commit log message in the encoding
503 preferred by the user. For non plumbing commands this
508 --notes[=
<ref
>]
512 Show the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) that annotate the
513 commit, when showing the commit log message. This is the default
514 for
<tt>git log
</tt>,
<tt>git show
</tt> and
<tt>git whatchanged
</tt> commands when
515 there is no
<tt>--pretty
</tt>,
<tt>--format
</tt> nor
<tt>--oneline
</tt> option given
518 <div class=
"paragraph"><p>By default, the notes shown are from the notes refs listed in the
519 <em>core.notesRef
</em> and
<em>notes.displayRef
</em> variables (or corresponding
520 environment overrides). See
<a href=
"git-config.html">git-config(
1)
</a> for more details.
</p></div>
521 <div class=
"paragraph"><p>With an optional
<em><ref
></em> argument, show this notes ref instead of the
522 default notes ref(s). The ref is taken to be in
<tt>refs/notes/
</tt> if it
523 is not qualified.
</p></div>
524 <div class=
"paragraph"><p>Multiple --notes options can be combined to control which notes are
525 being displayed. Examples:
"--notes=foo" will show only notes from
526 "refs/notes/foo";
"--notes=foo --notes" will show both notes from
527 "refs/notes/foo" and from the default notes ref(s).
</p></div>
534 Do not show notes. This negates the above
<tt>--notes
</tt> option, by
535 resetting the list of notes refs from which notes are shown.
536 Options are parsed in the order given on the command line, so e.g.
537 "--notes --notes=foo --no-notes --notes=bar" will only show notes
538 from
"refs/notes/bar".
542 --show-notes[=
<ref
>]
545 --[no-]standard-notes
549 These options are deprecated. Use the above --notes/--no-notes
555 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
556 <div class=
"sectionbody">
557 <div class=
"paragraph"><p>If the commit is a merge, and if the pretty-format
558 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
559 inserted before the
<em>Author:
</em> line. This line begins with
560 "Merge: " and the sha1s of ancestral commits are printed,
561 separated by spaces. Note that the listed commits may not
562 necessarily be the list of the
<strong>direct
</strong> parent commits if you
563 have limited your view of history: for example, if you are
564 only interested in changes related to a certain directory or
566 <div class=
"paragraph"><p>There are several built-in formats, and you can define
567 additional formats by setting a pretty.
<name
>
568 config option to either another format name, or a
569 <em>format:
</em> string, as described below (see
570 <a href=
"git-config.html">git-config(
1)
</a>). Here are the details of the
571 built-in formats:
</p></div>
572 <div class=
"ulist"><ul>
577 <div class=
"literalblock">
578 <div class=
"content">
579 <pre><tt><sha1
> <title line
></tt></pre>
581 <div class=
"paragraph"><p>This is designed to be as compact as possible.
</p></div>
587 <div class=
"literalblock">
588 <div class=
"content">
589 <pre><tt>commit
<sha1
>
590 Author:
<author
></tt></pre>
592 <div class=
"literalblock">
593 <div class=
"content">
594 <pre><tt><title line
></tt></pre>
601 <div class=
"literalblock">
602 <div class=
"content">
603 <pre><tt>commit
<sha1
>
604 Author:
<author
>
605 Date:
<author date
></tt></pre>
607 <div class=
"literalblock">
608 <div class=
"content">
609 <pre><tt><title line
></tt></pre>
611 <div class=
"literalblock">
612 <div class=
"content">
613 <pre><tt><full commit message
></tt></pre>
620 <div class=
"literalblock">
621 <div class=
"content">
622 <pre><tt>commit
<sha1
>
623 Author:
<author
>
624 Commit:
<committer
></tt></pre>
626 <div class=
"literalblock">
627 <div class=
"content">
628 <pre><tt><title line
></tt></pre>
630 <div class=
"literalblock">
631 <div class=
"content">
632 <pre><tt><full commit message
></tt></pre>
639 <div class=
"literalblock">
640 <div class=
"content">
641 <pre><tt>commit
<sha1
>
642 Author:
<author
>
643 AuthorDate:
<author date
>
644 Commit:
<committer
>
645 CommitDate:
<committer date
></tt></pre>
647 <div class=
"literalblock">
648 <div class=
"content">
649 <pre><tt><title line
></tt></pre>
651 <div class=
"literalblock">
652 <div class=
"content">
653 <pre><tt><full commit message
></tt></pre>
660 <div class=
"literalblock">
661 <div class=
"content">
662 <pre><tt>From
<sha1
> <date
>
664 Date:
<author date
>
665 Subject: [PATCH]
<title line
></tt></pre>
667 <div class=
"literalblock">
668 <div class=
"content">
669 <pre><tt><full commit message
></tt></pre>
676 <div class=
"paragraph"><p>The
<em>raw
</em> format shows the entire commit exactly as
677 stored in the commit object. Notably, the SHA1s are
678 displayed in full, regardless of whether --abbrev or
679 --no-abbrev are used, and
<em>parents
</em> information show the
680 true parent commits, without taking grafts nor history
681 simplification into account.
</p></div>
685 <em>format:
<string
></em>
687 <div class=
"paragraph"><p>The
<em>format:
<string
></em> format allows you to specify which information
688 you want to show. It works a little bit like printf format,
689 with the notable exception that you get a newline with
<em>%n
</em>
690 instead of
<em>\n
</em>.
</p></div>
691 <div class=
"paragraph"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
692 would show something like this:
</p></div>
693 <div class=
"listingblock">
694 <div class=
"content">
695 <pre><tt>The author of fe6e0ee was Junio C Hamano,
23 hours ago
696 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<</tt></pre>
698 <div class=
"paragraph"><p>The placeholders are:
</p></div>
699 <div class=
"ulist"><ul>
702 <em>%H
</em>: commit hash
707 <em>%h
</em>: abbreviated commit hash
712 <em>%T
</em>: tree hash
717 <em>%t
</em>: abbreviated tree hash
722 <em>%P
</em>: parent hashes
727 <em>%p
</em>: abbreviated parent hashes
732 <em>%an
</em>: author name
737 <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>)
742 <em>%ae
</em>: author email
747 <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>)
752 <em>%ad
</em>: author date (format respects --date= option)
757 <em>%aD
</em>: author date, RFC2822 style
762 <em>%ar
</em>: author date, relative
767 <em>%at
</em>: author date, UNIX timestamp
772 <em>%ai
</em>: author date, ISO
8601 format
777 <em>%cn
</em>: committer name
782 <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>)
787 <em>%ce
</em>: committer email
792 <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>)
797 <em>%cd
</em>: committer date
802 <em>%cD
</em>: committer date, RFC2822 style
807 <em>%cr
</em>: committer date, relative
812 <em>%ct
</em>: committer date, UNIX timestamp
817 <em>%ci
</em>: committer date, ISO
8601 format
822 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
827 <em>%e
</em>: encoding
837 <em>%f
</em>: sanitized subject line, suitable for a filename
847 <em>%B
</em>: raw body (unwrapped subject and body)
852 <em>%N
</em>: commit notes
857 <em>%gD
</em>: reflog selector, e.g.,
<tt>refs/stash@{
1}
</tt>
862 <em>%gd
</em>: shortened reflog selector, e.g.,
<tt>stash@{
1}
</tt>
867 <em>%gs
</em>: reflog subject
872 <em>%Cred
</em>: switch color to red
877 <em>%Cgreen
</em>: switch color to green
882 <em>%Cblue
</em>: switch color to blue
887 <em>%Creset
</em>: reset color
892 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
897 <em>%m
</em>: left, right or boundary mark
907 <em>%%
</em>: a raw
<em>%
</em>
912 <em>%x00
</em>: print a byte from a hex code
917 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>: switch line wrapping, like the -w option of
918 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
924 <div class=
"admonitionblock">
927 <div class=
"title">Note
</div>
929 <td class=
"content">Some placeholders may depend on other options given to the
930 revision traversal engine. For example, the
<tt>%g*
</tt> reflog options will
931 insert an empty string unless we are traversing reflog entries (e.g., by
932 <tt>git log -g
</tt>). The
<tt>%d
</tt> placeholder will use the
"short" decoration
933 format if
<tt>--decorate
</tt> was not already provided on the command line.
</td>
936 <div class=
"paragraph"><p>If you add a
<tt>+</tt> (plus sign) after
<em>%
</em> of a placeholder, a line-feed
937 is inserted immediately before the expansion if and only if the
938 placeholder expands to a non-empty string.
</p></div>
939 <div class=
"paragraph"><p>If you add a
<tt>-
</tt> (minus sign) after
<em>%
</em> of a placeholder, line-feeds that
940 immediately precede the expansion are deleted if and only if the
941 placeholder expands to an empty string.
</p></div>
942 <div class=
"paragraph"><p>If you add a ` ` (space) after
<em>%
</em> of a placeholder, a space
943 is inserted immediately before the expansion if and only if the
944 placeholder expands to a non-empty string.
</p></div>
945 <div class=
"ulist"><ul>
950 <div class=
"paragraph"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
951 provides
"terminator" semantics instead of
"separator" semantics. In
952 other words, each commit has the message terminator character (usually a
953 newline) appended, rather than a separator placed between entries.
954 This means that the final entry of a single-line format will be properly
955 terminated with a new line, just as the
"oneline" format does.
956 For example:
</p></div>
957 <div class=
"listingblock">
958 <div class=
"content">
959 <pre><tt>$ git log -
2 --pretty=format:%h
4da45bef \
960 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
962 7134973 -- NO NEWLINE
964 $ git log -
2 --pretty=tformat:%h
4da45bef \
965 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
969 <div class=
"paragraph"><p>In addition, any unrecognized string that has a
<tt>%
</tt> in it is interpreted
970 as if it has
<tt>tformat:
</tt> in front of it. For example, these two are
971 equivalent:
</p></div>
972 <div class=
"listingblock">
973 <div class=
"content">
974 <pre><tt>$ git log -
2 --pretty=tformat:%h
4da45bef
975 $ git log -
2 --pretty=%h
4da45bef
</tt></pre>
980 <h2 id=
"_examples">EXAMPLES
</h2>
981 <div class=
"sectionbody">
982 <div class=
"dlist"><dl>
988 Shows the tag
<tt>v1.0
.0</tt>, along with the object the tags
993 git show v1.0
.0^{tree}
997 Shows the tree pointed to by the tag
<tt>v1.0
.0</tt>.
1000 <dt class=
"hdlist1">
1001 git show -s --format=%s v1.0
.0^{commit}
1005 Shows the subject of the commit pointed to by the
1006 tag
<tt>v1.0
.0</tt>.
1009 <dt class=
"hdlist1">
1010 git show next~
10:Documentation/README
1014 Shows the contents of the file
<tt>Documentation/README
</tt> as
1015 they were current in the
10th last commit of the branch
1019 <dt class=
"hdlist1">
1020 git show master:Makefile master:t/Makefile
1024 Concatenates the contents of said Makefiles in the head
1025 of the branch
<tt>master
</tt>.
1030 <h2 id=
"_discussion">Discussion
</h2>
1031 <div class=
"sectionbody">
1032 <div class=
"paragraph"><p>At the core level, git is character encoding agnostic.
</p></div>
1033 <div class=
"ulist"><ul>
1036 The pathnames recorded in the index and in the tree objects
1037 are treated as uninterpreted sequences of non-NUL bytes.
1038 What readdir(
2) returns are what are recorded and compared
1039 with the data git keeps track of, which in turn are expected
1040 to be what lstat(
2) and creat(
2) accepts. There is no such
1041 thing as pathname encoding translation.
1046 The contents of the blob objects are uninterpreted sequences
1047 of bytes. There is no encoding translation at the core
1053 The commit log messages are uninterpreted sequences of non-NUL
1058 <div class=
"paragraph"><p>Although we encourage that the commit log messages are encoded
1059 in UTF-
8, both the core and git Porcelain are designed not to
1060 force UTF-
8 on projects. If all participants of a particular
1061 project find it more convenient to use legacy encodings, git
1062 does not forbid it. However, there are a few things to keep in
1064 <div class=
"olist arabic"><ol class=
"arabic">
1067 <em>git commit
</em> and
<em>git commit-tree
</em> issues
1068 a warning if the commit log message given to it does not look
1069 like a valid UTF-
8 string, unless you explicitly say your
1070 project uses a legacy encoding. The way to say this is to
1071 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
1073 <div class=
"listingblock">
1074 <div class=
"content">
1076 commitencoding = ISO-
8859-
1</tt></pre>
1078 <div class=
"paragraph"><p>Commit objects created with the above setting record the value
1079 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
1080 help other people who look at them later. Lack of this header
1081 implies that the commit log message is encoded in UTF-
8.
</p></div>
1085 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
1086 <tt>encoding
</tt> header of a commit object, and try to re-code the
1087 log message into UTF-
8 unless otherwise specified. You can
1088 specify the desired output encoding with
1089 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
1091 <div class=
"listingblock">
1092 <div class=
"content">
1094 logoutputencoding = ISO-
8859-
1</tt></pre>
1096 <div class=
"paragraph"><p>If you do not have this configuration variable, the value of
1097 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
1100 <div class=
"paragraph"><p>Note that we deliberately chose not to re-code the commit log
1101 message when a commit is made to force UTF-
8 at the commit
1102 object level, because re-coding to UTF-
8 is not necessarily a
1103 reversible operation.
</p></div>
1105 <h2 id=
"_git">GIT
</h2>
1106 <div class=
"sectionbody">
1107 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1110 <div id=
"footer-text">
1111 Last updated
2011-
03-
15 23:
30:
14 UTC