blob: 002f88d115a77c18c65c55c079a356f7f55900a9 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!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" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-log(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-log(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-log -
317 Show commit logs
318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoa476efa2008-10-10 15:31:42323<div class="para"><p><em>git log</em> [&lt;options&gt;] [&lt;since&gt;..&lt;until&gt;] [[--] &lt;path&gt;&#8230;]</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23324</div>
Junio C Hamanoba4b9282008-07-06 05:20:31325<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23326<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31327<div class="para"><p>Shows the commit logs.</p></div>
328<div class="para"><p>The command takes options applicable to the <em>git-rev-list</em>
Junio C Hamanoba7c8d82006-04-15 06:17:42329command to control what is shown and how, and options applicable to
Junio C Hamanoba4b9282008-07-06 05:20:31330the <em>git-diff-*</em> commands to control how the changes
331each commit introduces are shown.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23332</div>
Junio C Hamanoba4b9282008-07-06 05:20:31333<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23334<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31335<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23336<dt>
Junio C Hamano00b8b632007-12-07 09:50:49337-p
338</dt>
Junio C Hamanobbbb8652008-12-29 10:34:22339<dt>
340-u
341</dt>
Junio C Hamano00b8b632007-12-07 09:50:49342<dd>
343<p>
344 Generate patch (see section on generating patches).
345
346</p>
347</dd>
348<dt>
Junio C Hamano00b8b632007-12-07 09:50:49349-U&lt;n&gt;
350</dt>
Junio C Hamano00b8b632007-12-07 09:50:49351<dt>
352--unified=&lt;n&gt;
353</dt>
354<dd>
355<p>
356 Generate diffs with &lt;n&gt; lines of context instead of
357 the usual three. Implies "-p".
358</p>
359</dd>
360<dt>
361--raw
362</dt>
363<dd>
364<p>
365 Generate the raw format.
366
367</p>
368</dd>
369<dt>
370--patch-with-raw
371</dt>
372<dd>
373<p>
374 Synonym for "-p --raw".
375</p>
376</dd>
Junio C Hamano20d47e32009-01-26 06:36:02377<dt>
378--patience
379</dt>
380<dd>
381<p>
382 Generate a diff using the "patience diff" algorithm.
383</p>
384</dd>
Junio C Hamano00b8b632007-12-07 09:50:49385<dt>
386--stat[=width[,name-width]]
387</dt>
388<dd>
389<p>
390 Generate a diffstat. You can override the default
391 output width for 80-column terminal by "--stat=width".
392 The width of the filename part can be controlled by
393 giving another width to it separated by a comma.
394</p>
395</dd>
396<dt>
397--numstat
398</dt>
399<dd>
400<p>
401 Similar to --stat, but shows number of added and
402 deleted lines in decimal notation and pathname without
403 abbreviation, to make it more machine friendly. For
404 binary files, outputs two <tt>-</tt> instead of saying
405 <tt>0 0</tt>.
406</p>
407</dd>
408<dt>
409--shortstat
410</dt>
411<dd>
412<p>
413 Output only the last line of the --stat format containing total
414 number of modified files, as well as number of added and deleted
415 lines.
416</p>
417</dd>
418<dt>
Junio C Hamano6a45be92008-04-22 08:19:03419--dirstat[=limit]
420</dt>
421<dd>
422<p>
Junio C Hamanoa2f46622008-09-03 05:20:31423 Output the distribution of relative amount of changes (number of lines added or
424 removed) for each sub-directory. Directories with changes below
425 a cut-off percent (3% by default) are not shown. The cut-off percent
426 can be set with "--dirstat=limit". Changes in a child directory is not
427 counted for the parent directory, unless "--cumulative" is used.
Junio C Hamano6a45be92008-04-22 08:19:03428</p>
429</dd>
430<dt>
Junio C Hamanoa476efa2008-10-10 15:31:42431--dirstat-by-file[=limit]
432</dt>
433<dd>
434<p>
435 Same as --dirstat, but counts changed files instead of lines.
436</p>
437</dd>
438<dt>
Junio C Hamano00b8b632007-12-07 09:50:49439--summary
440</dt>
441<dd>
442<p>
443 Output a condensed summary of extended header information
444 such as creations, renames and mode changes.
445</p>
446</dd>
447<dt>
448--patch-with-stat
449</dt>
450<dd>
451<p>
452 Synonym for "-p --stat".
453
454</p>
455</dd>
456<dt>
457-z
458</dt>
459<dd>
460<p>
461 NUL-line termination on output. This affects the --raw
462 output field terminator. Also output from commands such
463 as "git-log" will be delimited with NUL between commits.
464</p>
465</dd>
466<dt>
467--name-only
468</dt>
469<dd>
470<p>
471 Show only names of changed files.
472</p>
473</dd>
474<dt>
475--name-status
476</dt>
477<dd>
478<p>
Junio C Hamanoa9aee782008-04-23 16:09:20479 Show only names and status of changed files. See the description
480 of the <tt>--diff-filter</tt> option on what the status letters mean.
Junio C Hamano00b8b632007-12-07 09:50:49481</p>
482</dd>
483<dt>
484--color
485</dt>
486<dd>
487<p>
488 Show colored diff.
489</p>
490</dd>
491<dt>
492--no-color
493</dt>
494<dd>
495<p>
496 Turn off colored diff, even when the configuration file
497 gives the default to color output.
498</p>
499</dd>
500<dt>
Junio C Hamano20d47e32009-01-26 06:36:02501--color-words[=&lt;regex&gt;]
Junio C Hamano00b8b632007-12-07 09:50:49502</dt>
503<dd>
504<p>
Junio C Hamano20d47e32009-01-26 06:36:02505 Show colored word diff, i.e., color words which have changed.
506 By default, words are separated by whitespace.
Junio C Hamano00b8b632007-12-07 09:50:49507</p>
Junio C Hamano20d47e32009-01-26 06:36:02508<div class="para"><p>When a &lt;regex&gt; is specified, every non-overlapping match of the
509&lt;regex&gt; is considered a word. Anything between these matches is
510considered whitespace and ignored(!) for the purposes of finding
511differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
512expression to make sure that it matches all non-whitespace characters.
513A match that contains a newline is silently truncated(!) at the
514newline.</p></div>
515<div class="para"><p>The regex can also be set via a diff driver or configuration option, see
516<a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
517overrides any diff driver or configuration setting. Diff drivers
518override configuration settings.</p></div>
Junio C Hamano00b8b632007-12-07 09:50:49519</dd>
520<dt>
521--no-renames
522</dt>
523<dd>
524<p>
525 Turn off rename detection, even when the configuration
526 file gives the default to do so.
527</p>
528</dd>
529<dt>
530--check
531</dt>
532<dd>
533<p>
534 Warn if changes introduce trailing whitespace
Junio C Hamano3dac5042007-12-15 08:40:54535 or an indent that uses a space before a tab. Exits with
536 non-zero status if problems are found. Not compatible with
537 --exit-code.
Junio C Hamano00b8b632007-12-07 09:50:49538</p>
539</dd>
540<dt>
541--full-index
542</dt>
543<dd>
544<p>
Junio C Hamano5cf43ca2008-08-20 09:14:14545 Instead of the first handful of characters, show the full
546 pre- and post-image blob object names on the "index"
547 line when generating patch format output.
Junio C Hamano00b8b632007-12-07 09:50:49548</p>
549</dd>
550<dt>
551--binary
552</dt>
553<dd>
554<p>
555 In addition to --full-index, output "binary diff" that
556 can be applied with "git apply".
557</p>
558</dd>
559<dt>
560--abbrev[=&lt;n&gt;]
561</dt>
562<dd>
563<p>
564 Instead of showing the full 40-byte hexadecimal object
565 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56566 lines, show only a partial prefix. This is
Junio C Hamano00b8b632007-12-07 09:50:49567 independent of --full-index option above, which controls
568 the diff-patch output format. Non default number of
569 digits can be specified with --abbrev=&lt;n&gt;.
570</p>
571</dd>
572<dt>
573-B
574</dt>
575<dd>
576<p>
577 Break complete rewrite changes into pairs of delete and create.
578</p>
579</dd>
580<dt>
581-M
582</dt>
583<dd>
584<p>
585 Detect renames.
586</p>
587</dd>
588<dt>
589-C
590</dt>
591<dd>
592<p>
593 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
594</p>
595</dd>
596<dt>
597--diff-filter=[ACDMRTUXB*]
598</dt>
599<dd>
600<p>
601 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
602 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
Junio C Hamanoa2deec52008-10-18 18:58:09603 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
604 are Unmerged (<tt>U</tt>), are
Junio C Hamano00b8b632007-12-07 09:50:49605 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
606 Any combination of the filter characters may be used.
607 When <tt>*</tt> (All-or-none) is added to the combination, all
608 paths are selected if there is any file that matches
609 other criteria in the comparison; if there is no file
610 that matches other criteria, nothing is selected.
611</p>
612</dd>
613<dt>
614--find-copies-harder
615</dt>
616<dd>
617<p>
618 For performance reasons, by default, <tt>-C</tt> option finds copies only
619 if the original file of the copy was modified in the same
620 changeset. This flag makes the command
621 inspect unmodified files as candidates for the source of
622 copy. This is a very expensive operation for large
623 projects, so use it with caution. Giving more than one
624 <tt>-C</tt> option has the same effect.
625</p>
626</dd>
627<dt>
628-l&lt;num&gt;
629</dt>
630<dd>
631<p>
632 -M and -C options require O(n^2) processing time where n
633 is the number of potential rename/copy targets. This
634 option prevents rename/copy detection from running if
635 the number of rename/copy targets exceeds the specified
636 number.
637</p>
638</dd>
639<dt>
640-S&lt;string&gt;
641</dt>
642<dd>
643<p>
Junio C Hamano5217a272009-03-21 00:39:33644 Look for differences that introduce or remove an instance of
645 &lt;string&gt;. Note that this is different than the string simply
646 appearing in diff output; see the <em>pickaxe</em> entry in
647 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
Junio C Hamano00b8b632007-12-07 09:50:49648</p>
649</dd>
650<dt>
651--pickaxe-all
652</dt>
653<dd>
654<p>
655 When -S finds a change, show all the changes in that
656 changeset, not just the files that contain the change
657 in &lt;string&gt;.
658</p>
659</dd>
660<dt>
661--pickaxe-regex
662</dt>
663<dd>
664<p>
665 Make the &lt;string&gt; not a plain string but an extended POSIX
666 regex to match.
667</p>
668</dd>
669<dt>
670-O&lt;orderfile&gt;
671</dt>
672<dd>
673<p>
674 Output the patch in the order specified in the
675 &lt;orderfile&gt;, which has one shell glob pattern per line.
676</p>
677</dd>
678<dt>
679-R
680</dt>
681<dd>
682<p>
683 Swap two inputs; that is, show differences from index or
684 on-disk file to tree contents.
685</p>
686</dd>
687<dt>
Junio C Hamano24bc09a2008-02-28 00:27:44688--relative[=&lt;path&gt;]
689</dt>
690<dd>
691<p>
692 When run from a subdirectory of the project, it can be
693 told to exclude changes outside the directory and show
694 pathnames relative to it with this option. When you are
695 not in a subdirectory (e.g. in a bare repository), you
696 can name which subdirectory to make the output relative
697 to by giving a &lt;path&gt; as an argument.
698</p>
699</dd>
700<dt>
Junio C Hamanobbbb8652008-12-29 10:34:22701-a
702</dt>
703<dt>
Junio C Hamano00b8b632007-12-07 09:50:49704--text
705</dt>
706<dd>
707<p>
708 Treat all files as text.
709</p>
710</dd>
711<dt>
Junio C Hamano00b8b632007-12-07 09:50:49712--ignore-space-at-eol
713</dt>
714<dd>
715<p>
Junio C Hamano3a702342007-12-12 21:34:02716 Ignore changes in whitespace at EOL.
Junio C Hamano00b8b632007-12-07 09:50:49717</p>
718</dd>
719<dt>
Junio C Hamanobbbb8652008-12-29 10:34:22720-b
721</dt>
722<dt>
Junio C Hamano00b8b632007-12-07 09:50:49723--ignore-space-change
724</dt>
725<dd>
726<p>
Junio C Hamano3a702342007-12-12 21:34:02727 Ignore changes in amount of whitespace. This ignores whitespace
728 at line end, and considers all other sequences of one or
729 more whitespace characters to be equivalent.
Junio C Hamano00b8b632007-12-07 09:50:49730</p>
731</dd>
732<dt>
Junio C Hamanobbbb8652008-12-29 10:34:22733-w
Junio C Hamano00b8b632007-12-07 09:50:49734</dt>
Junio C Hamano00b8b632007-12-07 09:50:49735<dt>
736--ignore-all-space
737</dt>
738<dd>
739<p>
Junio C Hamano3a702342007-12-12 21:34:02740 Ignore whitespace when comparing lines. This ignores
741 differences even if one line has whitespace where the other
Junio C Hamano00b8b632007-12-07 09:50:49742 line has none.
743</p>
744</dd>
745<dt>
Junio C Hamano1d40ee82009-01-07 10:14:16746--inter-hunk-context=&lt;lines&gt;
747</dt>
748<dd>
749<p>
750 Show the context between diff hunks, up to the specified number
751 of lines, thereby fusing hunks that are close to each other.
752</p>
753</dd>
754<dt>
Junio C Hamano00b8b632007-12-07 09:50:49755--exit-code
756</dt>
757<dd>
758<p>
759 Make the program exit with codes similar to diff(1).
760 That is, it exits with 1 if there were differences and
761 0 means no differences.
762</p>
763</dd>
764<dt>
765--quiet
766</dt>
767<dd>
768<p>
769 Disable all output of the program. Implies --exit-code.
770</p>
771</dd>
772<dt>
773--ext-diff
774</dt>
775<dd>
776<p>
777 Allow an external diff helper to be executed. If you set an
778 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
779 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
780</p>
781</dd>
782<dt>
783--no-ext-diff
784</dt>
785<dd>
786<p>
787 Disallow external diff drivers.
788</p>
789</dd>
Junio C Hamanoe27cbd22007-12-21 17:57:33790<dt>
Junio C Hamanodfccbb02008-05-26 01:16:14791--ignore-submodules
792</dt>
793<dd>
794<p>
795 Ignore changes to submodules in the diff generation.
796</p>
797</dd>
798<dt>
Junio C Hamanoe27cbd22007-12-21 17:57:33799--src-prefix=&lt;prefix&gt;
800</dt>
801<dd>
802<p>
803 Show the given source prefix instead of "a/".
804</p>
805</dd>
806<dt>
807--dst-prefix=&lt;prefix&gt;
808</dt>
809<dd>
810<p>
811 Show the given destination prefix instead of "b/".
812</p>
813</dd>
814<dt>
815--no-prefix
816</dt>
817<dd>
818<p>
819 Do not show any source or destination prefix.
820</p>
821</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31822</dl></div>
823<div class="para"><p>For more detailed explanation on these common options, see also
824<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
825<div class="vlist"><dl>
Junio C Hamano0430e3a2007-05-15 03:13:17826<dt>
827-&lt;n&gt;
828</dt>
829<dd>
830<p>
831 Limits the number of commits to show.
832</p>
833</dd>
834<dt>
835&lt;since&gt;..&lt;until&gt;
836</dt>
837<dd>
838<p>
839 Show only commits between the named two commits. When
840 either &lt;since&gt; or &lt;until&gt; is omitted, it defaults to
841 <tt>HEAD</tt>, i.e. the tip of the current branch.
842 For a more complete list of ways to spell &lt;since&gt;
843 and &lt;until&gt;, see "SPECIFYING REVISIONS" section in
844 <a href="git-rev-parse.html">git-rev-parse(1)</a>.
845</p>
846</dd>
847<dt>
Junio C Hamano0430e3a2007-05-15 03:13:17848--decorate
849</dt>
850<dd>
851<p>
Junio C Hamanoee695f22007-06-21 00:35:36852 Print out the ref names of any commits that are shown.
853</p>
854</dd>
855<dt>
Junio C Hamano28363492008-11-14 08:26:31856--source
857</dt>
858<dd>
859<p>
860 Print out the ref name given on the command line by which each
861 commit was reached.
862</p>
863</dd>
864<dt>
Junio C Hamanoee695f22007-06-21 00:35:36865--full-diff
866</dt>
867<dd>
868<p>
Junio C Hamano9e395072008-07-31 22:11:21869 Without this flag, "git log -p &lt;path&gt;&#8230;" shows commits that
Junio C Hamanoee695f22007-06-21 00:35:36870 touch the specified paths, and diffs about the same specified
871 paths. With this, the full diff is shown for commits that touch
Junio C Hamano9e395072008-07-31 22:11:21872 the specified paths; this means that "&lt;path&gt;&#8230;" limits only
Junio C Hamanoee695f22007-06-21 00:35:36873 commits, and doesn't limit diff for those commits.
Junio C Hamano0430e3a2007-05-15 03:13:17874</p>
875</dd>
876<dt>
Junio C Hamano235d53f2007-07-13 00:25:15877--follow
878</dt>
879<dd>
880<p>
881 Continue listing the history of a file beyond renames.
882</p>
883</dd>
884<dt>
Junio C Hamano024b6c62007-08-14 09:43:08885--log-size
886</dt>
887<dd>
888<p>
889 Before the log message print out its size in bytes. Intended
890 mainly for porcelain tools consumption. If git is unable to
891 produce a valid value size is set to zero.
892 Note that only message is considered, if also a diff is shown
893 its size is not included.
894</p>
895</dd>
896<dt>
Junio C Hamanoa476efa2008-10-10 15:31:42897[--] &lt;path&gt;&#8230;
Junio C Hamano0430e3a2007-05-15 03:13:17898</dt>
899<dd>
900<p>
Junio C Hamanoa476efa2008-10-10 15:31:42901 Show only commits that affect any of the specified paths. To
902 prevent confusion with options and branch names, paths may need
903 to be prefixed with "-- " to separate them from options or
904 refnames.
Junio C Hamano0430e3a2007-05-15 03:13:17905</p>
906</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31907</dl></div>
908<h3 id="_commit_formatting">Commit Formatting</h3><div style="clear:left"></div>
909<div class="vlist"><dl>
Junio C Hamanob0e02952008-01-19 08:02:00910<dt>
911--pretty[=<em>&lt;format&gt;</em>]
912</dt>
Junio C Hamano0a235222009-03-06 08:21:09913<dt>
914--format[=<em>&lt;format&gt;</em>]
915</dt>
Junio C Hamanob0e02952008-01-19 08:02:00916<dd>
917<p>
918 Pretty-print the contents of the commit logs in a given format,
919 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
920 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>.
921 When omitted, the format defaults to <em>medium</em>.
922</p>
Junio C Hamanoba4b9282008-07-06 05:20:31923<div class="para"><p>Note: you can specify the default pretty format in the repository
924configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamanob0e02952008-01-19 08:02:00925</dd>
926<dt>
927--abbrev-commit
928</dt>
929<dd>
930<p>
931 Instead of showing the full 40-byte hexadecimal commit object
Junio C Hamano6efe3022009-01-13 16:47:56932 name, show only a partial prefix. Non default number of
Junio C Hamanob0e02952008-01-19 08:02:00933 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
934 diff output, if it is displayed).
935</p>
Junio C Hamanoba4b9282008-07-06 05:20:31936<div class="para"><p>This should make "--pretty=oneline" a whole lot more readable for
937people using 80-column terminals.</p></div>
Junio C Hamanob0e02952008-01-19 08:02:00938</dd>
939<dt>
Junio C Hamano0a235222009-03-06 08:21:09940--oneline
941</dt>
942<dd>
943<p>
944 This is a shorthand for "--pretty=oneline --abbrev-commit"
945 used together.
946</p>
947</dd>
948<dt>
Junio C Hamanob0e02952008-01-19 08:02:00949--encoding[=&lt;encoding&gt;]
950</dt>
951<dd>
952<p>
953 The commit objects record the encoding used for the log message
954 in their encoding header; this option can be used to tell the
955 command to re-code the commit log message in the encoding
956 preferred by the user. For non plumbing commands this
957 defaults to UTF-8.
958</p>
959</dd>
960<dt>
961--relative-date
962</dt>
963<dd>
964<p>
965 Synonym for <tt>--date=relative</tt>.
966</p>
967</dd>
968<dt>
Junio C Hamanobb653132009-02-22 08:09:35969--date={relative,local,default,iso,rfc,short,raw}
Junio C Hamanob0e02952008-01-19 08:02:00970</dt>
971<dd>
972<p>
973 Only takes effect for dates shown in human-readable format, such
Junio C Hamanob713ff12008-05-24 01:12:30974 as when using "--pretty". <tt>log.date</tt> config variable sets a default
975 value for log command's --date option.
Junio C Hamanob0e02952008-01-19 08:02:00976</p>
Junio C Hamanoba4b9282008-07-06 05:20:31977<div class="para"><p><tt>--date=relative</tt> shows dates relative to the current time,
978e.g. "2 hours ago".</p></div>
979<div class="para"><p><tt>--date=local</tt> shows timestamps in user's local timezone.</p></div>
980<div class="para"><p><tt>--date=iso</tt> (or <tt>--date=iso8601</tt>) shows timestamps in ISO 8601 format.</p></div>
981<div class="para"><p><tt>--date=rfc</tt> (or <tt>--date=rfc2822</tt>) shows timestamps in RFC 2822
982format, often found in E-mail messages.</p></div>
983<div class="para"><p><tt>--date=short</tt> shows only date but not time, in <tt>YYYY-MM-DD</tt> format.</p></div>
Junio C Hamanobb653132009-02-22 08:09:35984<div class="para"><p><tt>--date=raw</tt> shows the date in the internal raw git format <tt>%s %z</tt> format.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31985<div class="para"><p><tt>--date=default</tt> shows timestamps in the original timezone
986(either committer's or author's).</p></div>
Junio C Hamanob0e02952008-01-19 08:02:00987</dd>
988<dt>
Junio C Hamanob0e02952008-01-19 08:02:00989--parents
990</dt>
991<dd>
992<p>
Junio C Hamanoa76cb0d2008-08-13 20:04:10993 Print the parents of the commit. Also enables parent
994 rewriting, see <em>History Simplification</em> below.
Junio C Hamanob0e02952008-01-19 08:02:00995</p>
996</dd>
997<dt>
Junio C Hamano46a38aa2008-07-14 03:13:27998--children
999</dt>
1000<dd>
1001<p>
Junio C Hamanoa76cb0d2008-08-13 20:04:101002 Print the children of the commit. Also enables parent
1003 rewriting, see <em>History Simplification</em> below.
Junio C Hamano46a38aa2008-07-14 03:13:271004</p>
1005</dd>
1006<dt>
Junio C Hamanob0e02952008-01-19 08:02:001007--left-right
1008</dt>
1009<dd>
1010<p>
1011 Mark which side of a symmetric diff a commit is reachable from.
1012 Commits from the left side are prefixed with <tt>&lt;</tt> and those from
1013 the right with <tt>&gt;</tt>. If combined with <tt>--boundary</tt>, those
1014 commits are prefixed with <tt>-</tt>.
1015</p>
Junio C Hamanoba4b9282008-07-06 05:20:311016<div class="para"><p>For example, if you have this topology:</p></div>
Junio C Hamanob0e02952008-01-19 08:02:001017<div class="listingblock">
1018<div class="content">
1019<pre><tt> y---b---b branch B
1020 / \ /
1021 / .
1022 / / \
1023 o---x---a---a branch A</tt></pre>
1024</div></div>
Junio C Hamanoc96fb5a2008-08-12 06:59:381025<div class="para"><p>you would get an output like this:</p></div>
Junio C Hamanob0e02952008-01-19 08:02:001026<div class="listingblock">
1027<div class="content">
1028<pre><tt> $ git rev-list --left-right --boundary --pretty=oneline A...B
1029
1030 &gt;bbbbbbb... 3rd on b
1031 &gt;bbbbbbb... 2nd on b
1032 &lt;aaaaaaa... 3rd on a
1033 &lt;aaaaaaa... 2nd on a
1034 -yyyyyyy... 1st on b
1035 -xxxxxxx... 1st on a</tt></pre>
1036</div></div>
1037</dd>
Junio C Hamanofeeb1be2008-05-22 00:53:351038<dt>
1039--graph
1040</dt>
1041<dd>
1042<p>
1043 Draw a text-based graphical representation of the commit history
1044 on the left hand side of the output. This may cause extra lines
1045 to be printed in between commits, in order for the graph history
1046 to be drawn properly.
1047</p>
Junio C Hamanoba4b9282008-07-06 05:20:311048<div class="para"><p>This implies the <em>--topo-order</em> option by default, but the
1049<em>--date-order</em> option may also be specified.</p></div>
Junio C Hamanofeeb1be2008-05-22 00:53:351050</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311051</dl></div>
1052<h3 id="_diff_formatting">Diff Formatting</h3><div style="clear:left"></div>
1053<div class="para"><p>Below are listed options that control the formatting of diff output.
Junio C Hamanob0e02952008-01-19 08:02:001054Some of them are specific to <a href="git-rev-list.html">git-rev-list(1)</a>, however other diff
Junio C Hamanoba4b9282008-07-06 05:20:311055options may be given. See <a href="git-diff-files.html">git-diff-files(1)</a> for more options.</p></div>
1056<div class="vlist"><dl>
Junio C Hamanob0e02952008-01-19 08:02:001057<dt>
1058-c
1059</dt>
1060<dd>
1061<p>
1062 This flag changes the way a merge commit is displayed. It shows
1063 the differences from each of the parents to the merge result
1064 simultaneously instead of showing pairwise diff between a parent
1065 and the result one at a time. Furthermore, it lists only files
1066 which were modified from all parents.
1067</p>
1068</dd>
1069<dt>
1070--cc
1071</dt>
1072<dd>
1073<p>
1074 This flag implies the <em>-c</em> options and further compresses the
Junio C Hamanoccc2f762008-07-24 04:03:331075 patch output by omitting uninteresting hunks whose contents in
1076 the parents have only two variants and the merge result picks
1077 one of them without modification.
Junio C Hamanob0e02952008-01-19 08:02:001078</p>
1079</dd>
1080<dt>
1081-r
1082</dt>
1083<dd>
1084<p>
1085 Show recursive diffs.
1086</p>
1087</dd>
1088<dt>
1089-t
1090</dt>
1091<dd>
1092<p>
1093 Show the tree objects in the diff output. This implies <em>-r</em>.
1094</p>
1095</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311096</dl></div>
1097<h3 id="_commit_limiting">Commit Limiting</h3><div style="clear:left"></div>
1098<div class="para"><p>Besides specifying a range of commits that should be listed using the
Junio C Hamanob0e02952008-01-19 08:02:001099special notations explained in the description, additional commit
Junio C Hamanoba4b9282008-07-06 05:20:311100limiting may be applied.</p></div>
1101<div class="vlist"><dl>
Junio C Hamanob0e02952008-01-19 08:02:001102<dt>
Junio C Hamanoeb415992008-06-08 22:49:471103-n <em>number</em>
1104</dt>
1105<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321106--max-count=&lt;number&gt;
Junio C Hamanob0e02952008-01-19 08:02:001107</dt>
1108<dd>
1109<p>
1110 Limit the number of commits output.
1111</p>
1112</dd>
1113<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321114--skip=&lt;number&gt;
Junio C Hamanob0e02952008-01-19 08:02:001115</dt>
1116<dd>
1117<p>
1118 Skip <em>number</em> commits before starting to show the commit output.
1119</p>
1120</dd>
1121<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321122--since=&lt;date&gt;
Junio C Hamanoeb415992008-06-08 22:49:471123</dt>
1124<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321125--after=&lt;date&gt;
Junio C Hamanob0e02952008-01-19 08:02:001126</dt>
1127<dd>
1128<p>
1129 Show commits more recent than a specific date.
1130</p>
1131</dd>
1132<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321133--until=&lt;date&gt;
Junio C Hamanoeb415992008-06-08 22:49:471134</dt>
1135<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321136--before=&lt;date&gt;
Junio C Hamanob0e02952008-01-19 08:02:001137</dt>
1138<dd>
1139<p>
1140 Show commits older than a specific date.
1141</p>
1142</dd>
1143<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321144--author=&lt;pattern&gt;
Junio C Hamanoeb415992008-06-08 22:49:471145</dt>
1146<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321147--committer=&lt;pattern&gt;
Junio C Hamanob0e02952008-01-19 08:02:001148</dt>
1149<dd>
1150<p>
1151 Limit the commits output to ones with author/committer
1152 header lines that match the specified pattern (regular expression).
1153</p>
1154</dd>
1155<dt>
Junio C Hamanob4a9ede2009-04-08 07:36:321156--grep=&lt;pattern&gt;
Junio C Hamanob0e02952008-01-19 08:02:001157</dt>
1158<dd>
1159<p>
1160 Limit the commits output to ones with log message that
1161 matches the specified pattern (regular expression).
1162</p>
1163</dd>
1164<dt>
Junio C Hamanoaa17c7c2008-11-03 04:36:581165--all-match
1166</dt>
1167<dd>
1168<p>
1169 Limit the commits output to ones that match all given --grep,
1170 --author and --committer instead of ones that match at least one.
1171</p>
1172</dd>
1173<dt>
Junio C Hamanoeb415992008-06-08 22:49:471174-i
1175</dt>
1176<dt>
1177--regexp-ignore-case
Junio C Hamanob0e02952008-01-19 08:02:001178</dt>
1179<dd>
1180<p>
1181 Match the regexp limiting patterns without regard to letters case.
1182</p>
1183</dd>
1184<dt>
Junio C Hamanoeb415992008-06-08 22:49:471185-E
1186</dt>
1187<dt>
1188--extended-regexp
Junio C Hamanob0e02952008-01-19 08:02:001189</dt>
1190<dd>
1191<p>
1192 Consider the limiting patterns to be extended regular expressions
1193 instead of the default basic regular expressions.
1194</p>
1195</dd>
1196<dt>
Junio C Hamanoeb415992008-06-08 22:49:471197-F
1198</dt>
1199<dt>
1200--fixed-strings
Junio C Hamano24bc09a2008-02-28 00:27:441201</dt>
1202<dd>
1203<p>
1204 Consider the limiting patterns to be fixed strings (don't interpret
1205 pattern as a regular expression).
1206</p>
1207</dd>
1208<dt>
Junio C Hamanob0e02952008-01-19 08:02:001209--remove-empty
1210</dt>
1211<dd>
1212<p>
1213 Stop when a given path disappears from the tree.
1214</p>
1215</dd>
1216<dt>
Junio C Hamanob0e02952008-01-19 08:02:001217--no-merges
1218</dt>
1219<dd>
1220<p>
1221 Do not print commits with more than one parent.
1222</p>
1223</dd>
1224<dt>
1225--first-parent
1226</dt>
1227<dd>
1228<p>
1229 Follow only the first parent commit upon seeing a merge
1230 commit. This option can give a better overview when
1231 viewing the evolution of a particular topic branch,
1232 because merges into a topic branch tend to be only about
1233 adjusting to updated upstream from time to time, and
1234 this option allows you to ignore the individual commits
1235 brought in to your history by such a merge.
1236</p>
1237</dd>
1238<dt>
1239--not
1240</dt>
1241<dd>
1242<p>
1243 Reverses the meaning of the <em>&#94;</em> prefix (or lack thereof)
1244 for all following revision specifiers, up to the next <em>--not</em>.
1245</p>
1246</dd>
1247<dt>
1248--all
1249</dt>
1250<dd>
1251<p>
1252 Pretend as if all the refs in <tt>$GIT_DIR/refs/</tt> are listed on the
1253 command line as <em>&lt;commit&gt;</em>.
1254</p>
1255</dd>
1256<dt>
Junio C Hamano50819852008-11-19 02:07:561257--branches
1258</dt>
1259<dd>
1260<p>
1261 Pretend as if all the refs in <tt>$GIT_DIR/refs/heads</tt> are listed
1262 on the command line as <em>&lt;commit&gt;</em>.
1263</p>
1264</dd>
1265<dt>
1266--tags
1267</dt>
1268<dd>
1269<p>
1270 Pretend as if all the refs in <tt>$GIT_DIR/refs/tags</tt> are listed
1271 on the command line as <em>&lt;commit&gt;</em>.
1272</p>
1273</dd>
1274<dt>
1275--remotes
1276</dt>
1277<dd>
1278<p>
1279 Pretend as if all the refs in <tt>$GIT_DIR/refs/remotes</tt> are listed
1280 on the command line as <em>&lt;commit&gt;</em>.
1281</p>
1282</dd>
1283<dt>
Junio C Hamanob0e02952008-01-19 08:02:001284--cherry-pick
1285</dt>
1286<dd>
1287<p>
1288 Omit any commit that introduces the same change as
1289 another commit on the "other side" when the set of
1290 commits are limited with symmetric difference.<br />
1291For example, if you have two branches, <tt>A</tt> and <tt>B</tt>, a usual way
1292to list all commits on only one side of them is with
1293<tt>--left-right</tt>, like the example above in the description of
1294that option. It however shows the commits that were cherry-picked
1295from the other branch (for example, "3rd on b" may be cherry-picked
1296from branch A). With this option, such pairs of commits are
1297excluded from the output.
1298</p>
1299</dd>
1300<dt>
Junio C Hamanoeb415992008-06-08 22:49:471301-g
1302</dt>
1303<dt>
1304--walk-reflogs
Junio C Hamanob0e02952008-01-19 08:02:001305</dt>
1306<dd>
1307<p>
1308 Instead of walking the commit ancestry chain, walk
1309 reflog entries from the most recent one to older ones.
1310 When this option is used you cannot specify commits to
1311 exclude (that is, <em>&#94;commit</em>, <em>commit1..commit2</em>,
1312 nor <em>commit1&#8230;commit2</em> notations cannot be used).<br />
1313With <em>--pretty</em> format other than oneline (for obvious reasons),
1314this causes the output to have two extra lines of information
1315taken from the reflog. By default, <em>commit@{Nth}</em> notation is
1316used in the output. When the starting commit is specified as
Junio C Hamano1d368882008-08-11 22:03:101317<em>commit@{now}</em>, output also uses <em>commit@{timestamp}</em> notation
Junio C Hamanob0e02952008-01-19 08:02:001318instead. Under <em>--pretty=oneline</em>, the commit message is
1319prefixed with this information on the same line.
Junio C Hamano1d368882008-08-11 22:03:101320This option cannot be combined with <em>--reverse</em>.
1321See also <a href="git-reflog.html">git-reflog(1)</a>.
Junio C Hamanob0e02952008-01-19 08:02:001322</p>
Junio C Hamanob0e02952008-01-19 08:02:001323</dd>
1324<dt>
1325--merge
1326</dt>
1327<dd>
1328<p>
1329 After a failed merge, show refs that touch files having a
1330 conflict and don't exist on all heads to merge.
1331</p>
1332</dd>
1333<dt>
1334--boundary
1335</dt>
1336<dd>
1337<p>
1338 Output uninteresting commits at the boundary, which are usually
1339 not shown.
1340</p>
1341</dd>
Junio C Hamanoa76cb0d2008-08-13 20:04:101342</dl></div>
1343<h3 id="_history_simplification">History Simplification</h3><div style="clear:left"></div>
Junio C Hamano28363492008-11-14 08:26:311344<div class="para"><p>Sometimes you are only interested in parts of the history, for example the
1345commits modifying a particular &lt;path&gt;. But there are two parts of
1346<em>History Simplification</em>, one part is selecting the commits and the other
1347is how to do it, as there are various strategies to simplify the history.</p></div>
1348<div class="para"><p>The following options select the commits to be shown:</p></div>
1349<div class="vlist"><dl>
1350<dt>
1351&lt;paths&gt;
1352</dt>
1353<dd>
1354<p>
1355 Commits modifying the given &lt;paths&gt; are selected.
1356</p>
1357</dd>
1358<dt>
1359--simplify-by-decoration
1360</dt>
1361<dd>
1362<p>
1363 Commits that are referred by some branch or tag are selected.
1364</p>
1365</dd>
1366</dl></div>
1367<div class="para"><p>Note that extra commits can be shown to give a meaningful history.</p></div>
1368<div class="para"><p>The following options affect the way the simplification is performed:</p></div>
1369<div class="vlist"><dl>
1370<dt>
1371Default mode
1372</dt>
1373<dd>
1374<p>
1375 Simplifies the history to the simplest history explaining the
1376 final state of the tree. Simplest because it prunes some side
1377 branches if the end result is the same (i.e. merging branches
1378 with the same content)
1379</p>
1380</dd>
1381<dt>
1382--full-history
1383</dt>
1384<dd>
1385<p>
1386 As the default mode but does not prune some history.
1387</p>
1388</dd>
1389<dt>
1390--dense
1391</dt>
1392<dd>
1393<p>
1394 Only the selected commits are shown, plus some to have a
1395 meaningful history.
1396</p>
1397</dd>
1398<dt>
1399--sparse
1400</dt>
1401<dd>
1402<p>
1403 All commits in the simplified history are shown.
1404</p>
1405</dd>
1406<dt>
1407--simplify-merges
1408</dt>
1409<dd>
1410<p>
1411 Additional option to <em>--full-history</em> to remove some needless
1412 merges from the resulting history, as there are no selected
1413 commits contributing to this merge.
1414</p>
1415</dd>
1416</dl></div>
1417<div class="para"><p>A more detailed explanation follows.</p></div>
Junio C Hamanoa76cb0d2008-08-13 20:04:101418<div class="para"><p>Suppose you specified <tt>foo</tt> as the &lt;paths&gt;. We shall call commits
1419that modify <tt>foo</tt> !TREESAME, and the rest TREESAME. (In a diff
1420filtered for <tt>foo</tt>, they look different and equal, respectively.)</p></div>
1421<div class="para"><p>In the following, we will always refer to the same example history to
1422illustrate the differences between simplification settings. We assume
1423that you are filtering for a file <tt>foo</tt> in this commit graph:</p></div>
1424<div class="listingblock">
1425<div class="content">
1426<pre><tt> .-A---M---N---O---P
1427 / / / / /
1428 I B C D E
1429 \ / / / /
1430 `-------------'</tt></pre>
1431</div></div>
1432<div class="para"><p>The horizontal line of history A--P is taken to be the first parent of
1433each merge. The commits are:</p></div>
1434<div class="ilist"><ul>
1435<li>
1436<p>
1437<tt>I</tt> is the initial commit, in which <tt>foo</tt> exists with contents
1438 "asdf", and a file <tt>quux</tt> exists with contents "quux". Initial
1439 commits are compared to an empty tree, so <tt>I</tt> is !TREESAME.
1440</p>
1441</li>
1442<li>
1443<p>
1444In <tt>A</tt>, <tt>foo</tt> contains just "foo".
1445</p>
1446</li>
1447<li>
1448<p>
1449<tt>B</tt> contains the same change as <tt>A</tt>. Its merge <tt>M</tt> is trivial and
1450 hence TREESAME to all parents.
1451</p>
1452</li>
1453<li>
1454<p>
1455<tt>C</tt> does not change <tt>foo</tt>, but its merge <tt>N</tt> changes it to "foobar",
1456 so it is not TREESAME to any parent.
1457</p>
1458</li>
1459<li>
1460<p>
1461<tt>D</tt> sets <tt>foo</tt> to "baz". Its merge <tt>O</tt> combines the strings from
1462 <tt>N</tt> and <tt>D</tt> to "foobarbaz"; i.e., it is not TREESAME to any parent.
1463</p>
1464</li>
1465<li>
1466<p>
1467<tt>E</tt> changes <tt>quux</tt> to "xyzzy", and its merge <tt>P</tt> combines the
1468 strings to "quux xyzzy". Despite appearing interesting, <tt>P</tt> is
1469 TREESAME to all parents.
1470</p>
1471</li>
1472</ul></div>
1473<div class="para"><p><em>rev-list</em> walks backwards through history, including or excluding
1474commits based on whether <em>--full-history</em> and/or parent rewriting
1475(via <em>--parents</em> or <em>--children</em>) are used. The following settings
1476are available.</p></div>
1477<div class="vlist"><dl>
1478<dt>
1479Default mode
1480</dt>
1481<dd>
1482<p>
1483 Commits are included if they are not TREESAME to any parent
1484 (though this can be changed, see <em>--sparse</em> below). If the
1485 commit was a merge, and it was TREESAME to one parent, follow
1486 only that parent. (Even if there are several TREESAME
1487 parents, follow only one of them.) Otherwise, follow all
1488 parents.
1489</p>
1490<div class="para"><p>This results in:</p></div>
1491<div class="listingblock">
1492<div class="content">
1493<pre><tt> .-A---N---O
1494 / /
1495 I---------D</tt></pre>
1496</div></div>
1497<div class="para"><p>Note how the rule to only follow the TREESAME parent, if one is
1498available, removed <tt>B</tt> from consideration entirely. <tt>C</tt> was
1499considered via <tt>N</tt>, but is TREESAME. Root commits are compared to an
1500empty tree, so <tt>I</tt> is !TREESAME.</p></div>
1501<div class="para"><p>Parent/child relations are only visible with --parents, but that does
1502not affect the commits selected in default mode, so we have shown the
1503parent lines.</p></div>
1504</dd>
1505<dt>
1506--full-history without parent rewriting
1507</dt>
1508<dd>
1509<p>
1510 This mode differs from the default in one point: always follow
1511 all parents of a merge, even if it is TREESAME to one of them.
1512 Even if more than one side of the merge has commits that are
1513 included, this does not imply that the merge itself is! In
1514 the example, we get
1515</p>
1516<div class="listingblock">
1517<div class="content">
1518<pre><tt> I A B N D O</tt></pre>
1519</div></div>
1520<div class="para"><p><tt>P</tt> and <tt>M</tt> were excluded because they are TREESAME to a parent. <tt>E</tt>,
1521<tt>C</tt> and <tt>B</tt> were all walked, but only <tt>B</tt> was !TREESAME, so the others
1522do not appear.</p></div>
1523<div class="para"><p>Note that without parent rewriting, it is not really possible to talk
1524about the parent/child relationships between the commits, so we show
1525them disconnected.</p></div>
1526</dd>
1527<dt>
1528--full-history with parent rewriting
1529</dt>
1530<dd>
1531<p>
1532 Ordinary commits are only included if they are !TREESAME
1533 (though this can be changed, see <em>--sparse</em> below).
1534</p>
1535<div class="para"><p>Merges are always included. However, their parent list is rewritten:
1536Along each parent, prune away commits that are not included
1537themselves. This results in</p></div>
1538<div class="listingblock">
1539<div class="content">
1540<pre><tt> .-A---M---N---O---P
1541 / / / / /
1542 I B / D /
1543 \ / / / /
1544 `-------------'</tt></pre>
1545</div></div>
1546<div class="para"><p>Compare to <em>--full-history</em> without rewriting above. Note that <tt>E</tt>
1547was pruned away because it is TREESAME, but the parent list of P was
1548rewritten to contain <tt>E</tt>'s parent <tt>I</tt>. The same happened for <tt>C</tt> and
1549<tt>N</tt>. Note also that <tt>P</tt> was included despite being TREESAME.</p></div>
1550</dd>
1551</dl></div>
1552<div class="para"><p>In addition to the above settings, you can change whether TREESAME
1553affects inclusion:</p></div>
1554<div class="vlist"><dl>
Junio C Hamanob0e02952008-01-19 08:02:001555<dt>
Junio C Hamanoeb415992008-06-08 22:49:471556--dense
1557</dt>
Junio C Hamanoa76cb0d2008-08-13 20:04:101558<dd>
1559<p>
1560 Commits that are walked are included if they are not TREESAME
1561 to any parent.
1562</p>
1563</dd>
Junio C Hamanoeb415992008-06-08 22:49:471564<dt>
1565--sparse
Junio C Hamanob0e02952008-01-19 08:02:001566</dt>
1567<dd>
1568<p>
Junio C Hamanoa76cb0d2008-08-13 20:04:101569 All commits that are walked are included.
Junio C Hamanob0e02952008-01-19 08:02:001570</p>
Junio C Hamanoa76cb0d2008-08-13 20:04:101571<div class="para"><p>Note that without <em>--full-history</em>, this still simplifies merges: if
1572one of the parents is TREESAME, we follow only that one, so the other
1573sides of the merge are never walked.</p></div>
Junio C Hamanob0e02952008-01-19 08:02:001574</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311575</dl></div>
Junio C Hamanoa2f46622008-09-03 05:20:311576<div class="para"><p>Finally, there is a fourth simplification mode available:</p></div>
1577<div class="vlist"><dl>
1578<dt>
1579--simplify-merges
1580</dt>
1581<dd>
1582<p>
1583 First, build a history graph in the same way that
1584 <em>--full-history</em> with parent rewriting does (see above).
1585</p>
1586<div class="para"><p>Then simplify each commit <tt>C</tt> to its replacement <tt>C'</tt> in the final
1587history according to the following rules:</p></div>
1588<div class="ilist"><ul>
1589<li>
1590<p>
1591Set <tt>C'</tt> to <tt>C</tt>.<br />
1592</p>
1593</li>
1594<li>
1595<p>
1596Replace each parent <tt>P</tt> of <tt>C'</tt> with its simplification <tt>P'</tt>. In
1597 the process, drop parents that are ancestors of other parents, and
1598 remove duplicates.<br />
1599</p>
1600</li>
1601<li>
1602<p>
1603If after this parent rewriting, <tt>C'</tt> is a root or merge commit (has
1604 zero or &gt;1 parents), a boundary commit, or !TREESAME, it remains.
1605 Otherwise, it is replaced with its only parent.
1606</p>
1607</li>
1608</ul></div>
1609<div class="para"><p>The effect of this is best shown by way of comparing to
1610<em>--full-history</em> with parent rewriting. The example turns into:</p></div>
1611<div class="listingblock">
1612<div class="content">
1613<pre><tt> .-A---M---N---O
1614 / / /
1615 I B D
1616 \ / /
1617 `---------'</tt></pre>
1618</div></div>
1619<div class="para"><p>Note the major differences in <tt>N</tt> and <tt>P</tt> over <em>--full-history</em>:</p></div>
1620<div class="ilist"><ul>
1621<li>
1622<p>
1623<tt>N</tt>'s parent list had <tt>I</tt> removed, because it is an ancestor of the
1624 other parent <tt>M</tt>. Still, <tt>N</tt> remained because it is !TREESAME.<br />
1625</p>
1626</li>
1627<li>
1628<p>
1629<tt>P</tt>'s parent list similarly had <tt>I</tt> removed. <tt>P</tt> was then
1630 removed completely, because it had one parent and is TREESAME.
1631</p>
1632</li>
1633</ul></div>
1634</dd>
1635</dl></div>
Junio C Hamano28363492008-11-14 08:26:311636<div class="para"><p>The <em>--simplify-by-decoration</em> option allows you to view only the
1637big picture of the topology of the history, by omitting commits
1638that are not referenced by tags. Commits are marked as !TREESAME
1639(in other words, kept after history simplification rules described
1640above) if (1) they are referenced by tags, or (2) they change the
1641contents of the paths given on the command line. All other
1642commits are marked as TREESAME (subject to be simplified away).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:311643<h3 id="_commit_ordering">Commit Ordering</h3><div style="clear:left"></div>
1644<div class="para"><p>By default, the commits are shown in reverse chronological order.</p></div>
1645<div class="vlist"><dl>
Junio C Hamanob0e02952008-01-19 08:02:001646<dt>
1647--topo-order
1648</dt>
1649<dd>
1650<p>
1651 This option makes them appear in topological order (i.e.
1652 descendant commits are shown before their parents).
1653</p>
1654</dd>
1655<dt>
1656--date-order
1657</dt>
1658<dd>
1659<p>
1660 This option is similar to <em>--topo-order</em> in the sense that no
1661 parent comes before all of its children, but otherwise things
1662 are still ordered in the commit timestamp order.
1663</p>
1664</dd>
1665<dt>
1666--reverse
1667</dt>
1668<dd>
1669<p>
1670 Output the commits in reverse order.
1671 Cannot be combined with <em>--walk-reflogs</em>.
1672</p>
1673</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311674</dl></div>
1675<h3 id="_object_traversal">Object Traversal</h3><div style="clear:left"></div>
1676<div class="para"><p>These options are mostly targeted for packing of git repositories.</p></div>
1677<div class="vlist"><dl>
Junio C Hamanob0e02952008-01-19 08:02:001678<dt>
1679--objects
1680</dt>
1681<dd>
1682<p>
1683 Print the object IDs of any object referenced by the listed
1684 commits. <em>--objects foo ^bar</em> thus means "send me
1685 all object IDs which I need to download if I have the commit
1686 object <em>bar</em>, but not <em>foo</em>".
1687</p>
1688</dd>
1689<dt>
1690--objects-edge
1691</dt>
1692<dd>
1693<p>
1694 Similar to <em>--objects</em>, but also print the IDs of excluded
1695 commits prefixed with a "-" character. This is used by
1696 <a href="git-pack-objects.html">git-pack-objects(1)</a> to build "thin" pack, which records
1697 objects in deltified form based on objects contained in these
1698 excluded commits to reduce network traffic.
1699</p>
1700</dd>
1701<dt>
1702--unpacked
1703</dt>
1704<dd>
1705<p>
1706 Only useful with <em>--objects</em>; print the object IDs that are not
1707 in packs.
1708</p>
1709</dd>
1710<dt>
1711--no-walk
1712</dt>
1713<dd>
1714<p>
1715 Only show the given revs, but do not traverse their ancestors.
1716</p>
1717</dd>
1718<dt>
1719--do-walk
1720</dt>
1721<dd>
1722<p>
1723 Overrides a previous --no-walk.
1724</p>
1725</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311726</dl></div>
Junio C Hamano0430e3a2007-05-15 03:13:171727</div>
Junio C Hamanoba4b9282008-07-06 05:20:311728<h2 id="_pretty_formats">PRETTY FORMATS</h2>
Junio C Hamano0430e3a2007-05-15 03:13:171729<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311730<div class="para"><p>If the commit is a merge, and if the pretty-format
Junio C Hamano0430e3a2007-05-15 03:13:171731is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1732inserted before the <em>Author:</em> line. This line begins with
1733"Merge: " and the sha1s of ancestral commits are printed,
1734separated by spaces. Note that the listed commits may not
1735necessarily be the list of the <strong>direct</strong> parent commits if you
1736have limited your view of history: for example, if you are
1737only interested in changes related to a certain directory or
Junio C Hamanoba4b9282008-07-06 05:20:311738file.</p></div>
1739<div class="para"><p>Here are some additional details for each format:</p></div>
1740<div class="ilist"><ul>
Junio C Hamanoa340aaa2006-11-23 02:47:331741<li>
1742<p>
1743<em>oneline</em>
1744</p>
1745<div class="literalblock">
1746<div class="content">
1747<pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
1748</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311749<div class="para"><p>This is designed to be as compact as possible.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:331750</li>
1751<li>
1752<p>
1753<em>short</em>
1754</p>
1755<div class="literalblock">
1756<div class="content">
1757<pre><tt>commit &lt;sha1&gt;
1758Author: &lt;author&gt;</tt></pre>
1759</div></div>
1760<div class="literalblock">
1761<div class="content">
1762<pre><tt>&lt;title line&gt;</tt></pre>
1763</div></div>
1764</li>
1765<li>
1766<p>
1767<em>medium</em>
1768</p>
1769<div class="literalblock">
1770<div class="content">
1771<pre><tt>commit &lt;sha1&gt;
1772Author: &lt;author&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181773Date: &lt;author date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331774</div></div>
1775<div class="literalblock">
1776<div class="content">
1777<pre><tt>&lt;title line&gt;</tt></pre>
1778</div></div>
1779<div class="literalblock">
1780<div class="content">
1781<pre><tt>&lt;full commit message&gt;</tt></pre>
1782</div></div>
1783</li>
1784<li>
1785<p>
1786<em>full</em>
1787</p>
1788<div class="literalblock">
1789<div class="content">
1790<pre><tt>commit &lt;sha1&gt;
1791Author: &lt;author&gt;
1792Commit: &lt;committer&gt;</tt></pre>
1793</div></div>
1794<div class="literalblock">
1795<div class="content">
1796<pre><tt>&lt;title line&gt;</tt></pre>
1797</div></div>
1798<div class="literalblock">
1799<div class="content">
1800<pre><tt>&lt;full commit message&gt;</tt></pre>
1801</div></div>
1802</li>
1803<li>
1804<p>
1805<em>fuller</em>
1806</p>
1807<div class="literalblock">
1808<div class="content">
1809<pre><tt>commit &lt;sha1&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181810Author: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311811AuthorDate: &lt;author date&gt;
Junio C Hamano6a3c8272008-12-19 21:38:181812Commit: &lt;committer&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311813CommitDate: &lt;committer date&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331814</div></div>
1815<div class="literalblock">
1816<div class="content">
1817<pre><tt>&lt;title line&gt;</tt></pre>
1818</div></div>
1819<div class="literalblock">
1820<div class="content">
1821<pre><tt>&lt;full commit message&gt;</tt></pre>
1822</div></div>
1823</li>
1824<li>
1825<p>
1826<em>email</em>
1827</p>
1828<div class="literalblock">
1829<div class="content">
1830<pre><tt>From &lt;sha1&gt; &lt;date&gt;
1831From: &lt;author&gt;
Junio C Hamanoba4b9282008-07-06 05:20:311832Date: &lt;author date&gt;
Junio C Hamanoa340aaa2006-11-23 02:47:331833Subject: [PATCH] &lt;title line&gt;</tt></pre>
1834</div></div>
1835<div class="literalblock">
1836<div class="content">
Junio C Hamano0430e3a2007-05-15 03:13:171837<pre><tt>&lt;full commit message&gt;</tt></pre>
Junio C Hamanoa340aaa2006-11-23 02:47:331838</div></div>
1839</li>
1840<li>
1841<p>
1842<em>raw</em>
1843</p>
Junio C Hamanoba4b9282008-07-06 05:20:311844<div class="para"><p>The <em>raw</em> format shows the entire commit exactly as
Junio C Hamanoa340aaa2006-11-23 02:47:331845stored in the commit object. Notably, the SHA1s are
1846displayed in full, regardless of whether --abbrev or
1847--no-abbrev are used, and <em>parents</em> information show the
1848true parent commits, without taking grafts nor history
Junio C Hamanoba4b9282008-07-06 05:20:311849simplification into account.</p></div>
Junio C Hamanoa340aaa2006-11-23 02:47:331850</li>
Junio C Hamanoa3fd83c2007-03-02 10:34:361851<li>
1852<p>
1853<em>format:</em>
1854</p>
Junio C Hamanoba4b9282008-07-06 05:20:311855<div class="para"><p>The <em>format:</em> format allows you to specify which information
Junio C Hamanoa3fd83c2007-03-02 10:34:361856you want to show. It works a little bit like printf format,
1857with the notable exception that you get a newline with <em>%n</em>
Junio C Hamanoba4b9282008-07-06 05:20:311858instead of <em>\n</em>.</p></div>
1859<div class="para"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
1860would show something like this:</p></div>
Junio C Hamano0430e3a2007-05-15 03:13:171861<div class="listingblock">
1862<div class="content">
1863<pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
1864The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;
1865</tt></pre>
1866</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:311867<div class="para"><p>The placeholders are:</p></div>
1868<div class="ilist"><ul>
Junio C Hamanoa3fd83c2007-03-02 10:34:361869<li>
1870<p>
1871<em>%H</em>: commit hash
1872</p>
1873</li>
1874<li>
1875<p>
1876<em>%h</em>: abbreviated commit hash
1877</p>
1878</li>
1879<li>
1880<p>
1881<em>%T</em>: tree hash
1882</p>
1883</li>
1884<li>
1885<p>
1886<em>%t</em>: abbreviated tree hash
1887</p>
1888</li>
1889<li>
1890<p>
1891<em>%P</em>: parent hashes
1892</p>
1893</li>
1894<li>
1895<p>
1896<em>%p</em>: abbreviated parent hashes
1897</p>
1898</li>
1899<li>
1900<p>
1901<em>%an</em>: author name
1902</p>
1903</li>
1904<li>
1905<p>
Junio C Hamano8bc410e2009-02-15 10:38:191906<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>)
Junio C Hamanof5a93622008-07-16 03:23:571907</p>
1908</li>
1909<li>
1910<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361911<em>%ae</em>: author email
1912</p>
1913</li>
1914<li>
1915<p>
Junio C Hamano8bc410e2009-02-15 10:38:191916<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>)
1917</p>
1918</li>
1919<li>
1920<p>
Junio C Hamanoa387df32008-08-29 08:56:581921<em>%ad</em>: author date (format respects --date= option)
Junio C Hamanoa3fd83c2007-03-02 10:34:361922</p>
1923</li>
1924<li>
1925<p>
1926<em>%aD</em>: author date, RFC2822 style
1927</p>
1928</li>
1929<li>
1930<p>
1931<em>%ar</em>: author date, relative
1932</p>
1933</li>
1934<li>
1935<p>
1936<em>%at</em>: author date, UNIX timestamp
1937</p>
1938</li>
1939<li>
1940<p>
Junio C Hamano02f130b2007-07-14 08:26:561941<em>%ai</em>: author date, ISO 8601 format
1942</p>
1943</li>
1944<li>
1945<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361946<em>%cn</em>: committer name
1947</p>
1948</li>
1949<li>
1950<p>
Junio C Hamano8bc410e2009-02-15 10:38:191951<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>)
Junio C Hamanof5a93622008-07-16 03:23:571952</p>
1953</li>
1954<li>
1955<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361956<em>%ce</em>: committer email
1957</p>
1958</li>
1959<li>
1960<p>
Junio C Hamano8bc410e2009-02-15 10:38:191961<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>)
1962</p>
1963</li>
1964<li>
1965<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361966<em>%cd</em>: committer date
1967</p>
1968</li>
1969<li>
1970<p>
1971<em>%cD</em>: committer date, RFC2822 style
1972</p>
1973</li>
1974<li>
1975<p>
1976<em>%cr</em>: committer date, relative
1977</p>
1978</li>
1979<li>
1980<p>
1981<em>%ct</em>: committer date, UNIX timestamp
1982</p>
1983</li>
1984<li>
1985<p>
Junio C Hamano02f130b2007-07-14 08:26:561986<em>%ci</em>: committer date, ISO 8601 format
1987</p>
1988</li>
1989<li>
1990<p>
Junio C Hamano5e4d8de2008-09-19 06:27:021991<em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
1992</p>
1993</li>
1994<li>
1995<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:361996<em>%e</em>: encoding
1997</p>
1998</li>
1999<li>
2000<p>
2001<em>%s</em>: subject
2002</p>
2003</li>
2004<li>
2005<p>
Junio C Hamano5f9a6f02009-04-06 08:26:562006<em>%f</em>: sanitized subject line, suitable for a filename
2007</p>
2008</li>
2009<li>
2010<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:362011<em>%b</em>: body
2012</p>
2013</li>
2014<li>
2015<p>
2016<em>%Cred</em>: switch color to red
2017</p>
2018</li>
2019<li>
2020<p>
2021<em>%Cgreen</em>: switch color to green
2022</p>
2023</li>
2024<li>
2025<p>
2026<em>%Cblue</em>: switch color to blue
2027</p>
2028</li>
2029<li>
2030<p>
2031<em>%Creset</em>: reset color
2032</p>
2033</li>
2034<li>
2035<p>
Junio C Hamanocc0cb312009-01-22 03:38:502036<em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
2037</p>
2038</li>
2039<li>
2040<p>
Junio C Hamanod9e0e5d2007-04-14 16:22:042041<em>%m</em>: left, right or boundary mark
2042</p>
2043</li>
2044<li>
2045<p>
Junio C Hamanoa3fd83c2007-03-02 10:34:362046<em>%n</em>: newline
2047</p>
Junio C Hamano0430e3a2007-05-15 03:13:172048</li>
Junio C Hamanob78d2592008-04-09 09:39:082049<li>
2050<p>
2051<em>%x00</em>: print a byte from a hex code
2052</p>
2053</li>
Junio C Hamanoba4b9282008-07-06 05:20:312054</ul></div>
Junio C Hamanoa3fd83c2007-03-02 10:34:362055</li>
Junio C Hamano6fb124c2008-06-13 10:04:012056<li>
2057<p>
2058<em>tformat:</em>
2059</p>
Junio C Hamanoba4b9282008-07-06 05:20:312060<div class="para"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
Junio C Hamano6fb124c2008-06-13 10:04:012061provides "terminator" semantics instead of "separator" semantics. In
2062other words, each commit has the message terminator character (usually a
2063newline) appended, rather than a separator placed between entries.
2064This means that the final entry of a single-line format will be properly
2065terminated with a new line, just as the "oneline" format does.
Junio C Hamanoba4b9282008-07-06 05:20:312066For example:</p></div>
Junio C Hamano6fb124c2008-06-13 10:04:012067<div class="listingblock">
2068<div class="content">
2069<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
2070 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
20714da45be
20727134973 -- NO NEWLINE
2073
2074$ git log -2 --pretty=tformat:%h 4da45bef \
2075 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
20764da45be
20777134973</tt></pre>
2078</div></div>
Junio C Hamano0a235222009-03-06 08:21:092079<div class="para"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
2080as if it has <tt>tformat:</tt> in front of it. For example, these two are
2081equivalent:</p></div>
2082<div class="listingblock">
2083<div class="content">
2084<pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
2085$ git log -2 --pretty=%h 4da45bef</tt></pre>
2086</div></div>
Junio C Hamano6fb124c2008-06-13 10:04:012087</li>
Junio C Hamanoba4b9282008-07-06 05:20:312088</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:232089</div>
Junio C Hamanoba4b9282008-07-06 05:20:312090<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano00b8b632007-12-07 09:50:492091<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312092<div class="para"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano00b8b632007-12-07 09:50:492093with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
2094"git log" with the "-p" option, they
2095do not produce the output described above; instead they produce a
2096patch file. You can customize the creation of such patches via the
Junio C Hamanoba4b9282008-07-06 05:20:312097GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2098<div class="para"><p>What the -p option produces is slightly different from the traditional
2099diff format.</p></div>
2100<div class="olist"><ol>
Junio C Hamano00b8b632007-12-07 09:50:492101<li>
2102<p>
2103It is preceded with a "git diff" header, that looks like
2104 this:
2105</p>
2106<div class="literalblock">
2107<div class="content">
2108<pre><tt>diff --git a/file1 b/file2</tt></pre>
2109</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312110<div class="para"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
Junio C Hamano00b8b632007-12-07 09:50:492111involved. Especially, even for a creation or a deletion,
Junio C Hamano5e4d8de2008-09-19 06:27:022112<tt>/dev/null</tt> is _not_ used in place of <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:312113<div class="para"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
Junio C Hamano00b8b632007-12-07 09:50:492114name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:312115the file that rename/copy produces, respectively.</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492116</li>
2117<li>
2118<p>
2119It is followed by one or more extended header lines:
2120</p>
2121<div class="literalblock">
2122<div class="content">
2123<pre><tt>old mode &lt;mode&gt;
2124new mode &lt;mode&gt;
2125deleted file mode &lt;mode&gt;
2126new file mode &lt;mode&gt;
2127copy from &lt;path&gt;
2128copy to &lt;path&gt;
2129rename from &lt;path&gt;
2130rename to &lt;path&gt;
2131similarity index &lt;number&gt;
2132dissimilarity index &lt;number&gt;
2133index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
2134</div></div>
2135</li>
2136<li>
2137<p>
2138TAB, LF, double quote and backslash characters in pathnames
2139 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
2140 If there is need for such substitution then the whole
2141 pathname is put in double quotes.
2142</p>
2143</li>
Junio C Hamanoba4b9282008-07-06 05:20:312144</ol></div>
2145<div class="para"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano00b8b632007-12-07 09:50:492146the dissimilarity index is the percentage of changed lines. It
2147is a rounded down integer, followed by a percent sign. The
2148similarity index value of 100% is thus reserved for two equal
2149files, while 100% dissimilarity means that no line from the old
Junio C Hamanoba4b9282008-07-06 05:20:312150file made it into the new one.</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492151</div>
Junio C Hamanoba4b9282008-07-06 05:20:312152<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamano00b8b632007-12-07 09:50:492153<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312154<div class="para"><p>"git-diff-tree", "git-diff-files" and "git-diff" can take <em>-c</em> or
Junio C Hamano00b8b632007-12-07 09:50:492155<em>--cc</em> option to produce <em>combined diff</em>. For showing a merge commit
2156with "git log -p", this is the default format.
Junio C Hamanoba4b9282008-07-06 05:20:312157A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492158<div class="listingblock">
2159<div class="content">
2160<pre><tt>diff --combined describe.c
2161index fabadb8,cc95eb0..4866510
2162--- a/describe.c
2163+++ b/describe.c
2164@@@ -98,20 -98,12 +98,20 @@@
2165 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
2166 }
2167
2168- static void describe(char *arg)
2169 -static void describe(struct commit *cmit, int last_one)
2170++static void describe(char *arg, int last_one)
2171 {
2172 + unsigned char sha1[20];
2173 + struct commit *cmit;
2174 struct commit_list *list;
2175 static int initialized = 0;
2176 struct commit_name *n;
2177
2178 + if (get_sha1(arg, sha1) &lt; 0)
2179 + usage(describe_usage);
2180 + cmit = lookup_commit_reference(sha1);
2181 + if (!cmit)
2182 + usage(describe_usage);
2183 +
2184 if (!initialized) {
2185 initialized = 1;
2186 for_each_ref(get_name);</tt></pre>
2187</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312188<div class="olist"><ol>
Junio C Hamano00b8b632007-12-07 09:50:492189<li>
2190<p>
2191It is preceded with a "git diff" header, that looks like
2192 this (when <em>-c</em> option is used):
2193</p>
2194<div class="literalblock">
2195<div class="content">
2196<pre><tt>diff --combined file</tt></pre>
2197</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312198<div class="para"><p>or like this (when <em>--cc</em> option is used):</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492199<div class="literalblock">
2200<div class="content">
Junio C Hamano0868a302008-07-22 09:20:442201<pre><tt>diff --cc file</tt></pre>
Junio C Hamano00b8b632007-12-07 09:50:492202</div></div>
2203</li>
2204<li>
2205<p>
2206It is followed by one or more extended header lines
2207 (this example shows a merge with two parents):
2208</p>
2209<div class="literalblock">
2210<div class="content">
2211<pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
2212mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2213new file mode &lt;mode&gt;
2214deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
2215</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312216<div class="para"><p>The <tt>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</tt> line appears only if at least one of
Junio C Hamano00b8b632007-12-07 09:50:492217the &lt;mode&gt; is different from the rest. Extended headers with
2218information about detected contents movement (renames and
2219copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:312220&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492221</li>
2222<li>
2223<p>
2224It is followed by two-line from-file/to-file header
2225</p>
2226<div class="literalblock">
2227<div class="content">
2228<pre><tt>--- a/file
2229+++ b/file</tt></pre>
2230</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312231<div class="para"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamano00b8b632007-12-07 09:50:492232format, <tt>/dev/null</tt> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:312233files.</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492234</li>
2235<li>
2236<p>
2237Chunk header format is modified to prevent people from
2238 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
2239 was created for review of merge commit changes, and was not
2240 meant for apply. The change is similar to the change in the
2241 extended <em>index</em> header:
2242</p>
2243<div class="literalblock">
2244<div class="content">
2245<pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
2246</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312247<div class="para"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
2248header for combined diff format.</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492249</li>
Junio C Hamanoba4b9282008-07-06 05:20:312250</ol></div>
2251<div class="para"><p>Unlike the traditional <em>unified</em> diff format, which shows two
Junio C Hamano00b8b632007-12-07 09:50:492252files A and B with a single column that has <tt>-</tt> (minus &#8212;
2253appears in A but removed in B), <tt>+</tt> (plus &#8212; missing in A but
2254added to B), or <tt>" "</tt> (space &#8212; unchanged) prefix, this format
2255compares two or more files file1, file2,&#8230; with one file X, and
2256shows how X differs from each of fileN. One column for each of
2257fileN is prepended to the output line to note how X's line is
Junio C Hamanoba4b9282008-07-06 05:20:312258different from it.</p></div>
2259<div class="para"><p>A <tt>-</tt> character in the column N means that the line appears in
Junio C Hamano00b8b632007-12-07 09:50:492260fileN but it does not appear in the result. A <tt>+</tt> character
Junio C Hamano54bf1e22008-12-20 06:30:112261in the column N means that the line appears in the result,
Junio C Hamano00b8b632007-12-07 09:50:492262and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:312263added, from the point of view of that parent).</p></div>
2264<div class="para"><p>In the above example output, the function signature was changed
Junio C Hamano00b8b632007-12-07 09:50:492265from both files (hence two <tt>-</tt> removals from both file1 and
Junio C Hamano5e4d8de2008-09-19 06:27:022266file2, plus <tt>++</tt> to mean one line that was added does not appear
Junio C Hamano54bf1e22008-12-20 06:30:112267in either file1 nor file2). Also eight other lines are the same
2268from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:312269<div class="para"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
Junio C Hamano00b8b632007-12-07 09:50:492270merge commit with the merge result (i.e. file1..fileN are the
2271parents). When shown by <tt>git diff-files -c</tt>, it compares the
2272two unresolved merge parents with the working tree file
2273(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:312274"their version").</p></div>
Junio C Hamano00b8b632007-12-07 09:50:492275</div>
Junio C Hamanoba4b9282008-07-06 05:20:312276<h2 id="_examples">Examples</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232277<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312278<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:232279<dt>
2280git log --no-merges
2281</dt>
2282<dd>
2283<p>
2284 Show the whole commit history, but skip any merges
2285</p>
2286</dd>
2287<dt>
2288git log v2.6.12.. include/scsi drivers/scsi
2289</dt>
2290<dd>
2291<p>
2292 Show all commits since version <em>v2.6.12</em> that changed any file
2293 in the include/scsi or drivers/scsi subdirectories
2294</p>
2295</dd>
2296<dt>
Junio C Hamano1bb569e2006-05-05 23:14:252297git log --since="2 weeks ago" -- gitk
Junio C Hamano1a4e8412005-12-27 08:17:232298</dt>
2299<dd>
2300<p>
2301 Show the changes during the last two weeks to the file <em>gitk</em>.
2302 The "--" is necessary to avoid confusion with the <strong>branch</strong> named
2303 <em>gitk</em>
2304</p>
2305</dd>
Junio C Hamanoba7c8d82006-04-15 06:17:422306<dt>
Junio C Hamano7d9e9bd2007-08-29 07:31:472307git log --name-status release..test
Junio C Hamanoba7c8d82006-04-15 06:17:422308</dt>
2309<dd>
2310<p>
2311 Show the commits that are in the "test" branch but not yet
2312 in the "release" branch, along with the list of paths
2313 each commit modifies.
2314</p>
2315</dd>
Junio C Hamano235d53f2007-07-13 00:25:152316<dt>
2317git log --follow builtin-rev-list.c
2318</dt>
2319<dd>
2320<p>
2321 Shows the commits that changed builtin-rev-list.c, including
2322 those commits that occurred before the file was given its
2323 present name.
2324</p>
2325</dd>
Junio C Hamanoba4b9282008-07-06 05:20:312326</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:232327</div>
Junio C Hamanoba4b9282008-07-06 05:20:312328<h2 id="_discussion">Discussion</h2>
Junio C Hamano775a0f42006-12-31 01:19:142329<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312330<div class="para"><p>At the core level, git is character encoding agnostic.</p></div>
2331<div class="ilist"><ul>
Junio C Hamano775a0f42006-12-31 01:19:142332<li>
2333<p>
2334The pathnames recorded in the index and in the tree objects
2335 are treated as uninterpreted sequences of non-NUL bytes.
2336 What readdir(2) returns are what are recorded and compared
2337 with the data git keeps track of, which in turn are expected
2338 to be what lstat(2) and creat(2) accepts. There is no such
2339 thing as pathname encoding translation.
2340</p>
2341</li>
2342<li>
2343<p>
Junio C Hamano54bf1e22008-12-20 06:30:112344The contents of the blob objects are uninterpreted sequences
Junio C Hamano775a0f42006-12-31 01:19:142345 of bytes. There is no encoding translation at the core
2346 level.
2347</p>
2348</li>
2349<li>
2350<p>
Junio C Hamano54bf1e22008-12-20 06:30:112351The commit log messages are uninterpreted sequences of non-NUL
Junio C Hamano775a0f42006-12-31 01:19:142352 bytes.
2353</p>
2354</li>
Junio C Hamanoba4b9282008-07-06 05:20:312355</ul></div>
2356<div class="para"><p>Although we encourage that the commit log messages are encoded
Junio C Hamano775a0f42006-12-31 01:19:142357in UTF-8, both the core and git Porcelain are designed not to
2358force UTF-8 on projects. If all participants of a particular
2359project find it more convenient to use legacy encodings, git
2360does not forbid it. However, there are a few things to keep in
Junio C Hamanoba4b9282008-07-06 05:20:312361mind.</p></div>
2362<div class="olist"><ol>
Junio C Hamano775a0f42006-12-31 01:19:142363<li>
2364<p>
Junio C Hamano37276192008-09-04 00:24:072365<em>git-commit</em> and <em>git-commit-tree</em> issues
Junio C Hamano14b76482008-01-05 10:32:262366 a warning if the commit log message given to it does not look
Junio C Hamano775a0f42006-12-31 01:19:142367 like a valid UTF-8 string, unless you explicitly say your
2368 project uses a legacy encoding. The way to say this is to
Junio C Hamano35bb3f62007-02-19 05:35:532369 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:142370</p>
2371<div class="listingblock">
2372<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:532373<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:142374 commitencoding = ISO-8859-1</tt></pre>
2375</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312376<div class="para"><p>Commit objects created with the above setting record the value
Junio C Hamano35bb3f62007-02-19 05:35:532377of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
Junio C Hamano775a0f42006-12-31 01:19:142378help other people who look at them later. Lack of this header
Junio C Hamanoba4b9282008-07-06 05:20:312379implies that the commit log message is encoded in UTF-8.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:142380</li>
2381<li>
2382<p>
Junio C Hamanoaa17c7c2008-11-03 04:36:582383<em>git-log</em>, <em>git-show</em>, <em>git-blame</em> and friends look at the
2384 <tt>encoding</tt> header of a commit object, and try to re-code the
2385 log message into UTF-8 unless otherwise specified. You can
Junio C Hamano775a0f42006-12-31 01:19:142386 specify the desired output encoding with
Junio C Hamano35bb3f62007-02-19 05:35:532387 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:142388</p>
2389<div class="listingblock">
2390<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:532391<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:142392 logoutputencoding = ISO-8859-1</tt></pre>
2393</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:312394<div class="para"><p>If you do not have this configuration variable, the value of
2395<tt>i18n.commitencoding</tt> is used instead.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:142396</li>
Junio C Hamanoba4b9282008-07-06 05:20:312397</ol></div>
2398<div class="para"><p>Note that we deliberately chose not to re-code the commit log
Junio C Hamano775a0f42006-12-31 01:19:142399message when a commit is made to force UTF-8 at the commit
2400object level, because re-coding to UTF-8 is not necessarily a
Junio C Hamanoba4b9282008-07-06 05:20:312401reversible operation.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:142402</div>
Junio C Hamanoba4b9282008-07-06 05:20:312403<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232404<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312405<div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232406</div>
Junio C Hamanoba4b9282008-07-06 05:20:312407<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232408<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312409<div class="para"><p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232410</div>
Junio C Hamanoba4b9282008-07-06 05:20:312411<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232412<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:312413<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232414</div>
2415<div id="footer">
2416<div id="footer-text">
Junio C Hamanob4a9ede2009-04-08 07:36:322417Last updated 2009-04-08 07:36:11 UTC
Junio C Hamano1a4e8412005-12-27 08:17:232418</div>
2419</div>
2420</body>
2421</html>