Autogenerated HTML docs for v1.7.6-rc1
[git/jnareb-git.git] / git-log.html
blob6a7fa890c65905ee669928db980357c1be9b031e
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-log(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-log(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-log -
411 Show commit logs
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="paragraph"><p><em>git log</em> [&lt;options&gt;] [&lt;since&gt;..&lt;until&gt;] [[--] &lt;path&gt;&#8230;]</p></div>
418 </div>
419 <h2 id="_description">DESCRIPTION</h2>
420 <div class="sectionbody">
421 <div class="paragraph"><p>Shows the commit logs.</p></div>
422 <div class="paragraph"><p>The command takes options applicable to the <em>git rev-list</em>
423 command to control what is shown and how, and options applicable to
424 the <em>git diff-*</em> commands to control how the changes
425 each commit introduces are shown.</p></div>
426 </div>
427 <h2 id="_options">OPTIONS</h2>
428 <div class="sectionbody">
429 <div class="dlist"><dl>
430 <dt class="hdlist1">
431 -&lt;n&gt;
432 </dt>
433 <dd>
435 Limits the number of commits to show.
436 Note that this is a commit limiting option, see below.
437 </p>
438 </dd>
439 <dt class="hdlist1">
440 &lt;since&gt;..&lt;until&gt;
441 </dt>
442 <dd>
444 Show only commits between the named two commits. When
445 either &lt;since&gt; or &lt;until&gt; is omitted, it defaults to
446 <tt>HEAD</tt>, i.e. the tip of the current branch.
447 For a more complete list of ways to spell &lt;since&gt;
448 and &lt;until&gt;, see <a href="gitrevisions.html">gitrevisions(7)</a>.
449 </p>
450 </dd>
451 <dt class="hdlist1">
452 --follow
453 </dt>
454 <dd>
456 Continue listing the history of a file beyond renames
457 (works only for a single file).
458 </p>
459 </dd>
460 <dt class="hdlist1">
461 --no-decorate
462 </dt>
463 <dt class="hdlist1">
464 --decorate[=short|full|no]
465 </dt>
466 <dd>
468 Print out the ref names of any commits that are shown. If <em>short</em> is
469 specified, the ref name prefixes <em>refs/heads/</em>, <em>refs/tags/</em> and
470 <em>refs/remotes/</em> will not be printed. If <em>full</em> is specified, the
471 full ref name (including prefix) will be printed. The default option
472 is <em>short</em>.
473 </p>
474 </dd>
475 <dt class="hdlist1">
476 --source
477 </dt>
478 <dd>
480 Print out the ref name given on the command line by which each
481 commit was reached.
482 </p>
483 </dd>
484 <dt class="hdlist1">
485 --full-diff
486 </dt>
487 <dd>
489 Without this flag, "git log -p &lt;path&gt;&#8230;" shows commits that
490 touch the specified paths, and diffs about the same specified
491 paths. With this, the full diff is shown for commits that touch
492 the specified paths; this means that "&lt;path&gt;&#8230;" limits only
493 commits, and doesn&#8217;t limit diff for those commits.
494 </p>
495 <div class="paragraph"><p>Note that this affects all diff-based output types, e.g. those
496 produced by --stat etc.</p></div>
497 </dd>
498 <dt class="hdlist1">
499 --log-size
500 </dt>
501 <dd>
503 Before the log message print out its size in bytes. Intended
504 mainly for porcelain tools consumption. If git is unable to
505 produce a valid value size is set to zero.
506 Note that only message is considered, if also a diff is shown
507 its size is not included.
508 </p>
509 </dd>
510 <dt class="hdlist1">
511 [--] &lt;path&gt;&#8230;
512 </dt>
513 <dd>
515 Show only commits that affect any of the specified paths. To
516 prevent confusion with options and branch names, paths may need
517 to be prefixed with "-- " to separate them from options or
518 refnames.
519 </p>
520 </dd>
521 </dl></div>
522 <h3 id="_commit_limiting">Commit Limiting</h3><div style="clear:left"></div>
523 <div class="paragraph"><p>Besides specifying a range of commits that should be listed using the
524 special notations explained in the description, additional commit
525 limiting may be applied. Note that they are applied before commit
526 ordering and formatting options, such as <em>--reverse</em>.</p></div>
527 <div class="dlist"><dl>
528 <dt class="hdlist1">
529 -n <em>number</em>
530 </dt>
531 <dt class="hdlist1">
532 --max-count=&lt;number&gt;
533 </dt>
534 <dd>
536 Limit the number of commits to output.
537 </p>
538 </dd>
539 <dt class="hdlist1">
540 --skip=&lt;number&gt;
541 </dt>
542 <dd>
544 Skip <em>number</em> commits before starting to show the commit output.
545 </p>
546 </dd>
547 <dt class="hdlist1">
548 --since=&lt;date&gt;
549 </dt>
550 <dt class="hdlist1">
551 --after=&lt;date&gt;
552 </dt>
553 <dd>
555 Show commits more recent than a specific date.
556 </p>
557 </dd>
558 <dt class="hdlist1">
559 --until=&lt;date&gt;
560 </dt>
561 <dt class="hdlist1">
562 --before=&lt;date&gt;
563 </dt>
564 <dd>
566 Show commits older than a specific date.
567 </p>
568 </dd>
569 <dt class="hdlist1">
570 --author=&lt;pattern&gt;
571 </dt>
572 <dt class="hdlist1">
573 --committer=&lt;pattern&gt;
574 </dt>
575 <dd>
577 Limit the commits output to ones with author/committer
578 header lines that match the specified pattern (regular expression).
579 </p>
580 </dd>
581 <dt class="hdlist1">
582 --grep=&lt;pattern&gt;
583 </dt>
584 <dd>
586 Limit the commits output to ones with log message that
587 matches the specified pattern (regular expression).
588 </p>
589 </dd>
590 <dt class="hdlist1">
591 --all-match
592 </dt>
593 <dd>
595 Limit the commits output to ones that match all given --grep,
596 --author and --committer instead of ones that match at least one.
597 </p>
598 </dd>
599 <dt class="hdlist1">
601 </dt>
602 <dt class="hdlist1">
603 --regexp-ignore-case
604 </dt>
605 <dd>
607 Match the regexp limiting patterns without regard to letters case.
608 </p>
609 </dd>
610 <dt class="hdlist1">
612 </dt>
613 <dt class="hdlist1">
614 --extended-regexp
615 </dt>
616 <dd>
618 Consider the limiting patterns to be extended regular expressions
619 instead of the default basic regular expressions.
620 </p>
621 </dd>
622 <dt class="hdlist1">
624 </dt>
625 <dt class="hdlist1">
626 --fixed-strings
627 </dt>
628 <dd>
630 Consider the limiting patterns to be fixed strings (don&#8217;t interpret
631 pattern as a regular expression).
632 </p>
633 </dd>
634 <dt class="hdlist1">
635 --remove-empty
636 </dt>
637 <dd>
639 Stop when a given path disappears from the tree.
640 </p>
641 </dd>
642 <dt class="hdlist1">
643 --merges
644 </dt>
645 <dd>
647 Print only merge commits. This is exactly the same as <tt>--min-parents=2</tt>.
648 </p>
649 </dd>
650 <dt class="hdlist1">
651 --no-merges
652 </dt>
653 <dd>
655 Do not print commits with more than one parent. This is
656 exactly the same as <tt>--max-parents=1</tt>.
657 </p>
658 </dd>
659 <dt class="hdlist1">
660 --min-parents=&lt;number&gt;
661 </dt>
662 <dt class="hdlist1">
663 --max-parents=&lt;number&gt;
664 </dt>
665 <dt class="hdlist1">
666 --no-min-parents
667 </dt>
668 <dt class="hdlist1">
669 --no-max-parents
670 </dt>
671 <dd>
673 Show only commits which have at least (or at most) that many
674 commits. In particular, <tt>--max-parents=1</tt> is the same as <tt>--no-merges</tt>,
675 <tt>--min-parents=2</tt> is the same as <tt>--merges</tt>. <tt>--max-parents=0</tt>
676 gives all root commits and <tt>--min-parents=3</tt> all octopus merges.
677 </p>
678 <div class="paragraph"><p><tt>--no-min-parents</tt> and <tt>--no-max-parents</tt> reset these limits (to no limit)
679 again. Equivalent forms are <tt>--min-parents=0</tt> (any commit has 0 or more
680 parents) and <tt>--max-parents=-1</tt> (negative numbers denote no upper limit).</p></div>
681 </dd>
682 <dt class="hdlist1">
683 --first-parent
684 </dt>
685 <dd>
687 Follow only the first parent commit upon seeing a merge
688 commit. This option can give a better overview when
689 viewing the evolution of a particular topic branch,
690 because merges into a topic branch tend to be only about
691 adjusting to updated upstream from time to time, and
692 this option allows you to ignore the individual commits
693 brought in to your history by such a merge.
694 </p>
695 </dd>
696 <dt class="hdlist1">
697 --not
698 </dt>
699 <dd>
701 Reverses the meaning of the <em>&#94;</em> prefix (or lack thereof)
702 for all following revision specifiers, up to the next <em>--not</em>.
703 </p>
704 </dd>
705 <dt class="hdlist1">
706 --all
707 </dt>
708 <dd>
710 Pretend as if all the refs in <tt>refs/</tt> are listed on the
711 command line as <em>&lt;commit&gt;</em>.
712 </p>
713 </dd>
714 <dt class="hdlist1">
715 --branches[=&lt;pattern&gt;]
716 </dt>
717 <dd>
719 Pretend as if all the refs in <tt>refs/heads</tt> are listed
720 on the command line as <em>&lt;commit&gt;</em>. If <em>&lt;pattern&gt;</em> is given, limit
721 branches to ones matching given shell glob. If pattern lacks <em>?</em>,
722 <em><strong></em>, or <em>[</em>, <em>/</strong></em> at the end is implied.
723 </p>
724 </dd>
725 <dt class="hdlist1">
726 --tags[=&lt;pattern&gt;]
727 </dt>
728 <dd>
730 Pretend as if all the refs in <tt>refs/tags</tt> are listed
731 on the command line as <em>&lt;commit&gt;</em>. If <em>&lt;pattern&gt;</em> is given, limit
732 tags to ones matching given shell glob. If pattern lacks <em>?</em>, <em><strong></em>,
733 or <em>[</em>, <em>/</strong></em> at the end is implied.
734 </p>
735 </dd>
736 <dt class="hdlist1">
737 --remotes[=&lt;pattern&gt;]
738 </dt>
739 <dd>
741 Pretend as if all the refs in <tt>refs/remotes</tt> are listed
742 on the command line as <em>&lt;commit&gt;</em>. If <em>&lt;pattern&gt;</em> is given, limit
743 remote-tracking branches to ones matching given shell glob.
744 If pattern lacks <em>?</em>, <em><strong></em>, or <em>[</em>, <em>/</strong></em> at the end is implied.
745 </p>
746 </dd>
747 <dt class="hdlist1">
748 --glob=&lt;glob-pattern&gt;
749 </dt>
750 <dd>
752 Pretend as if all the refs matching shell glob <em>&lt;glob-pattern&gt;</em>
753 are listed on the command line as <em>&lt;commit&gt;</em>. Leading <em>refs/</em>,
754 is automatically prepended if missing. If pattern lacks <em>?</em>, <em><strong></em>,
755 or <em>[</em>, <em>/</strong></em> at the end is implied.
756 </p>
757 </dd>
758 <dt class="hdlist1">
759 --ignore-missing
760 </dt>
761 <dd>
763 Upon seeing an invalid object name in the input, pretend as if
764 the bad input was not given.
765 </p>
766 </dd>
767 <dt class="hdlist1">
768 --bisect
769 </dt>
770 <dd>
772 Pretend as if the bad bisection ref <tt>refs/bisect/bad</tt>
773 was listed and as if it was followed by <tt>--not</tt> and the good
774 bisection refs <tt>refs/bisect/good-*</tt> on the command
775 line.
776 </p>
777 </dd>
778 <dt class="hdlist1">
779 --stdin
780 </dt>
781 <dd>
783 In addition to the <em>&lt;commit&gt;</em> listed on the command
784 line, read them from the standard input. If a <em>--</em> separator is
785 seen, stop reading commits and start reading paths to limit the
786 result.
787 </p>
788 </dd>
789 <dt class="hdlist1">
790 --cherry-mark
791 </dt>
792 <dd>
794 Like <tt>--cherry-pick</tt> (see below) but mark equivalent commits
795 with <tt>=</tt> rather than omitting them, and inequivalent ones with <tt>+</tt>.
796 </p>
797 </dd>
798 <dt class="hdlist1">
799 --cherry-pick
800 </dt>
801 <dd>
803 Omit any commit that introduces the same change as
804 another commit on the "other side" when the set of
805 commits are limited with symmetric difference.
806 </p>
807 <div class="paragraph"><p>For example, if you have two branches, <tt>A</tt> and <tt>B</tt>, a usual way
808 to list all commits on only one side of them is with
809 <tt>--left-right</tt> (see the example below in the description of
810 the <tt>--left-right</tt> option). It however shows the commits that were cherry-picked
811 from the other branch (for example, "3rd on b" may be cherry-picked
812 from branch A). With this option, such pairs of commits are
813 excluded from the output.</p></div>
814 </dd>
815 <dt class="hdlist1">
816 --left-only
817 </dt>
818 <dt class="hdlist1">
819 --right-only
820 </dt>
821 <dd>
823 List only commits on the respective side of a symmetric range,
824 i.e. only those which would be marked <tt>&lt;</tt> resp. <tt>&gt;</tt> by
825 <tt>--left-right</tt>.
826 </p>
827 <div class="paragraph"><p>For example, <tt>--cherry-pick --right-only A&#8230;B</tt> omits those
828 commits from <tt>B</tt> which are in <tt>A</tt> or are patch-equivalent to a commit in
829 <tt>A</tt>. In other words, this lists the <tt>&#43;</tt> commits from <tt>git cherry A B</tt>.
830 More precisely, <tt>--cherry-pick --right-only --no-merges</tt> gives the exact
831 list.</p></div>
832 </dd>
833 <dt class="hdlist1">
834 --cherry
835 </dt>
836 <dd>
838 A synonym for <tt>--right-only --cherry-mark --no-merges</tt>; useful to
839 limit the output to the commits on our side and mark those that
840 have been applied to the other side of a forked history with
841 <tt>git log --cherry upstream&#8230;mybranch</tt>, similar to
842 <tt>git cherry upstream mybranch</tt>.
843 </p>
844 </dd>
845 <dt class="hdlist1">
847 </dt>
848 <dt class="hdlist1">
849 --walk-reflogs
850 </dt>
851 <dd>
853 Instead of walking the commit ancestry chain, walk
854 reflog entries from the most recent one to older ones.
855 When this option is used you cannot specify commits to
856 exclude (that is, <em>&#94;commit</em>, <em>commit1..commit2</em>,
857 nor <em>commit1...commit2</em> notations cannot be used).
858 </p>
859 <div class="paragraph"><p>With <em>--pretty</em> format other than oneline (for obvious reasons),
860 this causes the output to have two extra lines of information
861 taken from the reflog. By default, <em>commit@{Nth}</em> notation is
862 used in the output. When the starting commit is specified as
863 <em>commit@{now}</em>, output also uses <em>commit@{timestamp}</em> notation
864 instead. Under <em>--pretty=oneline</em>, the commit message is
865 prefixed with this information on the same line.
866 This option cannot be combined with <em>--reverse</em>.
867 See also <a href="git-reflog.html">git-reflog(1)</a>.</p></div>
868 </dd>
869 <dt class="hdlist1">
870 --merge
871 </dt>
872 <dd>
874 After a failed merge, show refs that touch files having a
875 conflict and don&#8217;t exist on all heads to merge.
876 </p>
877 </dd>
878 <dt class="hdlist1">
879 --boundary
880 </dt>
881 <dd>
883 Output uninteresting commits at the boundary, which are usually
884 not shown.
885 </p>
886 </dd>
887 </dl></div>
888 <h3 id="_history_simplification">History Simplification</h3><div style="clear:left"></div>
889 <div class="paragraph"><p>Sometimes you are only interested in parts of the history, for example the
890 commits modifying a particular &lt;path&gt;. But there are two parts of
891 <em>History Simplification</em>, one part is selecting the commits and the other
892 is how to do it, as there are various strategies to simplify the history.</p></div>
893 <div class="paragraph"><p>The following options select the commits to be shown:</p></div>
894 <div class="dlist"><dl>
895 <dt class="hdlist1">
896 &lt;paths&gt;
897 </dt>
898 <dd>
900 Commits modifying the given &lt;paths&gt; are selected.
901 </p>
902 </dd>
903 <dt class="hdlist1">
904 --simplify-by-decoration
905 </dt>
906 <dd>
908 Commits that are referred by some branch or tag are selected.
909 </p>
910 </dd>
911 </dl></div>
912 <div class="paragraph"><p>Note that extra commits can be shown to give a meaningful history.</p></div>
913 <div class="paragraph"><p>The following options affect the way the simplification is performed:</p></div>
914 <div class="dlist"><dl>
915 <dt class="hdlist1">
916 Default mode
917 </dt>
918 <dd>
920 Simplifies the history to the simplest history explaining the
921 final state of the tree. Simplest because it prunes some side
922 branches if the end result is the same (i.e. merging branches
923 with the same content)
924 </p>
925 </dd>
926 <dt class="hdlist1">
927 --full-history
928 </dt>
929 <dd>
931 As the default mode but does not prune some history.
932 </p>
933 </dd>
934 <dt class="hdlist1">
935 --dense
936 </dt>
937 <dd>
939 Only the selected commits are shown, plus some to have a
940 meaningful history.
941 </p>
942 </dd>
943 <dt class="hdlist1">
944 --sparse
945 </dt>
946 <dd>
948 All commits in the simplified history are shown.
949 </p>
950 </dd>
951 <dt class="hdlist1">
952 --simplify-merges
953 </dt>
954 <dd>
956 Additional option to <em>--full-history</em> to remove some needless
957 merges from the resulting history, as there are no selected
958 commits contributing to this merge.
959 </p>
960 </dd>
961 <dt class="hdlist1">
962 --ancestry-path
963 </dt>
964 <dd>
966 When given a range of commits to display (e.g. <em>commit1..commit2</em>
967 or <em>commit2 &#94;commit1</em>), only display commits that exist
968 directly on the ancestry chain between the <em>commit1</em> and
969 <em>commit2</em>, i.e. commits that are both descendants of <em>commit1</em>,
970 and ancestors of <em>commit2</em>.
971 </p>
972 </dd>
973 </dl></div>
974 <div class="paragraph"><p>A more detailed explanation follows.</p></div>
975 <div class="paragraph"><p>Suppose you specified <tt>foo</tt> as the &lt;paths&gt;. We shall call commits
976 that modify <tt>foo</tt> !TREESAME, and the rest TREESAME. (In a diff
977 filtered for <tt>foo</tt>, they look different and equal, respectively.)</p></div>
978 <div class="paragraph"><p>In the following, we will always refer to the same example history to
979 illustrate the differences between simplification settings. We assume
980 that you are filtering for a file <tt>foo</tt> in this commit graph:</p></div>
981 <div class="listingblock">
982 <div class="content">
983 <pre><tt> .-A---M---N---O---P
984 / / / / /
985 I B C D E
986 \ / / / /
987 `-------------'</tt></pre>
988 </div></div>
989 <div class="paragraph"><p>The horizontal line of history A&#8212;P is taken to be the first parent of
990 each merge. The commits are:</p></div>
991 <div class="ulist"><ul>
992 <li>
994 <tt>I</tt> is the initial commit, in which <tt>foo</tt> exists with contents
995 "asdf", and a file <tt>quux</tt> exists with contents "quux". Initial
996 commits are compared to an empty tree, so <tt>I</tt> is !TREESAME.
997 </p>
998 </li>
999 <li>
1001 In <tt>A</tt>, <tt>foo</tt> contains just "foo".
1002 </p>
1003 </li>
1004 <li>
1006 <tt>B</tt> contains the same change as <tt>A</tt>. Its merge <tt>M</tt> is trivial and
1007 hence TREESAME to all parents.
1008 </p>
1009 </li>
1010 <li>
1012 <tt>C</tt> does not change <tt>foo</tt>, but its merge <tt>N</tt> changes it to "foobar",
1013 so it is not TREESAME to any parent.
1014 </p>
1015 </li>
1016 <li>
1018 <tt>D</tt> sets <tt>foo</tt> to "baz". Its merge <tt>O</tt> combines the strings from
1019 <tt>N</tt> and <tt>D</tt> to "foobarbaz"; i.e., it is not TREESAME to any parent.
1020 </p>
1021 </li>
1022 <li>
1024 <tt>E</tt> changes <tt>quux</tt> to "xyzzy", and its merge <tt>P</tt> combines the
1025 strings to "quux xyzzy". Despite appearing interesting, <tt>P</tt> is
1026 TREESAME to all parents.
1027 </p>
1028 </li>
1029 </ul></div>
1030 <div class="paragraph"><p><em>rev-list</em> walks backwards through history, including or excluding
1031 commits based on whether <em>--full-history</em> and/or parent rewriting
1032 (via <em>--parents</em> or <em>--children</em>) are used. The following settings
1033 are available.</p></div>
1034 <div class="dlist"><dl>
1035 <dt class="hdlist1">
1036 Default mode
1037 </dt>
1038 <dd>
1040 Commits are included if they are not TREESAME to any parent
1041 (though this can be changed, see <em>--sparse</em> below). If the
1042 commit was a merge, and it was TREESAME to one parent, follow
1043 only that parent. (Even if there are several TREESAME
1044 parents, follow only one of them.) Otherwise, follow all
1045 parents.
1046 </p>
1047 <div class="paragraph"><p>This results in:</p></div>
1048 <div class="listingblock">
1049 <div class="content">
1050 <pre><tt> .-A---N---O
1051 / / /
1052 I---------D</tt></pre>
1053 </div></div>
1054 <div class="paragraph"><p>Note how the rule to only follow the TREESAME parent, if one is
1055 available, removed <tt>B</tt> from consideration entirely. <tt>C</tt> was
1056 considered via <tt>N</tt>, but is TREESAME. Root commits are compared to an
1057 empty tree, so <tt>I</tt> is !TREESAME.</p></div>
1058 <div class="paragraph"><p>Parent/child relations are only visible with --parents, but that does
1059 not affect the commits selected in default mode, so we have shown the
1060 parent lines.</p></div>
1061 </dd>
1062 <dt class="hdlist1">
1063 --full-history without parent rewriting
1064 </dt>
1065 <dd>
1067 This mode differs from the default in one point: always follow
1068 all parents of a merge, even if it is TREESAME to one of them.
1069 Even if more than one side of the merge has commits that are
1070 included, this does not imply that the merge itself is! In
1071 the example, we get
1072 </p>
1073 <div class="listingblock">
1074 <div class="content">
1075 <pre><tt> I A B N D O</tt></pre>
1076 </div></div>
1077 <div class="paragraph"><p><tt>P</tt> and <tt>M</tt> were excluded because they are TREESAME to a parent. <tt>E</tt>,
1078 <tt>C</tt> and <tt>B</tt> were all walked, but only <tt>B</tt> was !TREESAME, so the others
1079 do not appear.</p></div>
1080 <div class="paragraph"><p>Note that without parent rewriting, it is not really possible to talk
1081 about the parent/child relationships between the commits, so we show
1082 them disconnected.</p></div>
1083 </dd>
1084 <dt class="hdlist1">
1085 --full-history with parent rewriting
1086 </dt>
1087 <dd>
1089 Ordinary commits are only included if they are !TREESAME
1090 (though this can be changed, see <em>--sparse</em> below).
1091 </p>
1092 <div class="paragraph"><p>Merges are always included. However, their parent list is rewritten:
1093 Along each parent, prune away commits that are not included
1094 themselves. This results in</p></div>
1095 <div class="listingblock">
1096 <div class="content">
1097 <pre><tt> .-A---M---N---O---P
1098 / / / / /
1099 I B / D /
1100 \ / / / /
1101 `-------------'</tt></pre>
1102 </div></div>
1103 <div class="paragraph"><p>Compare to <em>--full-history</em> without rewriting above. Note that <tt>E</tt>
1104 was pruned away because it is TREESAME, but the parent list of P was
1105 rewritten to contain <tt>E</tt>'s parent <tt>I</tt>. The same happened for <tt>C</tt> and
1106 <tt>N</tt>. Note also that <tt>P</tt> was included despite being TREESAME.</p></div>
1107 </dd>
1108 </dl></div>
1109 <div class="paragraph"><p>In addition to the above settings, you can change whether TREESAME
1110 affects inclusion:</p></div>
1111 <div class="dlist"><dl>
1112 <dt class="hdlist1">
1113 --dense
1114 </dt>
1115 <dd>
1117 Commits that are walked are included if they are not TREESAME
1118 to any parent.
1119 </p>
1120 </dd>
1121 <dt class="hdlist1">
1122 --sparse
1123 </dt>
1124 <dd>
1126 All commits that are walked are included.
1127 </p>
1128 <div class="paragraph"><p>Note that without <em>--full-history</em>, this still simplifies merges: if
1129 one of the parents is TREESAME, we follow only that one, so the other
1130 sides of the merge are never walked.</p></div>
1131 </dd>
1132 <dt class="hdlist1">
1133 --simplify-merges
1134 </dt>
1135 <dd>
1137 First, build a history graph in the same way that
1138 <em>--full-history</em> with parent rewriting does (see above).
1139 </p>
1140 <div class="paragraph"><p>Then simplify each commit &#8216;C` to its replacement <tt>C&#8217;</tt> in the final
1141 history according to the following rules:</p></div>
1142 <div class="ulist"><ul>
1143 <li>
1145 Set &#8216;C&#8217;` to <tt>C</tt>.
1146 </p>
1147 </li>
1148 <li>
1150 Replace each parent &#8216;P` of <tt>C&#8217;</tt> with its simplification &#8216;P&#8217;`. In
1151 the process, drop parents that are ancestors of other parents, and
1152 remove duplicates.
1153 </p>
1154 </li>
1155 <li>
1157 If after this parent rewriting, &#8216;C&#8217;` is a root or merge commit (has
1158 zero or &gt;1 parents), a boundary commit, or !TREESAME, it remains.
1159 Otherwise, it is replaced with its only parent.
1160 </p>
1161 </li>
1162 </ul></div>
1163 <div class="paragraph"><p>The effect of this is best shown by way of comparing to
1164 <em>--full-history</em> with parent rewriting. The example turns into:</p></div>
1165 <div class="listingblock">
1166 <div class="content">
1167 <pre><tt> .-A---M---N---O
1168 / / /
1169 I B D
1170 \ / /
1171 `---------'</tt></pre>
1172 </div></div>
1173 <div class="paragraph"><p>Note the major differences in <tt>N</tt> and <tt>P</tt> over <em>--full-history</em>:</p></div>
1174 <div class="ulist"><ul>
1175 <li>
1177 <tt>N</tt>'s parent list had <tt>I</tt> removed, because it is an ancestor of the
1178 other parent <tt>M</tt>. Still, <tt>N</tt> remained because it is !TREESAME.
1179 </p>
1180 </li>
1181 <li>
1183 <tt>P</tt>'s parent list similarly had <tt>I</tt> removed. <tt>P</tt> was then
1184 removed completely, because it had one parent and is TREESAME.
1185 </p>
1186 </li>
1187 </ul></div>
1188 </dd>
1189 </dl></div>
1190 <div class="paragraph"><p>Finally, there is a fifth simplification mode available:</p></div>
1191 <div class="dlist"><dl>
1192 <dt class="hdlist1">
1193 --ancestry-path
1194 </dt>
1195 <dd>
1197 Limit the displayed commits to those directly on the ancestry
1198 chain between the "from" and "to" commits in the given commit
1199 range. I.e. only display commits that are ancestor of the "to"
1200 commit, and descendants of the "from" commit.
1201 </p>
1202 <div class="paragraph"><p>As an example use case, consider the following commit history:</p></div>
1203 <div class="listingblock">
1204 <div class="content">
1205 <pre><tt> D---E-------F
1206 / \ \
1207 B---C---G---H---I---J
1209 A-------K---------------L--M</tt></pre>
1210 </div></div>
1211 <div class="paragraph"><p>A regular <em>D..M</em> computes the set of commits that are ancestors of <tt>M</tt>,
1212 but excludes the ones that are ancestors of <tt>D</tt>. This is useful to see
1213 what happened to the history leading to <tt>M</tt> since <tt>D</tt>, in the sense
1214 that "what does <tt>M</tt> have that did not exist in <tt>D</tt>". The result in this
1215 example would be all the commits, except <tt>A</tt> and <tt>B</tt> (and <tt>D</tt> itself,
1216 of course).</p></div>
1217 <div class="paragraph"><p>When we want to find out what commits in <tt>M</tt> are contaminated with the
1218 bug introduced by <tt>D</tt> and need fixing, however, we might want to view
1219 only the subset of <em>D..M</em> that are actually descendants of <tt>D</tt>, i.e.
1220 excluding <tt>C</tt> and <tt>K</tt>. This is exactly what the <em>--ancestry-path</em>
1221 option does. Applied to the <em>D..M</em> range, it results in:</p></div>
1222 <div class="listingblock">
1223 <div class="content">
1224 <pre><tt> E-------F
1226 G---H---I---J
1228 L--M</tt></pre>
1229 </div></div>
1230 </dd>
1231 </dl></div>
1232 <div class="paragraph"><p>The <em>--simplify-by-decoration</em> option allows you to view only the
1233 big picture of the topology of the history, by omitting commits
1234 that are not referenced by tags. Commits are marked as !TREESAME
1235 (in other words, kept after history simplification rules described
1236 above) if (1) they are referenced by tags, or (2) they change the
1237 contents of the paths given on the command line. All other
1238 commits are marked as TREESAME (subject to be simplified away).</p></div>
1239 <h3 id="_commit_ordering">Commit Ordering</h3><div style="clear:left"></div>
1240 <div class="paragraph"><p>By default, the commits are shown in reverse chronological order.</p></div>
1241 <div class="dlist"><dl>
1242 <dt class="hdlist1">
1243 --topo-order
1244 </dt>
1245 <dd>
1247 This option makes them appear in topological order (i.e.
1248 descendant commits are shown before their parents).
1249 </p>
1250 </dd>
1251 <dt class="hdlist1">
1252 --date-order
1253 </dt>
1254 <dd>
1256 This option is similar to <em>--topo-order</em> in the sense that no
1257 parent comes before all of its children, but otherwise things
1258 are still ordered in the commit timestamp order.
1259 </p>
1260 </dd>
1261 <dt class="hdlist1">
1262 --reverse
1263 </dt>
1264 <dd>
1266 Output the commits in reverse order.
1267 Cannot be combined with <em>--walk-reflogs</em>.
1268 </p>
1269 </dd>
1270 </dl></div>
1271 <h3 id="_object_traversal">Object Traversal</h3><div style="clear:left"></div>
1272 <div class="paragraph"><p>These options are mostly targeted for packing of git repositories.</p></div>
1273 <div class="dlist"><dl>
1274 <dt class="hdlist1">
1275 --objects
1276 </dt>
1277 <dd>
1279 Print the object IDs of any object referenced by the listed
1280 commits. <em>--objects foo ^bar</em> thus means "send me
1281 all object IDs which I need to download if I have the commit
1282 object <em>bar</em>, but not <em>foo</em>".
1283 </p>
1284 </dd>
1285 <dt class="hdlist1">
1286 --objects-edge
1287 </dt>
1288 <dd>
1290 Similar to <em>--objects</em>, but also print the IDs of excluded
1291 commits prefixed with a "-" character. This is used by
1292 <a href="git-pack-objects.html">git-pack-objects(1)</a> to build "thin" pack, which records
1293 objects in deltified form based on objects contained in these
1294 excluded commits to reduce network traffic.
1295 </p>
1296 </dd>
1297 <dt class="hdlist1">
1298 --unpacked
1299 </dt>
1300 <dd>
1302 Only useful with <em>--objects</em>; print the object IDs that are not
1303 in packs.
1304 </p>
1305 </dd>
1306 <dt class="hdlist1">
1307 --no-walk
1308 </dt>
1309 <dd>
1311 Only show the given revs, but do not traverse their ancestors.
1312 </p>
1313 </dd>
1314 <dt class="hdlist1">
1315 --do-walk
1316 </dt>
1317 <dd>
1319 Overrides a previous --no-walk.
1320 </p>
1321 </dd>
1322 </dl></div>
1323 <h3 id="_commit_formatting">Commit Formatting</h3><div style="clear:left"></div>
1324 <div class="dlist"><dl>
1325 <dt class="hdlist1">
1326 --pretty[=&lt;format&gt;]
1327 </dt>
1328 <dt class="hdlist1">
1329 --format=&lt;format&gt;
1330 </dt>
1331 <dd>
1333 Pretty-print the contents of the commit logs in a given format,
1334 where <em>&lt;format&gt;</em> can be one of <em>oneline</em>, <em>short</em>, <em>medium</em>,
1335 <em>full</em>, <em>fuller</em>, <em>email</em>, <em>raw</em> and <em>format:&lt;string&gt;</em>. See
1336 the "PRETTY FORMATS" section for some additional details for each
1337 format. When omitted, the format defaults to <em>medium</em>.
1338 </p>
1339 <div class="paragraph"><p>Note: you can specify the default pretty format in the repository
1340 configuration (see <a href="git-config.html">git-config(1)</a>).</p></div>
1341 </dd>
1342 <dt class="hdlist1">
1343 --abbrev-commit
1344 </dt>
1345 <dd>
1347 Instead of showing the full 40-byte hexadecimal commit object
1348 name, show only a partial prefix. Non default number of
1349 digits can be specified with "--abbrev=&lt;n&gt;" (which also modifies
1350 diff output, if it is displayed).
1351 </p>
1352 <div class="paragraph"><p>This should make "--pretty=oneline" a whole lot more readable for
1353 people using 80-column terminals.</p></div>
1354 </dd>
1355 <dt class="hdlist1">
1356 --no-abbrev-commit
1357 </dt>
1358 <dd>
1360 Show the full 40-byte hexadecimal commit object name. This negates
1361 <tt>--abbrev-commit</tt> and those options which imply it such as
1362 "--oneline". It also overrides the <em>log.abbrevCommit</em> variable.
1363 </p>
1364 </dd>
1365 <dt class="hdlist1">
1366 --oneline
1367 </dt>
1368 <dd>
1370 This is a shorthand for "--pretty=oneline --abbrev-commit"
1371 used together.
1372 </p>
1373 </dd>
1374 <dt class="hdlist1">
1375 --encoding[=&lt;encoding&gt;]
1376 </dt>
1377 <dd>
1379 The commit objects record the encoding used for the log message
1380 in their encoding header; this option can be used to tell the
1381 command to re-code the commit log message in the encoding
1382 preferred by the user. For non plumbing commands this
1383 defaults to UTF-8.
1384 </p>
1385 </dd>
1386 <dt class="hdlist1">
1387 --notes[=&lt;ref&gt;]
1388 </dt>
1389 <dd>
1391 Show the notes (see <a href="git-notes.html">git-notes(1)</a>) that annotate the
1392 commit, when showing the commit log message. This is the default
1393 for <tt>git log</tt>, <tt>git show</tt> and <tt>git whatchanged</tt> commands when
1394 there is no <tt>--pretty</tt>, <tt>--format</tt> nor <tt>--oneline</tt> option given
1395 on the command line.
1396 </p>
1397 <div class="paragraph"><p>By default, the notes shown are from the notes refs listed in the
1398 <em>core.notesRef</em> and <em>notes.displayRef</em> variables (or corresponding
1399 environment overrides). See <a href="git-config.html">git-config(1)</a> for more details.</p></div>
1400 <div class="paragraph"><p>With an optional <em>&lt;ref&gt;</em> argument, show this notes ref instead of the
1401 default notes ref(s). The ref is taken to be in <tt>refs/notes/</tt> if it
1402 is not qualified.</p></div>
1403 <div class="paragraph"><p>Multiple --notes options can be combined to control which notes are
1404 being displayed. Examples: "--notes=foo" will show only notes from
1405 "refs/notes/foo"; "--notes=foo --notes" will show both notes from
1406 "refs/notes/foo" and from the default notes ref(s).</p></div>
1407 </dd>
1408 <dt class="hdlist1">
1409 --no-notes
1410 </dt>
1411 <dd>
1413 Do not show notes. This negates the above <tt>--notes</tt> option, by
1414 resetting the list of notes refs from which notes are shown.
1415 Options are parsed in the order given on the command line, so e.g.
1416 "--notes --notes=foo --no-notes --notes=bar" will only show notes
1417 from "refs/notes/bar".
1418 </p>
1419 </dd>
1420 <dt class="hdlist1">
1421 --show-notes[=&lt;ref&gt;]
1422 </dt>
1423 <dt class="hdlist1">
1424 --[no-]standard-notes
1425 </dt>
1426 <dd>
1428 These options are deprecated. Use the above --notes/--no-notes
1429 options instead.
1430 </p>
1431 </dd>
1432 <dt class="hdlist1">
1433 --relative-date
1434 </dt>
1435 <dd>
1437 Synonym for <tt>--date=relative</tt>.
1438 </p>
1439 </dd>
1440 <dt class="hdlist1">
1441 --date=(relative|local|default|iso|rfc|short|raw)
1442 </dt>
1443 <dd>
1445 Only takes effect for dates shown in human-readable format, such
1446 as when using "--pretty". <tt>log.date</tt> config variable sets a default
1447 value for log command&#8217;s --date option.
1448 </p>
1449 <div class="paragraph"><p><tt>--date=relative</tt> shows dates relative to the current time,
1450 e.g. "2 hours ago".</p></div>
1451 <div class="paragraph"><p><tt>--date=local</tt> shows timestamps in user&#8217;s local timezone.</p></div>
1452 <div class="paragraph"><p><tt>--date=iso</tt> (or <tt>--date=iso8601</tt>) shows timestamps in ISO 8601 format.</p></div>
1453 <div class="paragraph"><p><tt>--date=rfc</tt> (or <tt>--date=rfc2822</tt>) shows timestamps in RFC 2822
1454 format, often found in E-mail messages.</p></div>
1455 <div class="paragraph"><p><tt>--date=short</tt> shows only date but not time, in <tt>YYYY-MM-DD</tt> format.</p></div>
1456 <div class="paragraph"><p><tt>--date=raw</tt> shows the date in the internal raw git format <tt>%s %z</tt> format.</p></div>
1457 <div class="paragraph"><p><tt>--date=default</tt> shows timestamps in the original timezone
1458 (either committer&#8217;s or author&#8217;s).</p></div>
1459 </dd>
1460 <dt class="hdlist1">
1461 --parents
1462 </dt>
1463 <dd>
1465 Print also the parents of the commit (in the form "commit parent&#8230;").
1466 Also enables parent rewriting, see <em>History Simplification</em> below.
1467 </p>
1468 </dd>
1469 <dt class="hdlist1">
1470 --children
1471 </dt>
1472 <dd>
1474 Print also the children of the commit (in the form "commit child&#8230;").
1475 Also enables parent rewriting, see <em>History Simplification</em> below.
1476 </p>
1477 </dd>
1478 <dt class="hdlist1">
1479 --left-right
1480 </dt>
1481 <dd>
1483 Mark which side of a symmetric diff a commit is reachable from.
1484 Commits from the left side are prefixed with <tt>&lt;</tt> and those from
1485 the right with <tt>&gt;</tt>. If combined with <tt>--boundary</tt>, those
1486 commits are prefixed with <tt>-</tt>.
1487 </p>
1488 <div class="paragraph"><p>For example, if you have this topology:</p></div>
1489 <div class="listingblock">
1490 <div class="content">
1491 <pre><tt> y---b---b branch B
1492 / \ /
1494 / / \
1495 o---x---a---a branch A</tt></pre>
1496 </div></div>
1497 <div class="paragraph"><p>you would get an output like this:</p></div>
1498 <div class="listingblock">
1499 <div class="content">
1500 <pre><tt> $ git rev-list --left-right --boundary --pretty=oneline A...B
1502 &gt;bbbbbbb... 3rd on b
1503 &gt;bbbbbbb... 2nd on b
1504 &lt;aaaaaaa... 3rd on a
1505 &lt;aaaaaaa... 2nd on a
1506 -yyyyyyy... 1st on b
1507 -xxxxxxx... 1st on a</tt></pre>
1508 </div></div>
1509 </dd>
1510 <dt class="hdlist1">
1511 --graph
1512 </dt>
1513 <dd>
1515 Draw a text-based graphical representation of the commit history
1516 on the left hand side of the output. This may cause extra lines
1517 to be printed in between commits, in order for the graph history
1518 to be drawn properly.
1519 </p>
1520 <div class="paragraph"><p>This enables parent rewriting, see <em>History Simplification</em> below.</p></div>
1521 <div class="paragraph"><p>This implies the <em>--topo-order</em> option by default, but the
1522 <em>--date-order</em> option may also be specified.</p></div>
1523 </dd>
1524 </dl></div>
1525 <h3 id="_diff_formatting">Diff Formatting</h3><div style="clear:left"></div>
1526 <div class="paragraph"><p>Below are listed options that control the formatting of diff output.
1527 Some of them are specific to <a href="git-rev-list.html">git-rev-list(1)</a>, however other diff
1528 options may be given. See <a href="git-diff-files.html">git-diff-files(1)</a> for more options.</p></div>
1529 <div class="dlist"><dl>
1530 <dt class="hdlist1">
1532 </dt>
1533 <dd>
1535 With this option, diff output for a merge commit
1536 shows the differences from each of the parents to the merge result
1537 simultaneously instead of showing pairwise diff between a parent
1538 and the result one at a time. Furthermore, it lists only files
1539 which were modified from all parents.
1540 </p>
1541 </dd>
1542 <dt class="hdlist1">
1543 --cc
1544 </dt>
1545 <dd>
1547 This flag implies the <em>-c</em> options and further compresses the
1548 patch output by omitting uninteresting hunks whose contents in
1549 the parents have only two variants and the merge result picks
1550 one of them without modification.
1551 </p>
1552 </dd>
1553 <dt class="hdlist1">
1555 </dt>
1556 <dd>
1558 This flag makes the merge commits show the full diff like
1559 regular commits; for each merge parent, a separate log entry
1560 and diff is generated. An exception is that only diff against
1561 the first parent is shown when <em>--first-parent</em> option is given;
1562 in that case, the output represents the changes the merge
1563 brought <em>into</em> the then-current branch.
1564 </p>
1565 </dd>
1566 <dt class="hdlist1">
1568 </dt>
1569 <dd>
1571 Show recursive diffs.
1572 </p>
1573 </dd>
1574 <dt class="hdlist1">
1576 </dt>
1577 <dd>
1579 Show the tree objects in the diff output. This implies <em>-r</em>.
1580 </p>
1581 </dd>
1582 <dt class="hdlist1">
1584 </dt>
1585 <dd>
1587 Suppress diff output.
1588 </p>
1589 </dd>
1590 </dl></div>
1591 </div>
1592 <h2 id="_pretty_formats">PRETTY FORMATS</h2>
1593 <div class="sectionbody">
1594 <div class="paragraph"><p>If the commit is a merge, and if the pretty-format
1595 is not <em>oneline</em>, <em>email</em> or <em>raw</em>, an additional line is
1596 inserted before the <em>Author:</em> line. This line begins with
1597 "Merge: " and the sha1s of ancestral commits are printed,
1598 separated by spaces. Note that the listed commits may not
1599 necessarily be the list of the <strong>direct</strong> parent commits if you
1600 have limited your view of history: for example, if you are
1601 only interested in changes related to a certain directory or
1602 file.</p></div>
1603 <div class="paragraph"><p>There are several built-in formats, and you can define
1604 additional formats by setting a pretty.&lt;name&gt;
1605 config option to either another format name, or a
1606 <em>format:</em> string, as described below (see
1607 <a href="git-config.html">git-config(1)</a>). Here are the details of the
1608 built-in formats:</p></div>
1609 <div class="ulist"><ul>
1610 <li>
1612 <em>oneline</em>
1613 </p>
1614 <div class="literalblock">
1615 <div class="content">
1616 <pre><tt>&lt;sha1&gt; &lt;title line&gt;</tt></pre>
1617 </div></div>
1618 <div class="paragraph"><p>This is designed to be as compact as possible.</p></div>
1619 </li>
1620 <li>
1622 <em>short</em>
1623 </p>
1624 <div class="literalblock">
1625 <div class="content">
1626 <pre><tt>commit &lt;sha1&gt;
1627 Author: &lt;author&gt;</tt></pre>
1628 </div></div>
1629 <div class="literalblock">
1630 <div class="content">
1631 <pre><tt>&lt;title line&gt;</tt></pre>
1632 </div></div>
1633 </li>
1634 <li>
1636 <em>medium</em>
1637 </p>
1638 <div class="literalblock">
1639 <div class="content">
1640 <pre><tt>commit &lt;sha1&gt;
1641 Author: &lt;author&gt;
1642 Date: &lt;author date&gt;</tt></pre>
1643 </div></div>
1644 <div class="literalblock">
1645 <div class="content">
1646 <pre><tt>&lt;title line&gt;</tt></pre>
1647 </div></div>
1648 <div class="literalblock">
1649 <div class="content">
1650 <pre><tt>&lt;full commit message&gt;</tt></pre>
1651 </div></div>
1652 </li>
1653 <li>
1655 <em>full</em>
1656 </p>
1657 <div class="literalblock">
1658 <div class="content">
1659 <pre><tt>commit &lt;sha1&gt;
1660 Author: &lt;author&gt;
1661 Commit: &lt;committer&gt;</tt></pre>
1662 </div></div>
1663 <div class="literalblock">
1664 <div class="content">
1665 <pre><tt>&lt;title line&gt;</tt></pre>
1666 </div></div>
1667 <div class="literalblock">
1668 <div class="content">
1669 <pre><tt>&lt;full commit message&gt;</tt></pre>
1670 </div></div>
1671 </li>
1672 <li>
1674 <em>fuller</em>
1675 </p>
1676 <div class="literalblock">
1677 <div class="content">
1678 <pre><tt>commit &lt;sha1&gt;
1679 Author: &lt;author&gt;
1680 AuthorDate: &lt;author date&gt;
1681 Commit: &lt;committer&gt;
1682 CommitDate: &lt;committer date&gt;</tt></pre>
1683 </div></div>
1684 <div class="literalblock">
1685 <div class="content">
1686 <pre><tt>&lt;title line&gt;</tt></pre>
1687 </div></div>
1688 <div class="literalblock">
1689 <div class="content">
1690 <pre><tt>&lt;full commit message&gt;</tt></pre>
1691 </div></div>
1692 </li>
1693 <li>
1695 <em>email</em>
1696 </p>
1697 <div class="literalblock">
1698 <div class="content">
1699 <pre><tt>From &lt;sha1&gt; &lt;date&gt;
1700 From: &lt;author&gt;
1701 Date: &lt;author date&gt;
1702 Subject: [PATCH] &lt;title line&gt;</tt></pre>
1703 </div></div>
1704 <div class="literalblock">
1705 <div class="content">
1706 <pre><tt>&lt;full commit message&gt;</tt></pre>
1707 </div></div>
1708 </li>
1709 <li>
1711 <em>raw</em>
1712 </p>
1713 <div class="paragraph"><p>The <em>raw</em> format shows the entire commit exactly as
1714 stored in the commit object. Notably, the SHA1s are
1715 displayed in full, regardless of whether --abbrev or
1716 --no-abbrev are used, and <em>parents</em> information show the
1717 true parent commits, without taking grafts nor history
1718 simplification into account.</p></div>
1719 </li>
1720 <li>
1722 <em>format:&lt;string&gt;</em>
1723 </p>
1724 <div class="paragraph"><p>The <em>format:&lt;string&gt;</em> format allows you to specify which information
1725 you want to show. It works a little bit like printf format,
1726 with the notable exception that you get a newline with <em>%n</em>
1727 instead of <em>\n</em>.</p></div>
1728 <div class="paragraph"><p>E.g, <em>format:"The author of %h was %an, %ar%nThe title was &gt;&gt;%s&lt;&lt;%n"</em>
1729 would show something like this:</p></div>
1730 <div class="listingblock">
1731 <div class="content">
1732 <pre><tt>The author of fe6e0ee was Junio C Hamano, 23 hours ago
1733 The title was &gt;&gt;t4119: test autocomputing -p&lt;n&gt; for traditional diff input.&lt;&lt;</tt></pre>
1734 </div></div>
1735 <div class="paragraph"><p>The placeholders are:</p></div>
1736 <div class="ulist"><ul>
1737 <li>
1739 <em>%H</em>: commit hash
1740 </p>
1741 </li>
1742 <li>
1744 <em>%h</em>: abbreviated commit hash
1745 </p>
1746 </li>
1747 <li>
1749 <em>%T</em>: tree hash
1750 </p>
1751 </li>
1752 <li>
1754 <em>%t</em>: abbreviated tree hash
1755 </p>
1756 </li>
1757 <li>
1759 <em>%P</em>: parent hashes
1760 </p>
1761 </li>
1762 <li>
1764 <em>%p</em>: abbreviated parent hashes
1765 </p>
1766 </li>
1767 <li>
1769 <em>%an</em>: author name
1770 </p>
1771 </li>
1772 <li>
1774 <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>)
1775 </p>
1776 </li>
1777 <li>
1779 <em>%ae</em>: author email
1780 </p>
1781 </li>
1782 <li>
1784 <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>)
1785 </p>
1786 </li>
1787 <li>
1789 <em>%ad</em>: author date (format respects --date= option)
1790 </p>
1791 </li>
1792 <li>
1794 <em>%aD</em>: author date, RFC2822 style
1795 </p>
1796 </li>
1797 <li>
1799 <em>%ar</em>: author date, relative
1800 </p>
1801 </li>
1802 <li>
1804 <em>%at</em>: author date, UNIX timestamp
1805 </p>
1806 </li>
1807 <li>
1809 <em>%ai</em>: author date, ISO 8601 format
1810 </p>
1811 </li>
1812 <li>
1814 <em>%cn</em>: committer name
1815 </p>
1816 </li>
1817 <li>
1819 <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>)
1820 </p>
1821 </li>
1822 <li>
1824 <em>%ce</em>: committer email
1825 </p>
1826 </li>
1827 <li>
1829 <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>)
1830 </p>
1831 </li>
1832 <li>
1834 <em>%cd</em>: committer date
1835 </p>
1836 </li>
1837 <li>
1839 <em>%cD</em>: committer date, RFC2822 style
1840 </p>
1841 </li>
1842 <li>
1844 <em>%cr</em>: committer date, relative
1845 </p>
1846 </li>
1847 <li>
1849 <em>%ct</em>: committer date, UNIX timestamp
1850 </p>
1851 </li>
1852 <li>
1854 <em>%ci</em>: committer date, ISO 8601 format
1855 </p>
1856 </li>
1857 <li>
1859 <em>%d</em>: ref names, like the --decorate option of <a href="git-log.html">git-log(1)</a>
1860 </p>
1861 </li>
1862 <li>
1864 <em>%e</em>: encoding
1865 </p>
1866 </li>
1867 <li>
1869 <em>%s</em>: subject
1870 </p>
1871 </li>
1872 <li>
1874 <em>%f</em>: sanitized subject line, suitable for a filename
1875 </p>
1876 </li>
1877 <li>
1879 <em>%b</em>: body
1880 </p>
1881 </li>
1882 <li>
1884 <em>%B</em>: raw body (unwrapped subject and body)
1885 </p>
1886 </li>
1887 <li>
1889 <em>%N</em>: commit notes
1890 </p>
1891 </li>
1892 <li>
1894 <em>%gD</em>: reflog selector, e.g., <tt>refs/stash@{1}</tt>
1895 </p>
1896 </li>
1897 <li>
1899 <em>%gd</em>: shortened reflog selector, e.g., <tt>stash@{1}</tt>
1900 </p>
1901 </li>
1902 <li>
1904 <em>%gs</em>: reflog subject
1905 </p>
1906 </li>
1907 <li>
1909 <em>%Cred</em>: switch color to red
1910 </p>
1911 </li>
1912 <li>
1914 <em>%Cgreen</em>: switch color to green
1915 </p>
1916 </li>
1917 <li>
1919 <em>%Cblue</em>: switch color to blue
1920 </p>
1921 </li>
1922 <li>
1924 <em>%Creset</em>: reset color
1925 </p>
1926 </li>
1927 <li>
1929 <em>%C(&#8230;)</em>: color specification, as described in color.branch.* config option
1930 </p>
1931 </li>
1932 <li>
1934 <em>%m</em>: left, right or boundary mark
1935 </p>
1936 </li>
1937 <li>
1939 <em>%n</em>: newline
1940 </p>
1941 </li>
1942 <li>
1944 <em>%%</em>: a raw <em>%</em>
1945 </p>
1946 </li>
1947 <li>
1949 <em>%x00</em>: print a byte from a hex code
1950 </p>
1951 </li>
1952 <li>
1954 <em>%w([&lt;w&gt;[,&lt;i1&gt;[,&lt;i2&gt;]]])</em>: switch line wrapping, like the -w option of
1955 <a href="git-shortlog.html">git-shortlog(1)</a>.
1956 </p>
1957 </li>
1958 </ul></div>
1959 </li>
1960 </ul></div>
1961 <div class="admonitionblock">
1962 <table><tr>
1963 <td class="icon">
1964 <div class="title">Note</div>
1965 </td>
1966 <td class="content">Some placeholders may depend on other options given to the
1967 revision traversal engine. For example, the <tt>%g*</tt> reflog options will
1968 insert an empty string unless we are traversing reflog entries (e.g., by
1969 <tt>git log -g</tt>). The <tt>%d</tt> placeholder will use the "short" decoration
1970 format if <tt>--decorate</tt> was not already provided on the command line.</td>
1971 </tr></table>
1972 </div>
1973 <div class="paragraph"><p>If you add a <tt>&#43;</tt> (plus sign) after <em>%</em> of a placeholder, a line-feed
1974 is inserted immediately before the expansion if and only if the
1975 placeholder expands to a non-empty string.</p></div>
1976 <div class="paragraph"><p>If you add a <tt>-</tt> (minus sign) after <em>%</em> of a placeholder, line-feeds that
1977 immediately precede the expansion are deleted if and only if the
1978 placeholder expands to an empty string.</p></div>
1979 <div class="paragraph"><p>If you add a ` ` (space) after <em>%</em> of a placeholder, a space
1980 is inserted immediately before the expansion if and only if the
1981 placeholder expands to a non-empty string.</p></div>
1982 <div class="ulist"><ul>
1983 <li>
1985 <em>tformat:</em>
1986 </p>
1987 <div class="paragraph"><p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it
1988 provides "terminator" semantics instead of "separator" semantics. In
1989 other words, each commit has the message terminator character (usually a
1990 newline) appended, rather than a separator placed between entries.
1991 This means that the final entry of a single-line format will be properly
1992 terminated with a new line, just as the "oneline" format does.
1993 For example:</p></div>
1994 <div class="listingblock">
1995 <div class="content">
1996 <pre><tt>$ git log -2 --pretty=format:%h 4da45bef \
1997 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
1998 4da45be
1999 7134973 -- NO NEWLINE
2001 $ git log -2 --pretty=tformat:%h 4da45bef \
2002 | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
2003 4da45be
2004 7134973</tt></pre>
2005 </div></div>
2006 <div class="paragraph"><p>In addition, any unrecognized string that has a <tt>%</tt> in it is interpreted
2007 as if it has <tt>tformat:</tt> in front of it. For example, these two are
2008 equivalent:</p></div>
2009 <div class="listingblock">
2010 <div class="content">
2011 <pre><tt>$ git log -2 --pretty=tformat:%h 4da45bef
2012 $ git log -2 --pretty=%h 4da45bef</tt></pre>
2013 </div></div>
2014 </li>
2015 </ul></div>
2016 </div>
2017 <h2 id="_common_diff_options">Common diff options</h2>
2018 <div class="sectionbody">
2019 <div class="dlist"><dl>
2020 <dt class="hdlist1">
2022 </dt>
2023 <dt class="hdlist1">
2025 </dt>
2026 <dt class="hdlist1">
2027 --patch
2028 </dt>
2029 <dd>
2031 Generate patch (see section on generating patches).
2033 </p>
2034 </dd>
2035 <dt class="hdlist1">
2036 -U&lt;n&gt;
2037 </dt>
2038 <dt class="hdlist1">
2039 --unified=&lt;n&gt;
2040 </dt>
2041 <dd>
2043 Generate diffs with &lt;n&gt; lines of context instead of
2044 the usual three.
2045 Implies <tt>-p</tt>.
2046 </p>
2047 </dd>
2048 <dt class="hdlist1">
2049 --raw
2050 </dt>
2051 <dd>
2053 Generate the raw format.
2055 </p>
2056 </dd>
2057 <dt class="hdlist1">
2058 --patch-with-raw
2059 </dt>
2060 <dd>
2062 Synonym for <tt>-p --raw</tt>.
2063 </p>
2064 </dd>
2065 <dt class="hdlist1">
2066 --patience
2067 </dt>
2068 <dd>
2070 Generate a diff using the "patience diff" algorithm.
2071 </p>
2072 </dd>
2073 <dt class="hdlist1">
2074 --stat[=&lt;width&gt;[,&lt;name-width&gt;]]
2075 </dt>
2076 <dd>
2078 Generate a diffstat. You can override the default
2079 output width for 80-column terminal by <tt>--stat=&lt;width&gt;</tt>.
2080 The width of the filename part can be controlled by
2081 giving another width to it separated by a comma.
2082 </p>
2083 </dd>
2084 <dt class="hdlist1">
2085 --numstat
2086 </dt>
2087 <dd>
2089 Similar to <tt>--stat</tt>, but shows number of added and
2090 deleted lines in decimal notation and pathname without
2091 abbreviation, to make it more machine friendly. For
2092 binary files, outputs two <tt>-</tt> instead of saying
2093 <tt>0 0</tt>.
2094 </p>
2095 </dd>
2096 <dt class="hdlist1">
2097 --shortstat
2098 </dt>
2099 <dd>
2101 Output only the last line of the <tt>--stat</tt> format containing total
2102 number of modified files, as well as number of added and deleted
2103 lines.
2104 </p>
2105 </dd>
2106 <dt class="hdlist1">
2107 --dirstat[=&lt;param1,param2,&#8230;&gt;]
2108 </dt>
2109 <dd>
2111 Output the distribution of relative amount of changes for each
2112 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
2113 passing it a comma separated list of parameters.
2114 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
2115 variable (see <a href="git-config.html">git-config(1)</a>).
2116 The following parameters are available:
2117 </p>
2118 <div class="dlist"><dl>
2119 <dt class="hdlist1">
2120 <tt>changes</tt>
2121 </dt>
2122 <dd>
2124 Compute the dirstat numbers by counting the lines that have been
2125 removed from the source, or added to the destination. This ignores
2126 the amount of pure code movements within a file. In other words,
2127 rearranging lines in a file is not counted as much as other changes.
2128 This is the default behavior when no parameter is given.
2129 </p>
2130 </dd>
2131 <dt class="hdlist1">
2132 <tt>lines</tt>
2133 </dt>
2134 <dd>
2136 Compute the dirstat numbers by doing the regular line-based diff
2137 analysis, and summing the removed/added line counts. (For binary
2138 files, count 64-byte chunks instead, since binary files have no
2139 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
2140 behavior than the <tt>changes</tt> behavior, but it does count rearranged
2141 lines within a file as much as other changes. The resulting output
2142 is consistent with what you get from the other <tt>--*stat</tt> options.
2143 </p>
2144 </dd>
2145 <dt class="hdlist1">
2146 <tt>files</tt>
2147 </dt>
2148 <dd>
2150 Compute the dirstat numbers by counting the number of files changed.
2151 Each changed file counts equally in the dirstat analysis. This is
2152 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
2153 not have to look at the file contents at all.
2154 </p>
2155 </dd>
2156 <dt class="hdlist1">
2157 <tt>cumulative</tt>
2158 </dt>
2159 <dd>
2161 Count changes in a child directory for the parent directory as well.
2162 Note that when using <tt>cumulative</tt>, the sum of the percentages
2163 reported may exceed 100%. The default (non-cumulative) behavior can
2164 be specified with the <tt>noncumulative</tt> parameter.
2165 </p>
2166 </dd>
2167 <dt class="hdlist1">
2168 &lt;limit&gt;
2169 </dt>
2170 <dd>
2172 An integer parameter specifies a cut-off percent (3% by default).
2173 Directories contributing less than this percentage of the changes
2174 are not shown in the output.
2175 </p>
2176 </dd>
2177 </dl></div>
2178 <div class="paragraph"><p>Example: The following will count changed files, while ignoring
2179 directories with less than 10% of the total amount of changed files,
2180 and accumulating child directory counts in the parent directories:
2181 <tt>--dirstat=files,10,cumulative</tt>.</p></div>
2182 </dd>
2183 <dt class="hdlist1">
2184 --summary
2185 </dt>
2186 <dd>
2188 Output a condensed summary of extended header information
2189 such as creations, renames and mode changes.
2190 </p>
2191 </dd>
2192 <dt class="hdlist1">
2193 --patch-with-stat
2194 </dt>
2195 <dd>
2197 Synonym for <tt>-p --stat</tt>.
2198 </p>
2199 </dd>
2200 <dt class="hdlist1">
2202 </dt>
2203 <dd>
2205 Separate the commits with NULs instead of with new newlines.
2206 </p>
2207 <div class="paragraph"><p>Also, when <tt>--raw</tt> or <tt>--numstat</tt> has been given, do not munge
2208 pathnames and use NULs as output field terminators.</p></div>
2209 <div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
2210 and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
2211 respectively, and the pathname will be enclosed in double quotes if
2212 any of those replacements occurred.</p></div>
2213 </dd>
2214 <dt class="hdlist1">
2215 --name-only
2216 </dt>
2217 <dd>
2219 Show only names of changed files.
2220 </p>
2221 </dd>
2222 <dt class="hdlist1">
2223 --name-status
2224 </dt>
2225 <dd>
2227 Show only names and status of changed files. See the description
2228 of the <tt>--diff-filter</tt> option on what the status letters mean.
2229 </p>
2230 </dd>
2231 <dt class="hdlist1">
2232 --submodule[=&lt;format&gt;]
2233 </dt>
2234 <dd>
2236 Chose the output format for submodule differences. &lt;format&gt; can be one of
2237 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
2238 is used when this option is not given. <em>log</em> is the default value for this
2239 option and lists the commits in that commit range like the <em>summary</em>
2240 option of <a href="git-submodule.html">git-submodule(1)</a> does.
2241 </p>
2242 </dd>
2243 <dt class="hdlist1">
2244 --color[=&lt;when&gt;]
2245 </dt>
2246 <dd>
2248 Show colored diff.
2249 The value must be <tt>always</tt> (the default for <tt>&lt;when&gt;</tt>), <tt>never</tt>, or <tt>auto</tt>.
2250 The default value is <tt>never</tt>.
2251 </p>
2252 </dd>
2253 <dt class="hdlist1">
2254 --no-color
2255 </dt>
2256 <dd>
2258 Turn off colored diff.
2259 It is the same as <tt>--color=never</tt>.
2260 </p>
2261 </dd>
2262 <dt class="hdlist1">
2263 --word-diff[=&lt;mode&gt;]
2264 </dt>
2265 <dd>
2267 Show a word diff, using the &lt;mode&gt; to delimit changed words.
2268 By default, words are delimited by whitespace; see
2269 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
2270 must be one of:
2271 </p>
2272 <div class="dlist"><dl>
2273 <dt class="hdlist1">
2274 color
2275 </dt>
2276 <dd>
2278 Highlight changed words using only colors. Implies <tt>--color</tt>.
2279 </p>
2280 </dd>
2281 <dt class="hdlist1">
2282 plain
2283 </dt>
2284 <dd>
2286 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
2287 attempts to escape the delimiters if they appear in the input,
2288 so the output may be ambiguous.
2289 </p>
2290 </dd>
2291 <dt class="hdlist1">
2292 porcelain
2293 </dt>
2294 <dd>
2296 Use a special line-based format intended for script
2297 consumption. Added/removed/unchanged runs are printed in the
2298 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
2299 character at the beginning of the line and extending to the
2300 end of the line. Newlines in the input are represented by a
2301 tilde <tt>~</tt> on a line of its own.
2302 </p>
2303 </dd>
2304 <dt class="hdlist1">
2305 none
2306 </dt>
2307 <dd>
2309 Disable word diff again.
2310 </p>
2311 </dd>
2312 </dl></div>
2313 <div class="paragraph"><p>Note that despite the name of the first mode, color is used to
2314 highlight the changed parts in all modes if enabled.</p></div>
2315 </dd>
2316 <dt class="hdlist1">
2317 --word-diff-regex=&lt;regex&gt;
2318 </dt>
2319 <dd>
2321 Use &lt;regex&gt; to decide what a word is, instead of considering
2322 runs of non-whitespace to be a word. Also implies
2323 <tt>--word-diff</tt> unless it was already enabled.
2324 </p>
2325 <div class="paragraph"><p>Every non-overlapping match of the
2326 &lt;regex&gt; is considered a word. Anything between these matches is
2327 considered whitespace and ignored(!) for the purposes of finding
2328 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
2329 expression to make sure that it matches all non-whitespace characters.
2330 A match that contains a newline is silently truncated(!) at the
2331 newline.</p></div>
2332 <div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
2333 <a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
2334 overrides any diff driver or configuration setting. Diff drivers
2335 override configuration settings.</p></div>
2336 </dd>
2337 <dt class="hdlist1">
2338 --color-words[=&lt;regex&gt;]
2339 </dt>
2340 <dd>
2342 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
2343 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
2344 </p>
2345 </dd>
2346 <dt class="hdlist1">
2347 --no-renames
2348 </dt>
2349 <dd>
2351 Turn off rename detection, even when the configuration
2352 file gives the default to do so.
2353 </p>
2354 </dd>
2355 <dt class="hdlist1">
2356 --check
2357 </dt>
2358 <dd>
2360 Warn if changes introduce trailing whitespace
2361 or an indent that uses a space before a tab. Exits with
2362 non-zero status if problems are found. Not compatible with
2363 --exit-code.
2364 </p>
2365 </dd>
2366 <dt class="hdlist1">
2367 --full-index
2368 </dt>
2369 <dd>
2371 Instead of the first handful of characters, show the full
2372 pre- and post-image blob object names on the "index"
2373 line when generating patch format output.
2374 </p>
2375 </dd>
2376 <dt class="hdlist1">
2377 --binary
2378 </dt>
2379 <dd>
2381 In addition to <tt>--full-index</tt>, output a binary diff that
2382 can be applied with <tt>git-apply</tt>.
2383 </p>
2384 </dd>
2385 <dt class="hdlist1">
2386 --abbrev[=&lt;n&gt;]
2387 </dt>
2388 <dd>
2390 Instead of showing the full 40-byte hexadecimal object
2391 name in diff-raw format output and diff-tree header
2392 lines, show only a partial prefix. This is
2393 independent of the <tt>--full-index</tt> option above, which controls
2394 the diff-patch output format. Non default number of
2395 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
2396 </p>
2397 </dd>
2398 <dt class="hdlist1">
2399 -B[&lt;n&gt;][/&lt;m&gt;]
2400 </dt>
2401 <dt class="hdlist1">
2402 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
2403 </dt>
2404 <dd>
2406 Break complete rewrite changes into pairs of delete and
2407 create. This serves two purposes:
2408 </p>
2409 <div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
2410 not as a series of deletion and insertion mixed together with a very
2411 few lines that happen to match textually as the context, but as a
2412 single deletion of everything old followed by a single insertion of
2413 everything new, and the number <tt>m</tt> controls this aspect of the -B
2414 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
2415 original should remain in the result for git to consider it a total
2416 rewrite (i.e. otherwise the resulting patch will be a series of
2417 deletion and insertion mixed together with context lines).</p></div>
2418 <div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
2419 source of a rename (usually -M only considers a file that disappeared
2420 as the source of a rename), and the number <tt>n</tt> controls this aspect of
2421 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
2422 addition and deletion compared to 20% or more of the file&#8217;s size are
2423 eligible for being picked up as a possible source of a rename to
2424 another file.</p></div>
2425 </dd>
2426 <dt class="hdlist1">
2427 -M[&lt;n&gt;]
2428 </dt>
2429 <dt class="hdlist1">
2430 --find-renames[=&lt;n&gt;]
2431 </dt>
2432 <dd>
2434 If generating diffs, detect and report renames for each commit.
2435 For following files across renames while traversing history, see
2436 <tt>--follow</tt>.
2437 If <tt>n</tt> is specified, it is a threshold on the similarity
2438 index (i.e. amount of addition/deletions compared to the
2439 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
2440 delete/add pair to be a rename if more than 90% of the file
2441 hasn&#8217;t changed.
2442 </p>
2443 </dd>
2444 <dt class="hdlist1">
2445 -C[&lt;n&gt;]
2446 </dt>
2447 <dt class="hdlist1">
2448 --find-copies[=&lt;n&gt;]
2449 </dt>
2450 <dd>
2452 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
2453 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
2454 </p>
2455 </dd>
2456 <dt class="hdlist1">
2457 --find-copies-harder
2458 </dt>
2459 <dd>
2461 For performance reasons, by default, <tt>-C</tt> option finds copies only
2462 if the original file of the copy was modified in the same
2463 changeset. This flag makes the command
2464 inspect unmodified files as candidates for the source of
2465 copy. This is a very expensive operation for large
2466 projects, so use it with caution. Giving more than one
2467 <tt>-C</tt> option has the same effect.
2468 </p>
2469 </dd>
2470 <dt class="hdlist1">
2472 </dt>
2473 <dt class="hdlist1">
2474 --irreversible-delete
2475 </dt>
2476 <dd>
2478 Omit the preimage for deletes, i.e. print only the header but not
2479 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
2480 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
2481 solely for people who want to just concentrate on reviewing the
2482 text after the change. In addition, the output obviously lack
2483 enough information to apply such a patch in reverse, even manually,
2484 hence the name of the option.
2485 </p>
2486 <div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
2487 of a delete/create pair.</p></div>
2488 </dd>
2489 <dt class="hdlist1">
2490 -l&lt;num&gt;
2491 </dt>
2492 <dd>
2494 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
2495 is the number of potential rename/copy targets. This
2496 option prevents rename/copy detection from running if
2497 the number of rename/copy targets exceeds the specified
2498 number.
2499 </p>
2500 </dd>
2501 <dt class="hdlist1">
2502 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
2503 </dt>
2504 <dd>
2506 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
2507 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
2508 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
2509 are Unmerged (<tt>U</tt>), are
2510 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
2511 Any combination of the filter characters (including none) can be used.
2512 When <tt>*</tt> (All-or-none) is added to the combination, all
2513 paths are selected if there is any file that matches
2514 other criteria in the comparison; if there is no file
2515 that matches other criteria, nothing is selected.
2516 </p>
2517 </dd>
2518 <dt class="hdlist1">
2519 -S&lt;string&gt;
2520 </dt>
2521 <dd>
2523 Look for differences that introduce or remove an instance of
2524 &lt;string&gt;. Note that this is different than the string simply
2525 appearing in diff output; see the <em>pickaxe</em> entry in
2526 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
2527 </p>
2528 </dd>
2529 <dt class="hdlist1">
2530 -G&lt;regex&gt;
2531 </dt>
2532 <dd>
2534 Look for differences whose added or removed line matches
2535 the given &lt;regex&gt;.
2536 </p>
2537 </dd>
2538 <dt class="hdlist1">
2539 --pickaxe-all
2540 </dt>
2541 <dd>
2543 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
2544 changeset, not just the files that contain the change
2545 in &lt;string&gt;.
2546 </p>
2547 </dd>
2548 <dt class="hdlist1">
2549 --pickaxe-regex
2550 </dt>
2551 <dd>
2553 Make the &lt;string&gt; not a plain string but an extended POSIX
2554 regex to match.
2555 </p>
2556 </dd>
2557 <dt class="hdlist1">
2558 -O&lt;orderfile&gt;
2559 </dt>
2560 <dd>
2562 Output the patch in the order specified in the
2563 &lt;orderfile&gt;, which has one shell glob pattern per line.
2564 </p>
2565 </dd>
2566 <dt class="hdlist1">
2568 </dt>
2569 <dd>
2571 Swap two inputs; that is, show differences from index or
2572 on-disk file to tree contents.
2573 </p>
2574 </dd>
2575 <dt class="hdlist1">
2576 --relative[=&lt;path&gt;]
2577 </dt>
2578 <dd>
2580 When run from a subdirectory of the project, it can be
2581 told to exclude changes outside the directory and show
2582 pathnames relative to it with this option. When you are
2583 not in a subdirectory (e.g. in a bare repository), you
2584 can name which subdirectory to make the output relative
2585 to by giving a &lt;path&gt; as an argument.
2586 </p>
2587 </dd>
2588 <dt class="hdlist1">
2590 </dt>
2591 <dt class="hdlist1">
2592 --text
2593 </dt>
2594 <dd>
2596 Treat all files as text.
2597 </p>
2598 </dd>
2599 <dt class="hdlist1">
2600 --ignore-space-at-eol
2601 </dt>
2602 <dd>
2604 Ignore changes in whitespace at EOL.
2605 </p>
2606 </dd>
2607 <dt class="hdlist1">
2609 </dt>
2610 <dt class="hdlist1">
2611 --ignore-space-change
2612 </dt>
2613 <dd>
2615 Ignore changes in amount of whitespace. This ignores whitespace
2616 at line end, and considers all other sequences of one or
2617 more whitespace characters to be equivalent.
2618 </p>
2619 </dd>
2620 <dt class="hdlist1">
2622 </dt>
2623 <dt class="hdlist1">
2624 --ignore-all-space
2625 </dt>
2626 <dd>
2628 Ignore whitespace when comparing lines. This ignores
2629 differences even if one line has whitespace where the other
2630 line has none.
2631 </p>
2632 </dd>
2633 <dt class="hdlist1">
2634 --inter-hunk-context=&lt;lines&gt;
2635 </dt>
2636 <dd>
2638 Show the context between diff hunks, up to the specified number
2639 of lines, thereby fusing hunks that are close to each other.
2640 </p>
2641 </dd>
2642 <dt class="hdlist1">
2643 --exit-code
2644 </dt>
2645 <dd>
2647 Make the program exit with codes similar to diff(1).
2648 That is, it exits with 1 if there were differences and
2649 0 means no differences.
2650 </p>
2651 </dd>
2652 <dt class="hdlist1">
2653 --quiet
2654 </dt>
2655 <dd>
2657 Disable all output of the program. Implies <tt>--exit-code</tt>.
2658 </p>
2659 </dd>
2660 <dt class="hdlist1">
2661 --ext-diff
2662 </dt>
2663 <dd>
2665 Allow an external diff helper to be executed. If you set an
2666 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
2667 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
2668 </p>
2669 </dd>
2670 <dt class="hdlist1">
2671 --no-ext-diff
2672 </dt>
2673 <dd>
2675 Disallow external diff drivers.
2676 </p>
2677 </dd>
2678 <dt class="hdlist1">
2679 --ignore-submodules[=&lt;when&gt;]
2680 </dt>
2681 <dd>
2683 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
2684 either "none", "untracked", "dirty" or "all", which is the default
2685 Using "none" will consider the submodule modified when it either contains
2686 untracked or modified files or its HEAD differs from the commit recorded
2687 in the superproject and can be used to override any settings of the
2688 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
2689 "untracked" is used submodules are not considered dirty when they only
2690 contain untracked content (but they are still scanned for modified
2691 content). Using "dirty" ignores all changes to the work tree of submodules,
2692 only changes to the commits stored in the superproject are shown (this was
2693 the behavior until 1.7.0). Using "all" hides all changes to submodules.
2694 </p>
2695 </dd>
2696 <dt class="hdlist1">
2697 --src-prefix=&lt;prefix&gt;
2698 </dt>
2699 <dd>
2701 Show the given source prefix instead of "a/".
2702 </p>
2703 </dd>
2704 <dt class="hdlist1">
2705 --dst-prefix=&lt;prefix&gt;
2706 </dt>
2707 <dd>
2709 Show the given destination prefix instead of "b/".
2710 </p>
2711 </dd>
2712 <dt class="hdlist1">
2713 --no-prefix
2714 </dt>
2715 <dd>
2717 Do not show any source or destination prefix.
2718 </p>
2719 </dd>
2720 </dl></div>
2721 <div class="paragraph"><p>For more detailed explanation on these common options, see also
2722 <a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
2723 </div>
2724 <h2 id="_generating_patches_with_p">Generating patches with -p</h2>
2725 <div class="sectionbody">
2726 <div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
2727 with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
2728 "git log" with the "-p" option, they
2729 do not produce the output described above; instead they produce a
2730 patch file. You can customize the creation of such patches via the
2731 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2732 <div class="paragraph"><p>What the -p option produces is slightly different from the traditional
2733 diff format:</p></div>
2734 <div class="olist arabic"><ol class="arabic">
2735 <li>
2737 It is preceded with a "git diff" header that looks like this:
2738 </p>
2739 <div class="literalblock">
2740 <div class="content">
2741 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2742 </div></div>
2743 <div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2744 involved. Especially, even for a creation or a deletion,
2745 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2746 <div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2747 name of the source file of the rename/copy and the name of
2748 the file that rename/copy produces, respectively.</p></div>
2749 </li>
2750 <li>
2752 It is followed by one or more extended header lines:
2753 </p>
2754 <div class="literalblock">
2755 <div class="content">
2756 <pre><tt>old mode &lt;mode&gt;
2757 new mode &lt;mode&gt;
2758 deleted file mode &lt;mode&gt;
2759 new file mode &lt;mode&gt;
2760 copy from &lt;path&gt;
2761 copy to &lt;path&gt;
2762 rename from &lt;path&gt;
2763 rename to &lt;path&gt;
2764 similarity index &lt;number&gt;
2765 dissimilarity index &lt;number&gt;
2766 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
2767 </div></div>
2768 <div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
2769 and file permission bits.</p></div>
2770 <div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2771 <div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
2772 the dissimilarity index is the percentage of changed lines. It
2773 is a rounded down integer, followed by a percent sign. The
2774 similarity index value of 100% is thus reserved for two equal
2775 files, while 100% dissimilarity means that no line from the old
2776 file made it into the new one.</p></div>
2777 <div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
2778 The &lt;mode&gt; is included if the file mode does not change; otherwise,
2779 separate lines indicate the old and the new mode.</p></div>
2780 </li>
2781 <li>
2783 TAB, LF, double quote and backslash characters in pathnames
2784 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
2785 If there is need for such substitution then the whole
2786 pathname is put in double quotes.
2787 </p>
2788 </li>
2789 <li>
2791 All the <tt>file1</tt> files in the output refer to files before the
2792 commit, and all the <tt>file2</tt> files refer to files after the commit.
2793 It is incorrect to apply each change to each file sequentially. For
2794 example, this patch will swap a and b:
2795 </p>
2796 <div class="literalblock">
2797 <div class="content">
2798 <pre><tt>diff --git a/a b/b
2799 rename from a
2800 rename to b
2801 diff --git a/b b/a
2802 rename from b
2803 rename to a</tt></pre>
2804 </div></div>
2805 </li>
2806 </ol></div>
2807 </div>
2808 <h2 id="_combined_diff_format">combined diff format</h2>
2809 <div class="sectionbody">
2810 <div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
2811 produce a <em>combined diff</em> when showing a merge. This is the default
2812 format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
2813 <a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
2814 of these commands to force generation of diffs with individual parents
2815 of a merge.</p></div>
2816 <div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
2817 <div class="listingblock">
2818 <div class="content">
2819 <pre><tt>diff --combined describe.c
2820 index fabadb8,cc95eb0..4866510
2821 --- a/describe.c
2822 +++ b/describe.c
2823 @@@ -98,20 -98,12 +98,20 @@@
2824 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
2827 - static void describe(char *arg)
2828 -static void describe(struct commit *cmit, int last_one)
2829 ++static void describe(char *arg, int last_one)
2831 + unsigned char sha1[20];
2832 + struct commit *cmit;
2833 struct commit_list *list;
2834 static int initialized = 0;
2835 struct commit_name *n;
2837 + if (get_sha1(arg, sha1) &lt; 0)
2838 + usage(describe_usage);
2839 + cmit = lookup_commit_reference(sha1);
2840 + if (!cmit)
2841 + usage(describe_usage);
2843 if (!initialized) {
2844 initialized = 1;
2845 for_each_ref(get_name);</tt></pre>
2846 </div></div>
2847 <div class="olist arabic"><ol class="arabic">
2848 <li>
2850 It is preceded with a "git diff" header, that looks like
2851 this (when <em>-c</em> option is used):
2852 </p>
2853 <div class="literalblock">
2854 <div class="content">
2855 <pre><tt>diff --combined file</tt></pre>
2856 </div></div>
2857 <div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
2858 <div class="literalblock">
2859 <div class="content">
2860 <pre><tt>diff --cc file</tt></pre>
2861 </div></div>
2862 </li>
2863 <li>
2865 It is followed by one or more extended header lines
2866 (this example shows a merge with two parents):
2867 </p>
2868 <div class="literalblock">
2869 <div class="content">
2870 <pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
2871 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2872 new file mode &lt;mode&gt;
2873 deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
2874 </div></div>
2875 <div class="paragraph"><p>The <tt>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</tt> line appears only if at least one of
2876 the &lt;mode&gt; is different from the rest. Extended headers with
2877 information about detected contents movement (renames and
2878 copying detection) are designed to work with diff of two
2879 &lt;tree-ish&gt; and are not used by combined diff format.</p></div>
2880 </li>
2881 <li>
2883 It is followed by two-line from-file/to-file header
2884 </p>
2885 <div class="literalblock">
2886 <div class="content">
2887 <pre><tt>--- a/file
2888 +++ b/file</tt></pre>
2889 </div></div>
2890 <div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
2891 format, <tt>/dev/null</tt> is used to signal created or deleted
2892 files.</p></div>
2893 </li>
2894 <li>
2896 Chunk header format is modified to prevent people from
2897 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
2898 was created for review of merge commit changes, and was not
2899 meant for apply. The change is similar to the change in the
2900 extended <em>index</em> header:
2901 </p>
2902 <div class="literalblock">
2903 <div class="content">
2904 <pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
2905 </div></div>
2906 <div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
2907 header for combined diff format.</p></div>
2908 </li>
2909 </ol></div>
2910 <div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
2911 files A and B with a single column that has <tt>-</tt> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <tt>+</tt> (plus&#8201;&#8212;&#8201;missing in A but
2912 added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
2913 compares two or more files file1, file2,&#8230; with one file X, and
2914 shows how X differs from each of fileN. One column for each of
2915 fileN is prepended to the output line to note how X&#8217;s line is
2916 different from it.</p></div>
2917 <div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
2918 fileN but it does not appear in the result. A <tt>+</tt> character
2919 in the column N means that the line appears in the result,
2920 and fileN does not have that line (in other words, the line was
2921 added, from the point of view of that parent).</p></div>
2922 <div class="paragraph"><p>In the above example output, the function signature was changed
2923 from both files (hence two <tt>-</tt> removals from both file1 and
2924 file2, plus <tt>++</tt> to mean one line that was added does not appear
2925 in either file1 nor file2). Also eight other lines are the same
2926 from file1 but do not appear in file2 (hence prefixed with <tt>&#43;</tt>).</p></div>
2927 <div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
2928 merge commit with the merge result (i.e. file1..fileN are the
2929 parents). When shown by <tt>git diff-files -c</tt>, it compares the
2930 two unresolved merge parents with the working tree file
2931 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
2932 "their version").</p></div>
2933 </div>
2934 <h2 id="_examples">Examples</h2>
2935 <div class="sectionbody">
2936 <div class="dlist"><dl>
2937 <dt class="hdlist1">
2938 git log --no-merges
2939 </dt>
2940 <dd>
2942 Show the whole commit history, but skip any merges
2943 </p>
2944 </dd>
2945 <dt class="hdlist1">
2946 git log v2.6.12.. include/scsi drivers/scsi
2947 </dt>
2948 <dd>
2950 Show all commits since version <em>v2.6.12</em> that changed any file
2951 in the include/scsi or drivers/scsi subdirectories
2952 </p>
2953 </dd>
2954 <dt class="hdlist1">
2955 git log --since="2 weeks ago" -- gitk
2956 </dt>
2957 <dd>
2959 Show the changes during the last two weeks to the file <em>gitk</em>.
2960 The "--" is necessary to avoid confusion with the <strong>branch</strong> named
2961 <em>gitk</em>
2962 </p>
2963 </dd>
2964 <dt class="hdlist1">
2965 git log --name-status release..test
2966 </dt>
2967 <dd>
2969 Show the commits that are in the "test" branch but not yet
2970 in the "release" branch, along with the list of paths
2971 each commit modifies.
2972 </p>
2973 </dd>
2974 <dt class="hdlist1">
2975 git log --follow builtin-rev-list.c
2976 </dt>
2977 <dd>
2979 Shows the commits that changed builtin-rev-list.c, including
2980 those commits that occurred before the file was given its
2981 present name.
2982 </p>
2983 </dd>
2984 <dt class="hdlist1">
2985 git log --branches --not --remotes=origin
2986 </dt>
2987 <dd>
2989 Shows all commits that are in any of local branches but not in
2990 any of remote-tracking branches for <em>origin</em> (what you have that
2991 origin doesn&#8217;t).
2992 </p>
2993 </dd>
2994 <dt class="hdlist1">
2995 git log master --not --remotes=*/master
2996 </dt>
2997 <dd>
2999 Shows all commits that are in local master but not in any remote
3000 repository master branches.
3001 </p>
3002 </dd>
3003 <dt class="hdlist1">
3004 git log -p -m --first-parent
3005 </dt>
3006 <dd>
3008 Shows the history including change diffs, but only from the
3009 "main branch" perspective, skipping commits that come from merged
3010 branches, and showing full diffs of changes introduced by the merges.
3011 This makes sense only when following a strict policy of merging all
3012 topic branches when staying on a single integration branch.
3013 </p>
3014 </dd>
3015 </dl></div>
3016 </div>
3017 <h2 id="_discussion">Discussion</h2>
3018 <div class="sectionbody">
3019 <div class="paragraph"><p>At the core level, git is character encoding agnostic.</p></div>
3020 <div class="ulist"><ul>
3021 <li>
3023 The pathnames recorded in the index and in the tree objects
3024 are treated as uninterpreted sequences of non-NUL bytes.
3025 What readdir(2) returns are what are recorded and compared
3026 with the data git keeps track of, which in turn are expected
3027 to be what lstat(2) and creat(2) accepts. There is no such
3028 thing as pathname encoding translation.
3029 </p>
3030 </li>
3031 <li>
3033 The contents of the blob objects are uninterpreted sequences
3034 of bytes. There is no encoding translation at the core
3035 level.
3036 </p>
3037 </li>
3038 <li>
3040 The commit log messages are uninterpreted sequences of non-NUL
3041 bytes.
3042 </p>
3043 </li>
3044 </ul></div>
3045 <div class="paragraph"><p>Although we encourage that the commit log messages are encoded
3046 in UTF-8, both the core and git Porcelain are designed not to
3047 force UTF-8 on projects. If all participants of a particular
3048 project find it more convenient to use legacy encodings, git
3049 does not forbid it. However, there are a few things to keep in
3050 mind.</p></div>
3051 <div class="olist arabic"><ol class="arabic">
3052 <li>
3054 <em>git commit</em> and <em>git commit-tree</em> issues
3055 a warning if the commit log message given to it does not look
3056 like a valid UTF-8 string, unless you explicitly say your
3057 project uses a legacy encoding. The way to say this is to
3058 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
3059 </p>
3060 <div class="listingblock">
3061 <div class="content">
3062 <pre><tt>[i18n]
3063 commitencoding = ISO-8859-1</tt></pre>
3064 </div></div>
3065 <div class="paragraph"><p>Commit objects created with the above setting record the value
3066 of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
3067 help other people who look at them later. Lack of this header
3068 implies that the commit log message is encoded in UTF-8.</p></div>
3069 </li>
3070 <li>
3072 <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
3073 <tt>encoding</tt> header of a commit object, and try to re-code the
3074 log message into UTF-8 unless otherwise specified. You can
3075 specify the desired output encoding with
3076 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
3077 </p>
3078 <div class="listingblock">
3079 <div class="content">
3080 <pre><tt>[i18n]
3081 logoutputencoding = ISO-8859-1</tt></pre>
3082 </div></div>
3083 <div class="paragraph"><p>If you do not have this configuration variable, the value of
3084 <tt>i18n.commitencoding</tt> is used instead.</p></div>
3085 </li>
3086 </ol></div>
3087 <div class="paragraph"><p>Note that we deliberately chose not to re-code the commit log
3088 message when a commit is made to force UTF-8 at the commit
3089 object level, because re-coding to UTF-8 is not necessarily a
3090 reversible operation.</p></div>
3091 </div>
3092 <h2 id="_configuration">Configuration</h2>
3093 <div class="sectionbody">
3094 <div class="paragraph"><p>See <a href="git-config.html">git-config(1)</a> for core variables and <a href="git-diff.html">git-diff(1)</a>
3095 for settings related to diff generation.</p></div>
3096 <div class="dlist"><dl>
3097 <dt class="hdlist1">
3098 format.pretty
3099 </dt>
3100 <dd>
3102 Default for the <tt>--format</tt> option. (See "PRETTY FORMATS" above.)
3103 Defaults to "medium".
3104 </p>
3105 </dd>
3106 <dt class="hdlist1">
3107 i18n.logOutputEncoding
3108 </dt>
3109 <dd>
3111 Encoding to use when displaying logs. (See "Discussion", above.)
3112 Defaults to the value of <tt>i18n.commitEncoding</tt> if set, UTF-8
3113 otherwise.
3114 </p>
3115 </dd>
3116 <dt class="hdlist1">
3117 log.date
3118 </dt>
3119 <dd>
3121 Default format for human-readable dates. (Compare the
3122 <tt>--date</tt> option.) Defaults to "default", which means to write
3123 dates like <tt>Sat May 8 19:35:34 2010 -0500</tt>.
3124 </p>
3125 </dd>
3126 <dt class="hdlist1">
3127 log.showroot
3128 </dt>
3129 <dd>
3131 If <tt>false</tt>, <em>git log</em> and related commands will not treat the
3132 initial commit as a big creation event. Any root commits in
3133 <tt>git log -p</tt> output would be shown without a diff attached.
3134 The default is <tt>true</tt>.
3135 </p>
3136 </dd>
3137 <dt class="hdlist1">
3138 mailmap.file
3139 </dt>
3140 <dd>
3142 See <a href="git-shortlog.html">git-shortlog(1)</a>.
3143 </p>
3144 </dd>
3145 <dt class="hdlist1">
3146 notes.displayRef
3147 </dt>
3148 <dd>
3150 Which refs, in addition to the default set by <tt>core.notesRef</tt>
3151 or <em>GIT_NOTES_REF</em>, to read notes from when showing commit
3152 messages with the <em>log</em> family of commands. See
3153 <a href="git-notes.html">git-notes(1)</a>.
3154 </p>
3155 <div class="paragraph"><p>May be an unabbreviated ref name or a glob and may be specified
3156 multiple times. A warning will be issued for refs that do not exist,
3157 but a glob that does not match any refs is silently ignored.</p></div>
3158 <div class="paragraph"><p>This setting can be disabled by the <tt>--no-notes</tt> option,
3159 overridden by the <em>GIT_NOTES_DISPLAY_REF</em> environment variable,
3160 and overridden by the <tt>--notes=&lt;ref&gt;</tt> option.</p></div>
3161 </dd>
3162 </dl></div>
3163 </div>
3164 <h2 id="_git">GIT</h2>
3165 <div class="sectionbody">
3166 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
3167 </div>
3168 <div id="footer">
3169 <div id="footer-text">
3170 Last updated 2011-05-03 00:48:04 UTC
3171 </div>
3172 </div>
3173 </body>
3174 </html>