updated git doc
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-show.xml
blob3074a0b24d0445a9a7f9ae7ac18490f78b38a60b
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-show(1)">\r
5 <articleinfo>\r
6     <title>git-show(1)</title>\r
7 <indexterm>\r
8 <primary>git-show(1)</primary>\r
9 </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-show - Show various types of objects</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git show</emphasis> [options] &lt;object&gt;&#8230;</literallayout>\r
19 </blockquote>\r
20 </simplesect>\r
21 <simplesect id="_description">\r
22 <title>DESCRIPTION</title>\r
23 <simpara>Shows one or more objects (blobs, trees, tags and commits).</simpara>\r
24 <simpara>For commits it shows the log message and textual diff. It also\r
25 presents the merge commit in a special format as produced by\r
26 <emphasis>git diff-tree --cc</emphasis>.</simpara>\r
27 <simpara>For tags, it shows the tag message and the referenced objects.</simpara>\r
28 <simpara>For trees, it shows the names (equivalent to <emphasis>git ls-tree</emphasis>\r
29 with --name-only).</simpara>\r
30 <simpara>For plain blobs, it shows the plain contents.</simpara>\r
31 <simpara>The command takes options applicable to the <emphasis>git diff-tree</emphasis> command to\r
32 control how the changes the commit introduces are shown.</simpara>\r
33 <simpara>This manual page describes only the most frequently used options.</simpara>\r
34 </simplesect>\r
35 <simplesect id="_options">\r
36 <title>OPTIONS</title>\r
37 <variablelist>\r
38 <varlistentry>\r
39 <term>\r
40 &lt;object&gt;&#8230;\r
41 </term>\r
42 <listitem>\r
43 <simpara>\r
44         The names of objects to show.\r
45         For a more complete list of ways to spell object names, see\r
46         "SPECIFYING REVISIONS" section in <xref linkend="gitrevisions(7)" />.\r
47 </simpara>\r
48 </listitem>\r
49 </varlistentry>\r
50 <varlistentry>\r
51 <term>\r
52 --pretty[=&lt;format&gt;]\r
53 </term>\r
54 <term>\r
55 --format=&lt;format&gt;\r
56 </term>\r
57 <listitem>\r
58 <simpara>\r
59         Pretty-print the contents of the commit logs in a given format,\r
60         where <emphasis>&lt;format&gt;</emphasis> can be one of <emphasis>oneline</emphasis>, <emphasis>short</emphasis>, <emphasis>medium</emphasis>,\r
61         <emphasis>full</emphasis>, <emphasis>fuller</emphasis>, <emphasis>email</emphasis>, <emphasis>raw</emphasis> and <emphasis>format:&lt;string&gt;</emphasis>.  See\r
62         the "PRETTY FORMATS" section for some additional details for each\r
63         format.  When omitted, the format defaults to <emphasis>medium</emphasis>.\r
64 </simpara>\r
65 <simpara>Note: you can specify the default pretty format in the repository\r
66 configuration (see <xref linkend="git-config(1)" />).</simpara>\r
67 </listitem>\r
68 </varlistentry>\r
69 <varlistentry>\r
70 <term>\r
71 --abbrev-commit\r
72 </term>\r
73 <listitem>\r
74 <simpara>\r
75         Instead of showing the full 40-byte hexadecimal commit object\r
76         name, show only a partial prefix.  Non default number of\r
77         digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies\r
78         diff output, if it is displayed).\r
79 </simpara>\r
80 <simpara>This should make "--pretty=oneline" a whole lot more readable for\r
81 people using 80-column terminals.</simpara>\r
82 </listitem>\r
83 </varlistentry>\r
84 <varlistentry>\r
85 <term>\r
86 --no-abbrev-commit\r
87 </term>\r
88 <listitem>\r
89 <simpara>\r
90         Show the full 40-byte hexadecimal commit object name. This negates\r
91         <emphasis>--abbrev-commit</emphasis> and those options which imply it such as\r
92         "--oneline". It also overrides the <emphasis>log.abbrevCommit</emphasis> variable.\r
93 </simpara>\r
94 </listitem>\r
95 </varlistentry>\r
96 <varlistentry>\r
97 <term>\r
98 --oneline\r
99 </term>\r
100 <listitem>\r
101 <simpara>\r
102         This is a shorthand for "--pretty=oneline --abbrev-commit"\r
103         used together.\r
104 </simpara>\r
105 </listitem>\r
106 </varlistentry>\r
107 <varlistentry>\r
108 <term>\r
109 --encoding[=&lt;encoding&gt;]\r
110 </term>\r
111 <listitem>\r
112 <simpara>\r
113         The commit objects record the encoding used for the log message\r
114         in their encoding header; this option can be used to tell the\r
115         command to re-code the commit log message in the encoding\r
116         preferred by the user.  For non plumbing commands this\r
117         defaults to UTF-8.\r
118 </simpara>\r
119 </listitem>\r
120 </varlistentry>\r
121 <varlistentry>\r
122 <term>\r
123 --notes[=&lt;ref&gt;]\r
124 </term>\r
125 <listitem>\r
126 <simpara>\r
127         Show the notes (see <xref linkend="git-notes(1)" />) that annotate the\r
128         commit, when showing the commit log message.  This is the default\r
129         for <emphasis>git log</emphasis>, <emphasis>git show</emphasis> and <emphasis>git whatchanged</emphasis> commands when\r
130         there is no <emphasis>--pretty</emphasis>, <emphasis>--format</emphasis> nor <emphasis>--oneline</emphasis> option given\r
131         on the command line.\r
132 </simpara>\r
133 <simpara>By default, the notes shown are from the notes refs listed in the\r
134 <emphasis>core.notesRef</emphasis> and <emphasis>notes.displayRef</emphasis> variables (or corresponding\r
135 environment overrides). See <xref linkend="git-config(1)" /> for more details.</simpara>\r
136 <simpara>With an optional <emphasis>&lt;ref&gt;</emphasis> argument, show this notes ref instead of the\r
137 default notes ref(s). The ref is taken to be in <emphasis>refs/notes/</emphasis> if it\r
138 is not qualified.</simpara>\r
139 <simpara>Multiple --notes options can be combined to control which notes are\r
140 being displayed. Examples: "--notes=foo" will show only notes from\r
141 "refs/notes/foo"; "--notes=foo --notes" will show both notes from\r
142 "refs/notes/foo" and from the default notes ref(s).</simpara>\r
143 </listitem>\r
144 </varlistentry>\r
145 <varlistentry>\r
146 <term>\r
147 --no-notes\r
148 </term>\r
149 <listitem>\r
150 <simpara>\r
151         Do not show notes. This negates the above <emphasis>--notes</emphasis> option, by\r
152         resetting the list of notes refs from which notes are shown.\r
153         Options are parsed in the order given on the command line, so e.g.\r
154         "--notes --notes=foo --no-notes --notes=bar" will only show notes\r
155         from "refs/notes/bar".\r
156 </simpara>\r
157 </listitem>\r
158 </varlistentry>\r
159 <varlistentry>\r
160 <term>\r
161 --show-notes[=&lt;ref&gt;]\r
162 </term>\r
163 <term>\r
164 --[no-]standard-notes\r
165 </term>\r
166 <listitem>\r
167 <simpara>\r
168         These options are deprecated. Use the above --notes/--no-notes\r
169         options instead.\r
170 </simpara>\r
171 </listitem>\r
172 </varlistentry>\r
173 </variablelist>\r
174 </simplesect>\r
175 <simplesect id="_pretty_formats">\r
176 <title>PRETTY FORMATS</title>\r
177 <simpara>If the commit is a merge, and if the pretty-format\r
178 is not <emphasis>oneline</emphasis>, <emphasis>email</emphasis> or <emphasis>raw</emphasis>, an additional line is\r
179 inserted before the <emphasis>Author:</emphasis> line.  This line begins with\r
180 "Merge: " and the sha1s of ancestral commits are printed,\r
181 separated by spaces.  Note that the listed commits may not\r
182 necessarily be the list of the <emphasis role="strong">direct</emphasis> parent commits if you\r
183 have limited your view of history: for example, if you are\r
184 only interested in changes related to a certain directory or\r
185 file.</simpara>\r
186 <simpara>There are several built-in formats, and you can define\r
187 additional formats by setting a pretty.&lt;name&gt;\r
188 config option to either another format name, or a\r
189 <emphasis>format:</emphasis> string, as described below (see\r
190 <xref linkend="git-config(1)" />). Here are the details of the\r
191 built-in formats:</simpara>\r
192 <itemizedlist>\r
193 <listitem>\r
194 <simpara>\r
195 <emphasis>oneline</emphasis>\r
196 </simpara>\r
197 <literallayout class="monospaced">&lt;sha1&gt; &lt;title line&gt;</literallayout>\r
198 <simpara>This is designed to be as compact as possible.</simpara>\r
199 </listitem>\r
200 <listitem>\r
201 <simpara>\r
202 <emphasis>short</emphasis>\r
203 </simpara>\r
204 <literallayout class="monospaced">commit &lt;sha1&gt;\r
205 Author: &lt;author&gt;</literallayout>\r
206 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
207 </listitem>\r
208 <listitem>\r
209 <simpara>\r
210 <emphasis>medium</emphasis>\r
211 </simpara>\r
212 <literallayout class="monospaced">commit &lt;sha1&gt;\r
213 Author: &lt;author&gt;\r
214 Date:   &lt;author date&gt;</literallayout>\r
215 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
216 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
217 </listitem>\r
218 <listitem>\r
219 <simpara>\r
220 <emphasis>full</emphasis>\r
221 </simpara>\r
222 <literallayout class="monospaced">commit &lt;sha1&gt;\r
223 Author: &lt;author&gt;\r
224 Commit: &lt;committer&gt;</literallayout>\r
225 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
226 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
227 </listitem>\r
228 <listitem>\r
229 <simpara>\r
230 <emphasis>fuller</emphasis>\r
231 </simpara>\r
232 <literallayout class="monospaced">commit &lt;sha1&gt;\r
233 Author:     &lt;author&gt;\r
234 AuthorDate: &lt;author date&gt;\r
235 Commit:     &lt;committer&gt;\r
236 CommitDate: &lt;committer date&gt;</literallayout>\r
237 <literallayout class="monospaced">&lt;title line&gt;</literallayout>\r
238 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
239 </listitem>\r
240 <listitem>\r
241 <simpara>\r
242 <emphasis>email</emphasis>\r
243 </simpara>\r
244 <literallayout class="monospaced">From &lt;sha1&gt; &lt;date&gt;\r
245 From: &lt;author&gt;\r
246 Date: &lt;author date&gt;\r
247 Subject: [PATCH] &lt;title line&gt;</literallayout>\r
248 <literallayout class="monospaced">&lt;full commit message&gt;</literallayout>\r
249 </listitem>\r
250 <listitem>\r
251 <simpara>\r
252 <emphasis>raw</emphasis>\r
253 </simpara>\r
254 <simpara>The <emphasis>raw</emphasis> format shows the entire commit exactly as\r
255 stored in the commit object.  Notably, the SHA1s are\r
256 displayed in full, regardless of whether --abbrev or\r
257 --no-abbrev are used, and <emphasis>parents</emphasis> information show the\r
258 true parent commits, without taking grafts nor history\r
259 simplification into account.</simpara>\r
260 </listitem>\r
261 <listitem>\r
262 <simpara>\r
263 <emphasis>format:&lt;string&gt;</emphasis>\r
264 </simpara>\r
265 <simpara>The <emphasis>format:&lt;string&gt;</emphasis> format allows you to specify which information\r
266 you want to show. It works a little bit like printf format,\r
267 with the notable exception that you get a newline with <emphasis>%n</emphasis>\r
268 instead of <emphasis>\n</emphasis>.</simpara>\r
269 <simpara>E.g, <emphasis>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</emphasis>\r
270 would show something like this:</simpara>\r
271 <screen>The author of fe6e0ee was Junio C Hamano, 23 hours ago\r
272 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</screen>\r
273 <simpara>The placeholders are:</simpara>\r
274 <itemizedlist>\r
275 <listitem>\r
276 <simpara>\r
277 <emphasis>%H</emphasis>: commit hash\r
278 </simpara>\r
279 </listitem>\r
280 <listitem>\r
281 <simpara>\r
282 <emphasis>%h</emphasis>: abbreviated commit hash\r
283 </simpara>\r
284 </listitem>\r
285 <listitem>\r
286 <simpara>\r
287 <emphasis>%T</emphasis>: tree hash\r
288 </simpara>\r
289 </listitem>\r
290 <listitem>\r
291 <simpara>\r
292 <emphasis>%t</emphasis>: abbreviated tree hash\r
293 </simpara>\r
294 </listitem>\r
295 <listitem>\r
296 <simpara>\r
297 <emphasis>%P</emphasis>: parent hashes\r
298 </simpara>\r
299 </listitem>\r
300 <listitem>\r
301 <simpara>\r
302 <emphasis>%p</emphasis>: abbreviated parent hashes\r
303 </simpara>\r
304 </listitem>\r
305 <listitem>\r
306 <simpara>\r
307 <emphasis>%an</emphasis>: author name\r
308 </simpara>\r
309 </listitem>\r
310 <listitem>\r
311 <simpara>\r
312 <emphasis>%aN</emphasis>: author name (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
313 </simpara>\r
314 </listitem>\r
315 <listitem>\r
316 <simpara>\r
317 <emphasis>%ae</emphasis>: author email\r
318 </simpara>\r
319 </listitem>\r
320 <listitem>\r
321 <simpara>\r
322 <emphasis>%aE</emphasis>: author email (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
323 </simpara>\r
324 </listitem>\r
325 <listitem>\r
326 <simpara>\r
327 <emphasis>%ad</emphasis>: author date (format respects --date= option)\r
328 </simpara>\r
329 </listitem>\r
330 <listitem>\r
331 <simpara>\r
332 <emphasis>%aD</emphasis>: author date, RFC2822 style\r
333 </simpara>\r
334 </listitem>\r
335 <listitem>\r
336 <simpara>\r
337 <emphasis>%ar</emphasis>: author date, relative\r
338 </simpara>\r
339 </listitem>\r
340 <listitem>\r
341 <simpara>\r
342 <emphasis>%at</emphasis>: author date, UNIX timestamp\r
343 </simpara>\r
344 </listitem>\r
345 <listitem>\r
346 <simpara>\r
347 <emphasis>%ai</emphasis>: author date, ISO 8601 format\r
348 </simpara>\r
349 </listitem>\r
350 <listitem>\r
351 <simpara>\r
352 <emphasis>%cn</emphasis>: committer name\r
353 </simpara>\r
354 </listitem>\r
355 <listitem>\r
356 <simpara>\r
357 <emphasis>%cN</emphasis>: committer name (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
358 </simpara>\r
359 </listitem>\r
360 <listitem>\r
361 <simpara>\r
362 <emphasis>%ce</emphasis>: committer email\r
363 </simpara>\r
364 </listitem>\r
365 <listitem>\r
366 <simpara>\r
367 <emphasis>%cE</emphasis>: committer email (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
368 </simpara>\r
369 </listitem>\r
370 <listitem>\r
371 <simpara>\r
372 <emphasis>%cd</emphasis>: committer date\r
373 </simpara>\r
374 </listitem>\r
375 <listitem>\r
376 <simpara>\r
377 <emphasis>%cD</emphasis>: committer date, RFC2822 style\r
378 </simpara>\r
379 </listitem>\r
380 <listitem>\r
381 <simpara>\r
382 <emphasis>%cr</emphasis>: committer date, relative\r
383 </simpara>\r
384 </listitem>\r
385 <listitem>\r
386 <simpara>\r
387 <emphasis>%ct</emphasis>: committer date, UNIX timestamp\r
388 </simpara>\r
389 </listitem>\r
390 <listitem>\r
391 <simpara>\r
392 <emphasis>%ci</emphasis>: committer date, ISO 8601 format\r
393 </simpara>\r
394 </listitem>\r
395 <listitem>\r
396 <simpara>\r
397 <emphasis>%d</emphasis>: ref names, like the --decorate option of <xref linkend="git-log(1)" />\r
398 </simpara>\r
399 </listitem>\r
400 <listitem>\r
401 <simpara>\r
402 <emphasis>%e</emphasis>: encoding\r
403 </simpara>\r
404 </listitem>\r
405 <listitem>\r
406 <simpara>\r
407 <emphasis>%s</emphasis>: subject\r
408 </simpara>\r
409 </listitem>\r
410 <listitem>\r
411 <simpara>\r
412 <emphasis>%f</emphasis>: sanitized subject line, suitable for a filename\r
413 </simpara>\r
414 </listitem>\r
415 <listitem>\r
416 <simpara>\r
417 <emphasis>%b</emphasis>: body\r
418 </simpara>\r
419 </listitem>\r
420 <listitem>\r
421 <simpara>\r
422 <emphasis>%B</emphasis>: raw body (unwrapped subject and body)\r
423 </simpara>\r
424 </listitem>\r
425 <listitem>\r
426 <simpara>\r
427 <emphasis>%N</emphasis>: commit notes\r
428 </simpara>\r
429 </listitem>\r
430 <listitem>\r
431 <simpara>\r
432 <emphasis>%gD</emphasis>: reflog selector, e.g., <emphasis>refs/stash@{1}</emphasis>\r
433 </simpara>\r
434 </listitem>\r
435 <listitem>\r
436 <simpara>\r
437 <emphasis>%gd</emphasis>: shortened reflog selector, e.g., <emphasis>stash@{1}</emphasis>\r
438 </simpara>\r
439 </listitem>\r
440 <listitem>\r
441 <simpara>\r
442 <emphasis>%gn</emphasis>: reflog identity name\r
443 </simpara>\r
444 </listitem>\r
445 <listitem>\r
446 <simpara>\r
447 <emphasis>%gN</emphasis>: reflog identity name (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
448 </simpara>\r
449 </listitem>\r
450 <listitem>\r
451 <simpara>\r
452 <emphasis>%ge</emphasis>: reflog identity email\r
453 </simpara>\r
454 </listitem>\r
455 <listitem>\r
456 <simpara>\r
457 <emphasis>%gE</emphasis>: reflog identity email (respecting .mailmap, see <xref linkend="git-shortlog(1)" /> or <xref linkend="git-blame(1)" />)\r
458 </simpara>\r
459 </listitem>\r
460 <listitem>\r
461 <simpara>\r
462 <emphasis>%gs</emphasis>: reflog subject\r
463 </simpara>\r
464 </listitem>\r
465 <listitem>\r
466 <simpara>\r
467 <emphasis>%Cred</emphasis>: switch color to red\r
468 </simpara>\r
469 </listitem>\r
470 <listitem>\r
471 <simpara>\r
472 <emphasis>%Cgreen</emphasis>: switch color to green\r
473 </simpara>\r
474 </listitem>\r
475 <listitem>\r
476 <simpara>\r
477 <emphasis>%Cblue</emphasis>: switch color to blue\r
478 </simpara>\r
479 </listitem>\r
480 <listitem>\r
481 <simpara>\r
482 <emphasis>%Creset</emphasis>: reset color\r
483 </simpara>\r
484 </listitem>\r
485 <listitem>\r
486 <simpara>\r
487 <emphasis>%C(&#8230;)</emphasis>: color specification, as described in color.branch.* config option\r
488 </simpara>\r
489 </listitem>\r
490 <listitem>\r
491 <simpara>\r
492 <emphasis>%m</emphasis>: left, right or boundary mark\r
493 </simpara>\r
494 </listitem>\r
495 <listitem>\r
496 <simpara>\r
497 <emphasis>%n</emphasis>: newline\r
498 </simpara>\r
499 </listitem>\r
500 <listitem>\r
501 <simpara>\r
502 <emphasis>%%</emphasis>: a raw <emphasis>%</emphasis>\r
503 </simpara>\r
504 </listitem>\r
505 <listitem>\r
506 <simpara>\r
507 <emphasis>%x00</emphasis>: print a byte from a hex code\r
508 </simpara>\r
509 </listitem>\r
510 <listitem>\r
511 <simpara>\r
512 <emphasis>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</emphasis>: switch line wrapping, like the -w option of\r
513   <xref linkend="git-shortlog(1)" />.\r
514 </simpara>\r
515 </listitem>\r
516 </itemizedlist>\r
517 </listitem>\r
518 </itemizedlist>\r
519 <note><simpara>Some placeholders may depend on other options given to the\r
520 revision traversal engine. For example, the <emphasis>%g*</emphasis> reflog options will\r
521 insert an empty string unless we are traversing reflog entries (e.g., by\r
522 <emphasis>git log -g</emphasis>). The <emphasis>%d</emphasis> placeholder will use the "short" decoration\r
523 format if <emphasis>--decorate</emphasis> was not already provided on the command line.</simpara></note>\r
524 <simpara>If you add a <emphasis>+</emphasis> (plus sign) after <emphasis>%</emphasis> of a placeholder, a line-feed\r
525 is inserted immediately before the expansion if and only if the\r
526 placeholder expands to a non-empty string.</simpara>\r
527 <simpara>If you add a <emphasis>-</emphasis> (minus sign) after <emphasis>%</emphasis> of a placeholder, line-feeds that\r
528 immediately precede the expansion are deleted if and only if the\r
529 placeholder expands to an empty string.</simpara>\r
530 <simpara>If you add a ` ` (space) after <emphasis>%</emphasis> of a placeholder, a space\r
531 is inserted immediately before the expansion if and only if the\r
532 placeholder expands to a non-empty string.</simpara>\r
533 <itemizedlist>\r
534 <listitem>\r
535 <simpara>\r
536 <emphasis>tformat:</emphasis>\r
537 </simpara>\r
538 <simpara>The <emphasis>tformat:</emphasis> format works exactly like <emphasis>format:</emphasis>, except that it\r
539 provides "terminator" semantics instead of "separator" semantics. In\r
540 other words, each commit has the message terminator character (usually a\r
541 newline) appended, rather than a separator placed between entries.\r
542 This means that the final entry of a single-line format will be properly\r
543 terminated with a new line, just as the "oneline" format does.\r
544 For example:</simpara>\r
545 <screen>$ git log -2 --pretty=format:%h 4da45bef \\r
546   | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
547 4da45be\r
548 7134973 -- NO NEWLINE\r
550 $ git log -2 --pretty=tformat:%h 4da45bef \\r
551   | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
552 4da45be\r
553 7134973</screen>\r
554 <simpara>In addition, any unrecognized string that has a <emphasis>%</emphasis> in it is interpreted\r
555 as if it has <emphasis>tformat:</emphasis> in front of it.  For example, these two are\r
556 equivalent:</simpara>\r
557 <screen>$ git log -2 --pretty=tformat:%h 4da45bef\r
558 $ git log -2 --pretty=%h 4da45bef</screen>\r
559 </listitem>\r
560 </itemizedlist>\r
561 </simplesect>\r
562 <simplesect id="_examples">\r
563 <title>EXAMPLES</title>\r
564 <variablelist>\r
565 <varlistentry>\r
566 <term>\r
567 <emphasis>git show v1.0.0</emphasis>\r
568 </term>\r
569 <listitem>\r
570 <simpara>\r
571         Shows the tag <emphasis>v1.0.0</emphasis>, along with the object the tags\r
572         points at.\r
573 </simpara>\r
574 </listitem>\r
575 </varlistentry>\r
576 <varlistentry>\r
577 <term>\r
578 <emphasis>git show v1.0.0^{tree}</emphasis>\r
579 </term>\r
580 <listitem>\r
581 <simpara>\r
582         Shows the tree pointed to by the tag <emphasis>v1.0.0</emphasis>.\r
583 </simpara>\r
584 </listitem>\r
585 </varlistentry>\r
586 <varlistentry>\r
587 <term>\r
588 <emphasis>git show -s --format=%s v1.0.0^{commit}</emphasis>\r
589 </term>\r
590 <listitem>\r
591 <simpara>\r
592         Shows the subject of the commit pointed to by the\r
593         tag <emphasis>v1.0.0</emphasis>.\r
594 </simpara>\r
595 </listitem>\r
596 </varlistentry>\r
597 <varlistentry>\r
598 <term>\r
599 <emphasis>git show next~10:Documentation/README</emphasis>\r
600 </term>\r
601 <listitem>\r
602 <simpara>\r
603         Shows the contents of the file <emphasis>Documentation/README</emphasis> as\r
604         they were current in the 10th last commit of the branch\r
605         <emphasis>next</emphasis>.\r
606 </simpara>\r
607 </listitem>\r
608 </varlistentry>\r
609 <varlistentry>\r
610 <term>\r
611 <emphasis>git show master:Makefile master:t/Makefile</emphasis>\r
612 </term>\r
613 <listitem>\r
614 <simpara>\r
615         Concatenates the contents of said Makefiles in the head\r
616         of the branch <emphasis>master</emphasis>.\r
617 </simpara>\r
618 </listitem>\r
619 </varlistentry>\r
620 </variablelist>\r
621 </simplesect>\r
622 <simplesect id="_discussion">\r
623 <title>Discussion</title>\r
624 <simpara>At the core level, git is character encoding agnostic.</simpara>\r
625 <itemizedlist>\r
626 <listitem>\r
627 <simpara>\r
628 The pathnames recorded in the index and in the tree objects\r
629    are treated as uninterpreted sequences of non-NUL bytes.\r
630    What readdir(2) returns are what are recorded and compared\r
631    with the data git keeps track of, which in turn are expected\r
632    to be what lstat(2) and creat(2) accepts.  There is no such\r
633    thing as pathname encoding translation.\r
634 </simpara>\r
635 </listitem>\r
636 <listitem>\r
637 <simpara>\r
638 The contents of the blob objects are uninterpreted sequences\r
639    of bytes.  There is no encoding translation at the core\r
640    level.\r
641 </simpara>\r
642 </listitem>\r
643 <listitem>\r
644 <simpara>\r
645 The commit log messages are uninterpreted sequences of non-NUL\r
646    bytes.\r
647 </simpara>\r
648 </listitem>\r
649 </itemizedlist>\r
650 <simpara>Although we encourage that the commit log messages are encoded\r
651 in UTF-8, both the core and git Porcelain are designed not to\r
652 force UTF-8 on projects.  If all participants of a particular\r
653 project find it more convenient to use legacy encodings, git\r
654 does not forbid it.  However, there are a few things to keep in\r
655 mind.</simpara>\r
656 <orderedlist numeration="arabic">\r
657 <listitem>\r
658 <simpara>\r
659 <emphasis>git commit</emphasis> and <emphasis>git commit-tree</emphasis> issues\r
660   a warning if the commit log message given to it does not look\r
661   like a valid UTF-8 string, unless you explicitly say your\r
662   project uses a legacy encoding.  The way to say this is to\r
663   have i18n.commitencoding in <emphasis>.git/config</emphasis> file, like this:\r
664 </simpara>\r
665 <screen>[i18n]\r
666         commitencoding = ISO-8859-1</screen>\r
667 <simpara>Commit objects created with the above setting record the value\r
668 of <emphasis>i18n.commitencoding</emphasis> in its <emphasis>encoding</emphasis> header.  This is to\r
669 help other people who look at them later.  Lack of this header\r
670 implies that the commit log message is encoded in UTF-8.</simpara>\r
671 </listitem>\r
672 <listitem>\r
673 <simpara>\r
674 <emphasis>git log</emphasis>, <emphasis>git show</emphasis>, <emphasis>git blame</emphasis> and friends look at the\r
675   <emphasis>encoding</emphasis> header of a commit object, and try to re-code the\r
676   log message into UTF-8 unless otherwise specified.  You can\r
677   specify the desired output encoding with\r
678   <emphasis>i18n.logoutputencoding</emphasis> in <emphasis>.git/config</emphasis> file, like this:\r
679 </simpara>\r
680 <screen>[i18n]\r
681         logoutputencoding = ISO-8859-1</screen>\r
682 <simpara>If you do not have this configuration variable, the value of\r
683 <emphasis>i18n.commitencoding</emphasis> is used instead.</simpara>\r
684 </listitem>\r
685 </orderedlist>\r
686 <simpara>Note that we deliberately chose not to re-code the commit log\r
687 message when a commit is made to force UTF-8 at the commit\r
688 object level, because re-coding to UTF-8 is not necessarily a\r
689 reversible operation.</simpara>\r
690 </simplesect>\r
691 <simplesect id="_git">\r
692 <title>GIT</title>\r
693 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
694 </simplesect>\r
695 </article>\r