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=
"gitrevisions.html">gitrevisions(
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>. See
363 the
"PRETTY FORMATS" section for some additional details for each
364 format. When omitted, the format defaults to
<em>medium
</em>.
366 <div class=
"para"><p>Note: you can specify the default pretty format in the repository
367 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
374 Instead of showing the full
40-byte hexadecimal commit object
375 name, show only a partial prefix. Non default number of
376 digits can be specified with
"--abbrev=<n>" (which also modifies
377 diff output, if it is displayed).
379 <div class=
"para"><p>This should make
"--pretty=oneline" a whole lot more readable for
380 people using
80-column terminals.
</p></div>
387 This is a shorthand for
"--pretty=oneline --abbrev-commit"
392 --encoding[=
<encoding
>]
396 The commit objects record the encoding used for the log message
397 in their encoding header; this option can be used to tell the
398 command to re-code the commit log message in the encoding
399 preferred by the user. For non plumbing commands this
407 --show-notes[=
<ref
>]
411 Show the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) that annotate the
412 commit, when showing the commit log message. This is the default
413 for
<tt>git log
</tt>,
<tt>git show
</tt> and
<tt>git whatchanged
</tt> commands when
414 there is no
<tt>--pretty
</tt>,
<tt>--format
</tt> nor
<tt>--oneline
</tt> option is
415 given on the command line.
417 <div class=
"para"><p>With an optional argument, add this ref to the list of notes. The ref
418 is taken to be in
<tt>refs/notes/
</tt> if it is not qualified.
</p></div>
421 --[no-]standard-notes
425 Enable or disable populating the notes ref list from the
426 <em>core.notesRef
</em> and
<em>notes.displayRef
</em> variables (or
427 corresponding environment overrides). Enabled by default.
428 See
<a href=
"git-config.html">git-config(
1)
</a>.
433 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
434 <div class=
"sectionbody">
435 <div class=
"para"><p>If the commit is a merge, and if the pretty-format
436 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
437 inserted before the
<em>Author:
</em> line. This line begins with
438 "Merge: " and the sha1s of ancestral commits are printed,
439 separated by spaces. Note that the listed commits may not
440 necessarily be the list of the
<strong>direct
</strong> parent commits if you
441 have limited your view of history: for example, if you are
442 only interested in changes related to a certain directory or
444 <div class=
"para"><p>There are several built-in formats, and you can define
445 additional formats by setting a pretty.
<name
>
446 config option to either another format name, or a
447 <em>format:
</em> string, as described below (see
448 <a href=
"git-config.html">git-config(
1)
</a>). Here are the details of the
449 built-in formats:
</p></div>
450 <div class=
"ilist"><ul>
455 <div class=
"literalblock">
456 <div class=
"content">
457 <pre><tt><sha1
> <title line
></tt></pre>
459 <div class=
"para"><p>This is designed to be as compact as possible.
</p></div>
465 <div class=
"literalblock">
466 <div class=
"content">
467 <pre><tt>commit
<sha1
>
468 Author:
<author
></tt></pre>
470 <div class=
"literalblock">
471 <div class=
"content">
472 <pre><tt><title line
></tt></pre>
479 <div class=
"literalblock">
480 <div class=
"content">
481 <pre><tt>commit
<sha1
>
482 Author:
<author
>
483 Date:
<author date
></tt></pre>
485 <div class=
"literalblock">
486 <div class=
"content">
487 <pre><tt><title line
></tt></pre>
489 <div class=
"literalblock">
490 <div class=
"content">
491 <pre><tt><full commit message
></tt></pre>
498 <div class=
"literalblock">
499 <div class=
"content">
500 <pre><tt>commit
<sha1
>
501 Author:
<author
>
502 Commit:
<committer
></tt></pre>
504 <div class=
"literalblock">
505 <div class=
"content">
506 <pre><tt><title line
></tt></pre>
508 <div class=
"literalblock">
509 <div class=
"content">
510 <pre><tt><full commit message
></tt></pre>
517 <div class=
"literalblock">
518 <div class=
"content">
519 <pre><tt>commit
<sha1
>
520 Author:
<author
>
521 AuthorDate:
<author date
>
522 Commit:
<committer
>
523 CommitDate:
<committer date
></tt></pre>
525 <div class=
"literalblock">
526 <div class=
"content">
527 <pre><tt><title line
></tt></pre>
529 <div class=
"literalblock">
530 <div class=
"content">
531 <pre><tt><full commit message
></tt></pre>
538 <div class=
"literalblock">
539 <div class=
"content">
540 <pre><tt>From
<sha1
> <date
>
542 Date:
<author date
>
543 Subject: [PATCH]
<title line
></tt></pre>
545 <div class=
"literalblock">
546 <div class=
"content">
547 <pre><tt><full commit message
></tt></pre>
554 <div class=
"para"><p>The
<em>raw
</em> format shows the entire commit exactly as
555 stored in the commit object. Notably, the SHA1s are
556 displayed in full, regardless of whether --abbrev or
557 --no-abbrev are used, and
<em>parents
</em> information show the
558 true parent commits, without taking grafts nor history
559 simplification into account.
</p></div>
563 <em>format:
<string
></em>
565 <div class=
"para"><p>The
<em>format:
<string
></em> format allows you to specify which information
566 you want to show. It works a little bit like printf format,
567 with the notable exception that you get a newline with
<em>%n
</em>
568 instead of
<em>\n
</em>.
</p></div>
569 <div class=
"para"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
570 would show something like this:
</p></div>
571 <div class=
"listingblock">
572 <div class=
"content">
573 <pre><tt>The author of fe6e0ee was Junio C Hamano,
23 hours ago
574 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<
577 <div class=
"para"><p>The placeholders are:
</p></div>
578 <div class=
"ilist"><ul>
581 <em>%H
</em>: commit hash
586 <em>%h
</em>: abbreviated commit hash
591 <em>%T
</em>: tree hash
596 <em>%t
</em>: abbreviated tree hash
601 <em>%P
</em>: parent hashes
606 <em>%p
</em>: abbreviated parent hashes
611 <em>%an
</em>: author name
616 <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>)
621 <em>%ae
</em>: author email
626 <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>)
631 <em>%ad
</em>: author date (format respects --date= option)
636 <em>%aD
</em>: author date, RFC2822 style
641 <em>%ar
</em>: author date, relative
646 <em>%at
</em>: author date, UNIX timestamp
651 <em>%ai
</em>: author date, ISO
8601 format
656 <em>%cn
</em>: committer name
661 <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>)
666 <em>%ce
</em>: committer email
671 <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>)
676 <em>%cd
</em>: committer date
681 <em>%cD
</em>: committer date, RFC2822 style
686 <em>%cr
</em>: committer date, relative
691 <em>%ct
</em>: committer date, UNIX timestamp
696 <em>%ci
</em>: committer date, ISO
8601 format
701 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
706 <em>%e
</em>: encoding
716 <em>%f
</em>: sanitized subject line, suitable for a filename
726 <em>%B
</em>: raw body (unwrapped subject and body)
731 <em>%N
</em>: commit notes
736 <em>%gD
</em>: reflog selector, e.g.,
<tt>refs/stash@{
1}
</tt>
741 <em>%gd
</em>: shortened reflog selector, e.g.,
<tt>stash@{
1}
</tt>
746 <em>%gs
</em>: reflog subject
751 <em>%Cred
</em>: switch color to red
756 <em>%Cgreen
</em>: switch color to green
761 <em>%Cblue
</em>: switch color to blue
766 <em>%Creset
</em>: reset color
771 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
776 <em>%m
</em>: left, right or boundary mark
786 <em>%%
</em>: a raw
<em>%
</em>
791 <em>%x00
</em>: print a byte from a hex code
796 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>: switch line wrapping, like the -w option of
797 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
803 <div class=
"admonitionblock">
806 <div class=
"title">Note
</div>
808 <td class=
"content">Some placeholders may depend on other options given to the
809 revision traversal engine. For example, the
<tt>%g*
</tt> reflog options will
810 insert an empty string unless we are traversing reflog entries (e.g., by
811 <tt>git log -g
</tt>). The
<tt>%d
</tt> placeholder will use the
"short" decoration
812 format if
<tt>--decorate
</tt> was not already provided on the command line.
</td>
815 <div class=
"para"><p>If you add a
<tt>+</tt> (plus sign) after
<em>%
</em> of a placeholder, a line-feed
816 is inserted immediately before the expansion if and only if the
817 placeholder expands to a non-empty string.
</p></div>
818 <div class=
"para"><p>If you add a
<tt>-
</tt> (minus sign) after
<em>%
</em> of a placeholder, line-feeds that
819 immediately precede the expansion are deleted if and only if the
820 placeholder expands to an empty string.
</p></div>
821 <div class=
"para"><p>If you add a
<tt> </tt> (space) after
<em>%
</em> of a placeholder, a space
822 is inserted immediately before the expansion if and only if the
823 placeholder expands to a non-empty string.
</p></div>
824 <div class=
"ilist"><ul>
829 <div class=
"para"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
830 provides
"terminator" semantics instead of
"separator" semantics. In
831 other words, each commit has the message terminator character (usually a
832 newline) appended, rather than a separator placed between entries.
833 This means that the final entry of a single-line format will be properly
834 terminated with a new line, just as the
"oneline" format does.
835 For example:
</p></div>
836 <div class=
"listingblock">
837 <div class=
"content">
838 <pre><tt>$ git log -
2 --pretty=format:%h
4da45bef \
839 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
841 7134973 -- NO NEWLINE
843 $ git log -
2 --pretty=tformat:%h
4da45bef \
844 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
848 <div class=
"para"><p>In addition, any unrecognized string that has a
<tt>%
</tt> in it is interpreted
849 as if it has
<tt>tformat:
</tt> in front of it. For example, these two are
850 equivalent:
</p></div>
851 <div class=
"listingblock">
852 <div class=
"content">
853 <pre><tt>$ git log -
2 --pretty=tformat:%h
4da45bef
854 $ git log -
2 --pretty=%h
4da45bef
</tt></pre>
859 <h2 id=
"_examples">EXAMPLES
</h2>
860 <div class=
"sectionbody">
861 <div class=
"vlist"><dl>
867 Shows the tag
<tt>v1.0
.0</tt>, along with the object the tags
872 git show v1.0
.0^{tree}
876 Shows the tree pointed to by the tag
<tt>v1.0
.0</tt>.
880 git show next~
10:Documentation/README
884 Shows the contents of the file
<tt>Documentation/README
</tt> as
885 they were current in the
10th last commit of the branch
890 git show master:Makefile master:t/Makefile
894 Concatenates the contents of said Makefiles in the head
895 of the branch
<tt>master
</tt>.
900 <h2 id=
"_discussion">Discussion
</h2>
901 <div class=
"sectionbody">
902 <div class=
"para"><p>At the core level, git is character encoding agnostic.
</p></div>
903 <div class=
"ilist"><ul>
906 The pathnames recorded in the index and in the tree objects
907 are treated as uninterpreted sequences of non-NUL bytes.
908 What readdir(
2) returns are what are recorded and compared
909 with the data git keeps track of, which in turn are expected
910 to be what lstat(
2) and creat(
2) accepts. There is no such
911 thing as pathname encoding translation.
916 The contents of the blob objects are uninterpreted sequences
917 of bytes. There is no encoding translation at the core
923 The commit log messages are uninterpreted sequences of non-NUL
928 <div class=
"para"><p>Although we encourage that the commit log messages are encoded
929 in UTF-
8, both the core and git Porcelain are designed not to
930 force UTF-
8 on projects. If all participants of a particular
931 project find it more convenient to use legacy encodings, git
932 does not forbid it. However, there are a few things to keep in
934 <div class=
"olist"><ol>
937 <em>git commit
</em> and
<em>git commit-tree
</em> issues
938 a warning if the commit log message given to it does not look
939 like a valid UTF-
8 string, unless you explicitly say your
940 project uses a legacy encoding. The way to say this is to
941 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
943 <div class=
"listingblock">
944 <div class=
"content">
946 commitencoding = ISO-
8859-
1</tt></pre>
948 <div class=
"para"><p>Commit objects created with the above setting record the value
949 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
950 help other people who look at them later. Lack of this header
951 implies that the commit log message is encoded in UTF-
8.
</p></div>
955 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
956 <tt>encoding
</tt> header of a commit object, and try to re-code the
957 log message into UTF-
8 unless otherwise specified. You can
958 specify the desired output encoding with
959 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
961 <div class=
"listingblock">
962 <div class=
"content">
964 logoutputencoding = ISO-
8859-
1</tt></pre>
966 <div class=
"para"><p>If you do not have this configuration variable, the value of
967 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
970 <div class=
"para"><p>Note that we deliberately chose not to re-code the commit log
971 message when a commit is made to force UTF-
8 at the commit
972 object level, because re-coding to UTF-
8 is not necessarily a
973 reversible operation.
</p></div>
975 <h2 id=
"_author">Author
</h2>
976 <div class=
"sectionbody">
977 <div class=
"para"><p>Written by Linus Torvalds
<torvalds@osdl.org
> and
978 Junio C Hamano
<gitster@pobox.com
>. Significantly enhanced by
979 Johannes Schindelin
<Johannes.Schindelin@gmx.de
>.
</p></div>
981 <h2 id=
"_documentation">Documentation
</h2>
982 <div class=
"sectionbody">
983 <div class=
"para"><p>Documentation by David Greaves, Petr Baudis and the git-list
<git@vger.kernel.org
>.
</p></div>
985 <h2 id=
"_git">GIT
</h2>
986 <div class=
"sectionbody">
987 <div class=
"para"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
990 <div id=
"footer-text">
991 Last updated
2010-
09-
03 21:
30:
32 UTC