1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.4.5" />
7 <title>git-log(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-log(
1) Manual Page
409 <div class=
"sectionbody">
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git log
</em> [
<options
>] [
<since
>..
<until
>] [[--]
<path
>…]
</div>
419 <div class=
"verseblock-attribution">
422 <h2 id=
"_description">DESCRIPTION
</h2>
423 <div class=
"sectionbody">
424 <div class=
"paragraph"><p>Shows the commit logs.
</p></div>
425 <div class=
"paragraph"><p>The command takes options applicable to the
<em>git rev-list
</em>
426 command to control what is shown and how, and options applicable to
427 the
<em>git diff-*
</em> commands to control how the changes
428 each commit introduces are shown.
</p></div>
430 <h2 id=
"_options">OPTIONS
</h2>
431 <div class=
"sectionbody">
432 <div class=
"dlist"><dl>
438 Limits the number of commits to show.
439 Note that this is a commit limiting option, see below.
443 <since
>..
<until
>
447 Show only commits between the named two commits. When
448 either
<since
> or
<until
> is omitted, it defaults to
449 <tt>HEAD
</tt>, i.e. the tip of the current branch.
450 For a more complete list of ways to spell
<since
>
451 and
<until
>, see
<a href=
"gitrevisions.html">gitrevisions(
7)
</a>.
459 Continue listing the history of a file beyond renames
460 (works only for a single file).
467 --decorate[=short|full|no]
471 Print out the ref names of any commits that are shown. If
<em>short
</em> is
472 specified, the ref name prefixes
<em>refs/heads/
</em>,
<em>refs/tags/
</em> and
473 <em>refs/remotes/
</em> will not be printed. If
<em>full
</em> is specified, the
474 full ref name (including prefix) will be printed. The default option
483 Print out the ref name given on the command line by which each
492 Without this flag,
"git log -p <path>…" shows commits that
493 touch the specified paths, and diffs about the same specified
494 paths. With this, the full diff is shown for commits that touch
495 the specified paths; this means that
"<path>…" limits only
496 commits, and doesn
’t limit diff for those commits.
498 <div class=
"paragraph"><p>Note that this affects all diff-based output types, e.g. those
499 produced by --stat etc.
</p></div>
506 Before the log message print out its size in bytes. Intended
507 mainly for porcelain tools consumption. If git is unable to
508 produce a valid value size is set to zero.
509 Note that only message is considered, if also a diff is shown
510 its size is not included.
514 [--]
<path
>…
518 Show only commits that affect any of the specified paths. To
519 prevent confusion with options and branch names, paths may need
520 to be prefixed with
"-- " to separate them from options or
525 <h3 id=
"_commit_limiting">Commit Limiting
</h3><div style=
"clear:left"></div>
526 <div class=
"paragraph"><p>Besides specifying a range of commits that should be listed using the
527 special notations explained in the description, additional commit
528 limiting may be applied. Note that they are applied before commit
529 ordering and formatting options, such as
<em>--reverse
</em>.
</p></div>
530 <div class=
"dlist"><dl>
535 --max-count=
<number
>
539 Limit the number of commits to output.
543 --skip=
<number
>
547 Skip
<em>number
</em> commits before starting to show the commit output.
558 Show commits more recent than a specific date.
565 --before=
<date
>
569 Show commits older than a specific date.
573 --author=
<pattern
>
576 --committer=
<pattern
>
580 Limit the commits output to ones with author/committer
581 header lines that match the specified pattern (regular expression).
585 --grep=
<pattern
>
589 Limit the commits output to ones with log message that
590 matches the specified pattern (regular expression).
598 Limit the commits output to ones that match all given --grep,
599 --author and --committer instead of ones that match at least one.
610 Match the regexp limiting patterns without regard to letters case.
621 Consider the limiting patterns to be extended regular expressions
622 instead of the default basic regular expressions.
633 Consider the limiting patterns to be fixed strings (don
’t interpret
634 pattern as a regular expression).
642 Stop when a given path disappears from the tree.
650 Print only merge commits. This is exactly the same as
<tt>--min-parents=
2</tt>.
658 Do not print commits with more than one parent. This is
659 exactly the same as
<tt>--max-parents=
1</tt>.
663 --min-parents=
<number
>
666 --max-parents=
<number
>
676 Show only commits which have at least (or at most) that many
677 commits. In particular,
<tt>--max-parents=
1</tt> is the same as
<tt>--no-merges
</tt>,
678 <tt>--min-parents=
2</tt> is the same as
<tt>--merges
</tt>.
<tt>--max-parents=
0</tt>
679 gives all root commits and
<tt>--min-parents=
3</tt> all octopus merges.
681 <div class=
"paragraph"><p><tt>--no-min-parents
</tt> and
<tt>--no-max-parents
</tt> reset these limits (to no limit)
682 again. Equivalent forms are
<tt>--min-parents=
0</tt> (any commit has
0 or more
683 parents) and
<tt>--max-parents=-
1</tt> (negative numbers denote no upper limit).
</p></div>
690 Follow only the first parent commit upon seeing a merge
691 commit. This option can give a better overview when
692 viewing the evolution of a particular topic branch,
693 because merges into a topic branch tend to be only about
694 adjusting to updated upstream from time to time, and
695 this option allows you to ignore the individual commits
696 brought in to your history by such a merge.
704 Reverses the meaning of the
<em>^</em> prefix (or lack thereof)
705 for all following revision specifiers, up to the next
<em>--not
</em>.
713 Pretend as if all the refs in
<tt>refs/
</tt> are listed on the
714 command line as
<em><commit
></em>.
718 --branches[=
<pattern
>]
722 Pretend as if all the refs in
<tt>refs/heads
</tt> are listed
723 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
724 branches to ones matching given shell glob. If pattern lacks
<em>?
</em>,
725 <em><strong></em>, or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
729 --tags[=
<pattern
>]
733 Pretend as if all the refs in
<tt>refs/tags
</tt> are listed
734 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
735 tags to ones matching given shell glob. If pattern lacks
<em>?
</em>,
<em><strong></em>,
736 or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
740 --remotes[=
<pattern
>]
744 Pretend as if all the refs in
<tt>refs/remotes
</tt> are listed
745 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
746 remote-tracking branches to ones matching given shell glob.
747 If pattern lacks
<em>?
</em>,
<em><strong></em>, or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
751 --glob=
<glob-pattern
>
755 Pretend as if all the refs matching shell glob
<em><glob-pattern
></em>
756 are listed on the command line as
<em><commit
></em>. Leading
<em>refs/
</em>,
757 is automatically prepended if missing. If pattern lacks
<em>?
</em>,
<em><strong></em>,
758 or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
766 Upon seeing an invalid object name in the input, pretend as if
767 the bad input was not given.
775 Pretend as if the bad bisection ref
<tt>refs/bisect/bad
</tt>
776 was listed and as if it was followed by
<tt>--not
</tt> and the good
777 bisection refs
<tt>refs/bisect/good-*
</tt> on the command
786 In addition to the
<em><commit
></em> listed on the command
787 line, read them from the standard input. If a
<em>--
</em> separator is
788 seen, stop reading commits and start reading paths to limit the
797 Like
<tt>--cherry-pick
</tt> (see below) but mark equivalent commits
798 with
<tt>=
</tt> rather than omitting them, and inequivalent ones with
<tt>+
</tt>.
806 Omit any commit that introduces the same change as
807 another commit on the
"other side" when the set of
808 commits are limited with symmetric difference.
810 <div class=
"paragraph"><p>For example, if you have two branches,
<tt>A
</tt> and
<tt>B
</tt>, a usual way
811 to list all commits on only one side of them is with
812 <tt>--left-right
</tt> (see the example below in the description of
813 the
<tt>--left-right
</tt> option). It however shows the commits that were cherry-picked
814 from the other branch (for example,
"3rd on b" may be cherry-picked
815 from branch A). With this option, such pairs of commits are
816 excluded from the output.
</p></div>
826 List only commits on the respective side of a symmetric range,
827 i.e. only those which would be marked
<tt><</tt> resp.
<tt>></tt> by
828 <tt>--left-right
</tt>.
830 <div class=
"paragraph"><p>For example,
<tt>--cherry-pick --right-only A
…B
</tt> omits those
831 commits from
<tt>B
</tt> which are in
<tt>A
</tt> or are patch-equivalent to a commit in
832 <tt>A
</tt>. In other words, this lists the
<tt>+</tt> commits from
<tt>git cherry A B
</tt>.
833 More precisely,
<tt>--cherry-pick --right-only --no-merges
</tt> gives the exact
841 A synonym for
<tt>--right-only --cherry-mark --no-merges
</tt>; useful to
842 limit the output to the commits on our side and mark those that
843 have been applied to the other side of a forked history with
844 <tt>git log --cherry upstream
…mybranch
</tt>, similar to
845 <tt>git cherry upstream mybranch
</tt>.
856 Instead of walking the commit ancestry chain, walk
857 reflog entries from the most recent one to older ones.
858 When this option is used you cannot specify commits to
859 exclude (that is,
<em>^commit
</em>,
<em>commit1..commit2
</em>,
860 nor
<em>commit1...commit2
</em> notations cannot be used).
862 <div class=
"paragraph"><p>With
<em>--pretty
</em> format other than oneline (for obvious reasons),
863 this causes the output to have two extra lines of information
864 taken from the reflog. By default,
<em>commit@{Nth}
</em> notation is
865 used in the output. When the starting commit is specified as
866 <em>commit@{now}
</em>, output also uses
<em>commit@{timestamp}
</em> notation
867 instead. Under
<em>--pretty=oneline
</em>, the commit message is
868 prefixed with this information on the same line.
869 This option cannot be combined with
<em>--reverse
</em>.
870 See also
<a href=
"git-reflog.html">git-reflog(
1)
</a>.
</p></div>
877 After a failed merge, show refs that touch files having a
878 conflict and don
’t exist on all heads to merge.
886 Output uninteresting commits at the boundary, which are usually
891 <h3 id=
"_history_simplification">History Simplification
</h3><div style=
"clear:left"></div>
892 <div class=
"paragraph"><p>Sometimes you are only interested in parts of the history, for example the
893 commits modifying a particular
<path
>. But there are two parts of
894 <em>History Simplification
</em>, one part is selecting the commits and the other
895 is how to do it, as there are various strategies to simplify the history.
</p></div>
896 <div class=
"paragraph"><p>The following options select the commits to be shown:
</p></div>
897 <div class=
"dlist"><dl>
903 Commits modifying the given
<paths
> are selected.
907 --simplify-by-decoration
911 Commits that are referred by some branch or tag are selected.
915 <div class=
"paragraph"><p>Note that extra commits can be shown to give a meaningful history.
</p></div>
916 <div class=
"paragraph"><p>The following options affect the way the simplification is performed:
</p></div>
917 <div class=
"dlist"><dl>
923 Simplifies the history to the simplest history explaining the
924 final state of the tree. Simplest because it prunes some side
925 branches if the end result is the same (i.e. merging branches
926 with the same content)
934 Same as the default mode, but does not prune some history.
942 Only the selected commits are shown, plus some to have a
951 All commits in the simplified history are shown.
959 Additional option to
<em>--full-history
</em> to remove some needless
960 merges from the resulting history, as there are no selected
961 commits contributing to this merge.
969 When given a range of commits to display (e.g.
<em>commit1..commit2
</em>
970 or
<em>commit2
^commit1
</em>), only display commits that exist
971 directly on the ancestry chain between the
<em>commit1
</em> and
972 <em>commit2
</em>, i.e. commits that are both descendants of
<em>commit1
</em>,
973 and ancestors of
<em>commit2
</em>.
977 <div class=
"paragraph"><p>A more detailed explanation follows.
</p></div>
978 <div class=
"paragraph"><p>Suppose you specified
<tt>foo
</tt> as the
<paths
>. We shall call commits
979 that modify
<tt>foo
</tt> !TREESAME, and the rest TREESAME. (In a diff
980 filtered for
<tt>foo
</tt>, they look different and equal, respectively.)
</p></div>
981 <div class=
"paragraph"><p>In the following, we will always refer to the same example history to
982 illustrate the differences between simplification settings. We assume
983 that you are filtering for a file
<tt>foo
</tt> in this commit graph:
</p></div>
984 <div class=
"listingblock">
985 <div class=
"content">
986 <pre><tt> .-A---M---N---O---P
990 `-------------'
</tt></pre>
992 <div class=
"paragraph"><p>The horizontal line of history A---P is taken to be the first parent of
993 each merge. The commits are:
</p></div>
994 <div class=
"ulist"><ul>
997 <tt>I
</tt> is the initial commit, in which
<tt>foo
</tt> exists with contents
998 "asdf", and a file
<tt>quux
</tt> exists with contents
"quux". Initial
999 commits are compared to an empty tree, so
<tt>I
</tt> is !TREESAME.
1004 In
<tt>A
</tt>,
<tt>foo
</tt> contains just
"foo".
1009 <tt>B
</tt> contains the same change as
<tt>A
</tt>. Its merge
<tt>M
</tt> is trivial and
1010 hence TREESAME to all parents.
1015 <tt>C
</tt> does not change
<tt>foo
</tt>, but its merge
<tt>N
</tt> changes it to
"foobar",
1016 so it is not TREESAME to any parent.
1021 <tt>D
</tt> sets
<tt>foo
</tt> to
"baz". Its merge
<tt>O
</tt> combines the strings from
1022 <tt>N
</tt> and
<tt>D
</tt> to
"foobarbaz"; i.e., it is not TREESAME to any parent.
1027 <tt>E
</tt> changes
<tt>quux
</tt> to
"xyzzy", and its merge
<tt>P
</tt> combines the
1028 strings to
"quux xyzzy". Despite appearing interesting,
<tt>P
</tt> is
1029 TREESAME to all parents.
1033 <div class=
"paragraph"><p><em>rev-list
</em> walks backwards through history, including or excluding
1034 commits based on whether
<em>--full-history
</em> and/or parent rewriting
1035 (via
<em>--parents
</em> or
<em>--children
</em>) are used. The following settings
1036 are available.
</p></div>
1037 <div class=
"dlist"><dl>
1038 <dt class=
"hdlist1">
1043 Commits are included if they are not TREESAME to any parent
1044 (though this can be changed, see
<em>--sparse
</em> below). If the
1045 commit was a merge, and it was TREESAME to one parent, follow
1046 only that parent. (Even if there are several TREESAME
1047 parents, follow only one of them.) Otherwise, follow all
1050 <div class=
"paragraph"><p>This results in:
</p></div>
1051 <div class=
"listingblock">
1052 <div class=
"content">
1053 <pre><tt> .-A---N---O
1055 I---------D
</tt></pre>
1057 <div class=
"paragraph"><p>Note how the rule to only follow the TREESAME parent, if one is
1058 available, removed
<tt>B
</tt> from consideration entirely.
<tt>C
</tt> was
1059 considered via
<tt>N
</tt>, but is TREESAME. Root commits are compared to an
1060 empty tree, so
<tt>I
</tt> is !TREESAME.
</p></div>
1061 <div class=
"paragraph"><p>Parent/child relations are only visible with --parents, but that does
1062 not affect the commits selected in default mode, so we have shown the
1063 parent lines.
</p></div>
1065 <dt class=
"hdlist1">
1066 --full-history without parent rewriting
1070 This mode differs from the default in one point: always follow
1071 all parents of a merge, even if it is TREESAME to one of them.
1072 Even if more than one side of the merge has commits that are
1073 included, this does not imply that the merge itself is! In
1076 <div class=
"listingblock">
1077 <div class=
"content">
1078 <pre><tt> I A B N D O
</tt></pre>
1080 <div class=
"paragraph"><p><tt>P
</tt> and
<tt>M
</tt> were excluded because they are TREESAME to a parent.
<tt>E
</tt>,
1081 <tt>C
</tt> and
<tt>B
</tt> were all walked, but only
<tt>B
</tt> was !TREESAME, so the others
1082 do not appear.
</p></div>
1083 <div class=
"paragraph"><p>Note that without parent rewriting, it is not really possible to talk
1084 about the parent/child relationships between the commits, so we show
1085 them disconnected.
</p></div>
1087 <dt class=
"hdlist1">
1088 --full-history with parent rewriting
1092 Ordinary commits are only included if they are !TREESAME
1093 (though this can be changed, see
<em>--sparse
</em> below).
1095 <div class=
"paragraph"><p>Merges are always included. However, their parent list is rewritten:
1096 Along each parent, prune away commits that are not included
1097 themselves. This results in
</p></div>
1098 <div class=
"listingblock">
1099 <div class=
"content">
1100 <pre><tt> .-A---M---N---O---P
1104 `-------------'
</tt></pre>
1106 <div class=
"paragraph"><p>Compare to
<em>--full-history
</em> without rewriting above. Note that
<tt>E
</tt>
1107 was pruned away because it is TREESAME, but the parent list of P was
1108 rewritten to contain
<tt>E
</tt>'s parent
<tt>I
</tt>. The same happened for
<tt>C
</tt> and
1109 <tt>N
</tt>. Note also that
<tt>P
</tt> was included despite being TREESAME.
</p></div>
1112 <div class=
"paragraph"><p>In addition to the above settings, you can change whether TREESAME
1113 affects inclusion:
</p></div>
1114 <div class=
"dlist"><dl>
1115 <dt class=
"hdlist1">
1120 Commits that are walked are included if they are not TREESAME
1124 <dt class=
"hdlist1">
1129 All commits that are walked are included.
1131 <div class=
"paragraph"><p>Note that without
<em>--full-history
</em>, this still simplifies merges: if
1132 one of the parents is TREESAME, we follow only that one, so the other
1133 sides of the merge are never walked.
</p></div>
1135 <dt class=
"hdlist1">
1140 First, build a history graph in the same way that
1141 <em>--full-history
</em> with parent rewriting does (see above).
1143 <div class=
"paragraph"><p>Then simplify each commit
‘C` to its replacement
<tt>C
’</tt> in the final
1144 history according to the following rules:
</p></div>
1145 <div class=
"ulist"><ul>
1148 Set
‘C
’` to
<tt>C
</tt>.
1153 Replace each parent
‘P` of
<tt>C
’</tt> with its simplification
‘P
’`. In
1154 the process, drop parents that are ancestors of other parents, and
1160 If after this parent rewriting,
‘C
’` is a root or merge commit (has
1161 zero or
>1 parents), a boundary commit, or !TREESAME, it remains.
1162 Otherwise, it is replaced with its only parent.
1166 <div class=
"paragraph"><p>The effect of this is best shown by way of comparing to
1167 <em>--full-history
</em> with parent rewriting. The example turns into:
</p></div>
1168 <div class=
"listingblock">
1169 <div class=
"content">
1170 <pre><tt> .-A---M---N---O
1174 `---------'
</tt></pre>
1176 <div class=
"paragraph"><p>Note the major differences in
<tt>N
</tt> and
<tt>P
</tt> over
<em>--full-history
</em>:
</p></div>
1177 <div class=
"ulist"><ul>
1180 <tt>N
</tt>'s parent list had
<tt>I
</tt> removed, because it is an ancestor of the
1181 other parent
<tt>M
</tt>. Still,
<tt>N
</tt> remained because it is !TREESAME.
1186 <tt>P
</tt>'s parent list similarly had
<tt>I
</tt> removed.
<tt>P
</tt> was then
1187 removed completely, because it had one parent and is TREESAME.
1193 <div class=
"paragraph"><p>Finally, there is a fifth simplification mode available:
</p></div>
1194 <div class=
"dlist"><dl>
1195 <dt class=
"hdlist1">
1200 Limit the displayed commits to those directly on the ancestry
1201 chain between the
"from" and
"to" commits in the given commit
1202 range. I.e. only display commits that are ancestor of the
"to"
1203 commit, and descendants of the
"from" commit.
1205 <div class=
"paragraph"><p>As an example use case, consider the following commit history:
</p></div>
1206 <div class=
"listingblock">
1207 <div class=
"content">
1208 <pre><tt> D---E-------F
1210 B---C---G---H---I---J
1212 A-------K---------------L--M
</tt></pre>
1214 <div class=
"paragraph"><p>A regular
<em>D..M
</em> computes the set of commits that are ancestors of
<tt>M
</tt>,
1215 but excludes the ones that are ancestors of
<tt>D
</tt>. This is useful to see
1216 what happened to the history leading to
<tt>M
</tt> since
<tt>D
</tt>, in the sense
1217 that
"what does <tt>M</tt> have that did not exist in <tt>D</tt>". The result in this
1218 example would be all the commits, except
<tt>A
</tt> and
<tt>B
</tt> (and
<tt>D
</tt> itself,
1219 of course).
</p></div>
1220 <div class=
"paragraph"><p>When we want to find out what commits in
<tt>M
</tt> are contaminated with the
1221 bug introduced by
<tt>D
</tt> and need fixing, however, we might want to view
1222 only the subset of
<em>D..M
</em> that are actually descendants of
<tt>D
</tt>, i.e.
1223 excluding
<tt>C
</tt> and
<tt>K
</tt>. This is exactly what the
<em>--ancestry-path
</em>
1224 option does. Applied to the
<em>D..M
</em> range, it results in:
</p></div>
1225 <div class=
"listingblock">
1226 <div class=
"content">
1235 <div class=
"paragraph"><p>The
<em>--simplify-by-decoration
</em> option allows you to view only the
1236 big picture of the topology of the history, by omitting commits
1237 that are not referenced by tags. Commits are marked as !TREESAME
1238 (in other words, kept after history simplification rules described
1239 above) if (
1) they are referenced by tags, or (
2) they change the
1240 contents of the paths given on the command line. All other
1241 commits are marked as TREESAME (subject to be simplified away).
</p></div>
1242 <h3 id=
"_commit_ordering">Commit Ordering
</h3><div style=
"clear:left"></div>
1243 <div class=
"paragraph"><p>By default, the commits are shown in reverse chronological order.
</p></div>
1244 <div class=
"dlist"><dl>
1245 <dt class=
"hdlist1">
1250 This option makes them appear in topological order (i.e.
1251 descendant commits are shown before their parents).
1254 <dt class=
"hdlist1">
1259 This option is similar to
<em>--topo-order
</em> in the sense that no
1260 parent comes before all of its children, but otherwise things
1261 are still ordered in the commit timestamp order.
1264 <dt class=
"hdlist1">
1269 Output the commits in reverse order.
1270 Cannot be combined with
<em>--walk-reflogs
</em>.
1274 <h3 id=
"_object_traversal">Object Traversal
</h3><div style=
"clear:left"></div>
1275 <div class=
"paragraph"><p>These options are mostly targeted for packing of git repositories.
</p></div>
1276 <div class=
"dlist"><dl>
1277 <dt class=
"hdlist1">
1282 Print the object IDs of any object referenced by the listed
1283 commits.
<em>--objects foo ^bar
</em> thus means
"send me
1284 all object IDs which I need to download if I have the commit
1285 object <em>bar</em>, but not <em>foo</em>".
1288 <dt class=
"hdlist1">
1293 Similar to
<em>--objects
</em>, but also print the IDs of excluded
1294 commits prefixed with a
"-" character. This is used by
1295 <a href=
"git-pack-objects.html">git-pack-objects(
1)
</a> to build
"thin" pack, which records
1296 objects in deltified form based on objects contained in these
1297 excluded commits to reduce network traffic.
1300 <dt class=
"hdlist1">
1305 Only useful with
<em>--objects
</em>; print the object IDs that are not
1309 <dt class=
"hdlist1">
1314 Only show the given revs, but do not traverse their ancestors.
1317 <dt class=
"hdlist1">
1322 Overrides a previous --no-walk.
1326 <h3 id=
"_commit_formatting">Commit Formatting
</h3><div style=
"clear:left"></div>
1327 <div class=
"dlist"><dl>
1328 <dt class=
"hdlist1">
1329 --pretty[=
<format
>]
1331 <dt class=
"hdlist1">
1332 --format=
<format
>
1336 Pretty-print the contents of the commit logs in a given format,
1337 where
<em><format
></em> can be one of
<em>oneline
</em>,
<em>short
</em>,
<em>medium
</em>,
1338 <em>full
</em>,
<em>fuller
</em>,
<em>email
</em>,
<em>raw
</em> and
<em>format:
<string
></em>. See
1339 the
"PRETTY FORMATS" section for some additional details for each
1340 format. When omitted, the format defaults to
<em>medium
</em>.
1342 <div class=
"paragraph"><p>Note: you can specify the default pretty format in the repository
1343 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1345 <dt class=
"hdlist1">
1350 Instead of showing the full
40-byte hexadecimal commit object
1351 name, show only a partial prefix. Non default number of
1352 digits can be specified with
"--abbrev=<n>" (which also modifies
1353 diff output, if it is displayed).
1355 <div class=
"paragraph"><p>This should make
"--pretty=oneline" a whole lot more readable for
1356 people using
80-column terminals.
</p></div>
1358 <dt class=
"hdlist1">
1363 Show the full
40-byte hexadecimal commit object name. This negates
1364 <tt>--abbrev-commit
</tt> and those options which imply it such as
1365 "--oneline". It also overrides the
<em>log.abbrevCommit
</em> variable.
1368 <dt class=
"hdlist1">
1373 This is a shorthand for
"--pretty=oneline --abbrev-commit"
1377 <dt class=
"hdlist1">
1378 --encoding[=
<encoding
>]
1382 The commit objects record the encoding used for the log message
1383 in their encoding header; this option can be used to tell the
1384 command to re-code the commit log message in the encoding
1385 preferred by the user. For non plumbing commands this
1389 <dt class=
"hdlist1">
1390 --notes[=
<ref
>]
1394 Show the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) that annotate the
1395 commit, when showing the commit log message. This is the default
1396 for
<tt>git log
</tt>,
<tt>git show
</tt> and
<tt>git whatchanged
</tt> commands when
1397 there is no
<tt>--pretty
</tt>,
<tt>--format
</tt> nor
<tt>--oneline
</tt> option given
1398 on the command line.
1400 <div class=
"paragraph"><p>By default, the notes shown are from the notes refs listed in the
1401 <em>core.notesRef
</em> and
<em>notes.displayRef
</em> variables (or corresponding
1402 environment overrides). See
<a href=
"git-config.html">git-config(
1)
</a> for more details.
</p></div>
1403 <div class=
"paragraph"><p>With an optional
<em><ref
></em> argument, show this notes ref instead of the
1404 default notes ref(s). The ref is taken to be in
<tt>refs/notes/
</tt> if it
1405 is not qualified.
</p></div>
1406 <div class=
"paragraph"><p>Multiple --notes options can be combined to control which notes are
1407 being displayed. Examples:
"--notes=foo" will show only notes from
1408 "refs/notes/foo";
"--notes=foo --notes" will show both notes from
1409 "refs/notes/foo" and from the default notes ref(s).
</p></div>
1411 <dt class=
"hdlist1">
1416 Do not show notes. This negates the above
<tt>--notes
</tt> option, by
1417 resetting the list of notes refs from which notes are shown.
1418 Options are parsed in the order given on the command line, so e.g.
1419 "--notes --notes=foo --no-notes --notes=bar" will only show notes
1420 from
"refs/notes/bar".
1423 <dt class=
"hdlist1">
1424 --show-notes[=
<ref
>]
1426 <dt class=
"hdlist1">
1427 --[no-]standard-notes
1431 These options are deprecated. Use the above --notes/--no-notes
1435 <dt class=
"hdlist1">
1440 Synonym for
<tt>--date=relative
</tt>.
1443 <dt class=
"hdlist1">
1444 --date=(relative|local|default|iso|rfc|short|raw)
1448 Only takes effect for dates shown in human-readable format, such
1449 as when using
"--pretty".
<tt>log.date
</tt> config variable sets a default
1450 value for log command
’s --date option.
1452 <div class=
"paragraph"><p><tt>--date=relative
</tt> shows dates relative to the current time,
1453 e.g.
"2 hours ago".
</p></div>
1454 <div class=
"paragraph"><p><tt>--date=local
</tt> shows timestamps in user
’s local timezone.
</p></div>
1455 <div class=
"paragraph"><p><tt>--date=iso
</tt> (or
<tt>--date=iso8601
</tt>) shows timestamps in ISO
8601 format.
</p></div>
1456 <div class=
"paragraph"><p><tt>--date=rfc
</tt> (or
<tt>--date=rfc2822
</tt>) shows timestamps in RFC
2822
1457 format, often found in E-mail messages.
</p></div>
1458 <div class=
"paragraph"><p><tt>--date=short
</tt> shows only date but not time, in
<tt>YYYY-MM-DD
</tt> format.
</p></div>
1459 <div class=
"paragraph"><p><tt>--date=raw
</tt> shows the date in the internal raw git format
<tt>%s %z
</tt> format.
</p></div>
1460 <div class=
"paragraph"><p><tt>--date=default
</tt> shows timestamps in the original timezone
1461 (either committer
’s or author
’s).
</p></div>
1463 <dt class=
"hdlist1">
1468 Print also the parents of the commit (in the form
"commit parent…").
1469 Also enables parent rewriting, see
<em>History Simplification
</em> below.
1472 <dt class=
"hdlist1">
1477 Print also the children of the commit (in the form
"commit child…").
1478 Also enables parent rewriting, see
<em>History Simplification
</em> below.
1481 <dt class=
"hdlist1">
1486 Mark which side of a symmetric diff a commit is reachable from.
1487 Commits from the left side are prefixed with
<tt><</tt> and those from
1488 the right with
<tt>></tt>. If combined with
<tt>--boundary
</tt>, those
1489 commits are prefixed with
<tt>-
</tt>.
1491 <div class=
"paragraph"><p>For example, if you have this topology:
</p></div>
1492 <div class=
"listingblock">
1493 <div class=
"content">
1494 <pre><tt> y---b---b branch B
1498 o---x---a---a branch A
</tt></pre>
1500 <div class=
"paragraph"><p>you would get an output like this:
</p></div>
1501 <div class=
"listingblock">
1502 <div class=
"content">
1503 <pre><tt> $ git rev-list --left-right --boundary --pretty=oneline A...B
1505 >bbbbbbb...
3rd on b
1506 >bbbbbbb...
2nd on b
1507 <aaaaaaa...
3rd on a
1508 <aaaaaaa...
2nd on a
1509 -yyyyyyy...
1st on b
1510 -xxxxxxx...
1st on a
</tt></pre>
1513 <dt class=
"hdlist1">
1518 Draw a text-based graphical representation of the commit history
1519 on the left hand side of the output. This may cause extra lines
1520 to be printed in between commits, in order for the graph history
1521 to be drawn properly.
1523 <div class=
"paragraph"><p>This enables parent rewriting, see
<em>History Simplification
</em> below.
</p></div>
1524 <div class=
"paragraph"><p>This implies the
<em>--topo-order
</em> option by default, but the
1525 <em>--date-order
</em> option may also be specified.
</p></div>
1528 <h3 id=
"_diff_formatting">Diff Formatting
</h3><div style=
"clear:left"></div>
1529 <div class=
"paragraph"><p>Below are listed options that control the formatting of diff output.
1530 Some of them are specific to
<a href=
"git-rev-list.html">git-rev-list(
1)
</a>, however other diff
1531 options may be given. See
<a href=
"git-diff-files.html">git-diff-files(
1)
</a> for more options.
</p></div>
1532 <div class=
"dlist"><dl>
1533 <dt class=
"hdlist1">
1538 With this option, diff output for a merge commit
1539 shows the differences from each of the parents to the merge result
1540 simultaneously instead of showing pairwise diff between a parent
1541 and the result one at a time. Furthermore, it lists only files
1542 which were modified from all parents.
1545 <dt class=
"hdlist1">
1550 This flag implies the
<em>-c
</em> options and further compresses the
1551 patch output by omitting uninteresting hunks whose contents in
1552 the parents have only two variants and the merge result picks
1553 one of them without modification.
1556 <dt class=
"hdlist1">
1561 This flag makes the merge commits show the full diff like
1562 regular commits; for each merge parent, a separate log entry
1563 and diff is generated. An exception is that only diff against
1564 the first parent is shown when
<em>--first-parent
</em> option is given;
1565 in that case, the output represents the changes the merge
1566 brought
<em>into
</em> the then-current branch.
1569 <dt class=
"hdlist1">
1574 Show recursive diffs.
1577 <dt class=
"hdlist1">
1582 Show the tree objects in the diff output. This implies
<em>-r
</em>.
1585 <dt class=
"hdlist1">
1590 Suppress diff output.
1595 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
1596 <div class=
"sectionbody">
1597 <div class=
"paragraph"><p>If the commit is a merge, and if the pretty-format
1598 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
1599 inserted before the
<em>Author:
</em> line. This line begins with
1600 "Merge: " and the sha1s of ancestral commits are printed,
1601 separated by spaces. Note that the listed commits may not
1602 necessarily be the list of the
<strong>direct
</strong> parent commits if you
1603 have limited your view of history: for example, if you are
1604 only interested in changes related to a certain directory or
1606 <div class=
"paragraph"><p>There are several built-in formats, and you can define
1607 additional formats by setting a pretty.
<name
>
1608 config option to either another format name, or a
1609 <em>format:
</em> string, as described below (see
1610 <a href=
"git-config.html">git-config(
1)
</a>). Here are the details of the
1611 built-in formats:
</p></div>
1612 <div class=
"ulist"><ul>
1617 <div class=
"literalblock">
1618 <div class=
"content">
1619 <pre><tt><sha1
> <title line
></tt></pre>
1621 <div class=
"paragraph"><p>This is designed to be as compact as possible.
</p></div>
1627 <div class=
"literalblock">
1628 <div class=
"content">
1629 <pre><tt>commit
<sha1
>
1630 Author:
<author
></tt></pre>
1632 <div class=
"literalblock">
1633 <div class=
"content">
1634 <pre><tt><title line
></tt></pre>
1641 <div class=
"literalblock">
1642 <div class=
"content">
1643 <pre><tt>commit
<sha1
>
1644 Author:
<author
>
1645 Date:
<author date
></tt></pre>
1647 <div class=
"literalblock">
1648 <div class=
"content">
1649 <pre><tt><title line
></tt></pre>
1651 <div class=
"literalblock">
1652 <div class=
"content">
1653 <pre><tt><full commit message
></tt></pre>
1660 <div class=
"literalblock">
1661 <div class=
"content">
1662 <pre><tt>commit
<sha1
>
1663 Author:
<author
>
1664 Commit:
<committer
></tt></pre>
1666 <div class=
"literalblock">
1667 <div class=
"content">
1668 <pre><tt><title line
></tt></pre>
1670 <div class=
"literalblock">
1671 <div class=
"content">
1672 <pre><tt><full commit message
></tt></pre>
1679 <div class=
"literalblock">
1680 <div class=
"content">
1681 <pre><tt>commit
<sha1
>
1682 Author:
<author
>
1683 AuthorDate:
<author date
>
1684 Commit:
<committer
>
1685 CommitDate:
<committer date
></tt></pre>
1687 <div class=
"literalblock">
1688 <div class=
"content">
1689 <pre><tt><title line
></tt></pre>
1691 <div class=
"literalblock">
1692 <div class=
"content">
1693 <pre><tt><full commit message
></tt></pre>
1700 <div class=
"literalblock">
1701 <div class=
"content">
1702 <pre><tt>From
<sha1
> <date
>
1703 From:
<author
>
1704 Date:
<author date
>
1705 Subject: [PATCH]
<title line
></tt></pre>
1707 <div class=
"literalblock">
1708 <div class=
"content">
1709 <pre><tt><full commit message
></tt></pre>
1716 <div class=
"paragraph"><p>The
<em>raw
</em> format shows the entire commit exactly as
1717 stored in the commit object. Notably, the SHA1s are
1718 displayed in full, regardless of whether --abbrev or
1719 --no-abbrev are used, and
<em>parents
</em> information show the
1720 true parent commits, without taking grafts nor history
1721 simplification into account.
</p></div>
1725 <em>format:
<string
></em>
1727 <div class=
"paragraph"><p>The
<em>format:
<string
></em> format allows you to specify which information
1728 you want to show. It works a little bit like printf format,
1729 with the notable exception that you get a newline with
<em>%n
</em>
1730 instead of
<em>\n
</em>.
</p></div>
1731 <div class=
"paragraph"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
1732 would show something like this:
</p></div>
1733 <div class=
"listingblock">
1734 <div class=
"content">
1735 <pre><tt>The author of fe6e0ee was Junio C Hamano,
23 hours ago
1736 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<</tt></pre>
1738 <div class=
"paragraph"><p>The placeholders are:
</p></div>
1739 <div class=
"ulist"><ul>
1742 <em>%H
</em>: commit hash
1747 <em>%h
</em>: abbreviated commit hash
1752 <em>%T
</em>: tree hash
1757 <em>%t
</em>: abbreviated tree hash
1762 <em>%P
</em>: parent hashes
1767 <em>%p
</em>: abbreviated parent hashes
1772 <em>%an
</em>: author name
1777 <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>)
1782 <em>%ae
</em>: author email
1787 <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>)
1792 <em>%ad
</em>: author date (format respects --date= option)
1797 <em>%aD
</em>: author date, RFC2822 style
1802 <em>%ar
</em>: author date, relative
1807 <em>%at
</em>: author date, UNIX timestamp
1812 <em>%ai
</em>: author date, ISO
8601 format
1817 <em>%cn
</em>: committer name
1822 <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>)
1827 <em>%ce
</em>: committer email
1832 <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>)
1837 <em>%cd
</em>: committer date
1842 <em>%cD
</em>: committer date, RFC2822 style
1847 <em>%cr
</em>: committer date, relative
1852 <em>%ct
</em>: committer date, UNIX timestamp
1857 <em>%ci
</em>: committer date, ISO
8601 format
1862 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
1867 <em>%e
</em>: encoding
1872 <em>%s
</em>: subject
1877 <em>%f
</em>: sanitized subject line, suitable for a filename
1887 <em>%B
</em>: raw body (unwrapped subject and body)
1892 <em>%N
</em>: commit notes
1897 <em>%gD
</em>: reflog selector, e.g.,
<tt>refs/stash@{
1}
</tt>
1902 <em>%gd
</em>: shortened reflog selector, e.g.,
<tt>stash@{
1}
</tt>
1907 <em>%gs
</em>: reflog subject
1912 <em>%Cred
</em>: switch color to red
1917 <em>%Cgreen
</em>: switch color to green
1922 <em>%Cblue
</em>: switch color to blue
1927 <em>%Creset
</em>: reset color
1932 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
1937 <em>%m
</em>: left, right or boundary mark
1942 <em>%n
</em>: newline
1947 <em>%%
</em>: a raw
<em>%
</em>
1952 <em>%x00
</em>: print a byte from a hex code
1957 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>: switch line wrapping, like the -w option of
1958 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
1964 <div class=
"admonitionblock">
1967 <div class=
"title">Note
</div>
1969 <td class=
"content">Some placeholders may depend on other options given to the
1970 revision traversal engine. For example, the
<tt>%g*
</tt> reflog options will
1971 insert an empty string unless we are traversing reflog entries (e.g., by
1972 <tt>git log -g
</tt>). The
<tt>%d
</tt> placeholder will use the
"short" decoration
1973 format if
<tt>--decorate
</tt> was not already provided on the command line.
</td>
1976 <div class=
"paragraph"><p>If you add a
<tt>+</tt> (plus sign) after
<em>%
</em> of a placeholder, a line-feed
1977 is inserted immediately before the expansion if and only if the
1978 placeholder expands to a non-empty string.
</p></div>
1979 <div class=
"paragraph"><p>If you add a
<tt>-
</tt> (minus sign) after
<em>%
</em> of a placeholder, line-feeds that
1980 immediately precede the expansion are deleted if and only if the
1981 placeholder expands to an empty string.
</p></div>
1982 <div class=
"paragraph"><p>If you add a ` ` (space) after
<em>%
</em> of a placeholder, a space
1983 is inserted immediately before the expansion if and only if the
1984 placeholder expands to a non-empty string.
</p></div>
1985 <div class=
"ulist"><ul>
1990 <div class=
"paragraph"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
1991 provides
"terminator" semantics instead of
"separator" semantics. In
1992 other words, each commit has the message terminator character (usually a
1993 newline) appended, rather than a separator placed between entries.
1994 This means that the final entry of a single-line format will be properly
1995 terminated with a new line, just as the
"oneline" format does.
1996 For example:
</p></div>
1997 <div class=
"listingblock">
1998 <div class=
"content">
1999 <pre><tt>$ git log -
2 --pretty=format:%h
4da45bef \
2000 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
2002 7134973 -- NO NEWLINE
2004 $ git log -
2 --pretty=tformat:%h
4da45bef \
2005 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
2009 <div class=
"paragraph"><p>In addition, any unrecognized string that has a
<tt>%
</tt> in it is interpreted
2010 as if it has
<tt>tformat:
</tt> in front of it. For example, these two are
2011 equivalent:
</p></div>
2012 <div class=
"listingblock">
2013 <div class=
"content">
2014 <pre><tt>$ git log -
2 --pretty=tformat:%h
4da45bef
2015 $ git log -
2 --pretty=%h
4da45bef
</tt></pre>
2020 <h2 id=
"_common_diff_options">Common diff options
</h2>
2021 <div class=
"sectionbody">
2022 <div class=
"dlist"><dl>
2023 <dt class=
"hdlist1">
2026 <dt class=
"hdlist1">
2029 <dt class=
"hdlist1">
2034 Generate patch (see section on generating patches).
2038 <dt class=
"hdlist1">
2041 <dt class=
"hdlist1">
2046 Generate diffs with
<n
> lines of context instead of
2048 Implies
<tt>-p
</tt>.
2051 <dt class=
"hdlist1">
2056 Generate the raw format.
2060 <dt class=
"hdlist1">
2065 Synonym for
<tt>-p --raw
</tt>.
2068 <dt class=
"hdlist1">
2073 Generate a diff using the
"patience diff" algorithm.
2076 <dt class=
"hdlist1">
2077 --stat[=
<width
>[,
<name-width
>[,
<count
>]]]
2081 Generate a diffstat. You can override the default
2082 output width for
80-column terminal by
<tt>--stat=
<width
></tt>.
2083 The width of the filename part can be controlled by
2084 giving another width to it separated by a comma.
2085 By giving a third parameter
<tt><count
></tt>, you can limit the
2086 output to the first
<tt><count
></tt> lines, followed by
2087 <tt>…</tt> if there are more.
2089 <div class=
"paragraph"><p>These parameters can also be set individually with
<tt>--stat-width=
<width
></tt>,
2090 <tt>--stat-name-width=
<name-width
></tt> and
<tt>--stat-count=
<count
></tt>.
</p></div>
2092 <dt class=
"hdlist1">
2097 Similar to
<tt>--stat
</tt>, but shows number of added and
2098 deleted lines in decimal notation and pathname without
2099 abbreviation, to make it more machine friendly. For
2100 binary files, outputs two
<tt>-
</tt> instead of saying
2104 <dt class=
"hdlist1">
2109 Output only the last line of the
<tt>--stat
</tt> format containing total
2110 number of modified files, as well as number of added and deleted
2114 <dt class=
"hdlist1">
2115 --dirstat[=
<param1,param2,
…>]
2119 Output the distribution of relative amount of changes for each
2120 sub-directory. The behavior of
<tt>--dirstat
</tt> can be customized by
2121 passing it a comma separated list of parameters.
2122 The defaults are controlled by the
<tt>diff.dirstat
</tt> configuration
2123 variable (see
<a href=
"git-config.html">git-config(
1)
</a>).
2124 The following parameters are available:
2126 <div class=
"dlist"><dl>
2127 <dt class=
"hdlist1">
2132 Compute the dirstat numbers by counting the lines that have been
2133 removed from the source, or added to the destination. This ignores
2134 the amount of pure code movements within a file. In other words,
2135 rearranging lines in a file is not counted as much as other changes.
2136 This is the default behavior when no parameter is given.
2139 <dt class=
"hdlist1">
2144 Compute the dirstat numbers by doing the regular line-based diff
2145 analysis, and summing the removed/added line counts. (For binary
2146 files, count
64-byte chunks instead, since binary files have no
2147 natural concept of lines). This is a more expensive
<tt>--dirstat
</tt>
2148 behavior than the
<tt>changes
</tt> behavior, but it does count rearranged
2149 lines within a file as much as other changes. The resulting output
2150 is consistent with what you get from the other
<tt>--*stat
</tt> options.
2153 <dt class=
"hdlist1">
2158 Compute the dirstat numbers by counting the number of files changed.
2159 Each changed file counts equally in the dirstat analysis. This is
2160 the computationally cheapest
<tt>--dirstat
</tt> behavior, since it does
2161 not have to look at the file contents at all.
2164 <dt class=
"hdlist1">
2169 Count changes in a child directory for the parent directory as well.
2170 Note that when using
<tt>cumulative
</tt>, the sum of the percentages
2171 reported may exceed
100%. The default (non-cumulative) behavior can
2172 be specified with the
<tt>noncumulative
</tt> parameter.
2175 <dt class=
"hdlist1">
2180 An integer parameter specifies a cut-off percent (
3% by default).
2181 Directories contributing less than this percentage of the changes
2182 are not shown in the output.
2186 <div class=
"paragraph"><p>Example: The following will count changed files, while ignoring
2187 directories with less than
10% of the total amount of changed files,
2188 and accumulating child directory counts in the parent directories:
2189 <tt>--dirstat=files,
10,cumulative
</tt>.
</p></div>
2191 <dt class=
"hdlist1">
2196 Output a condensed summary of extended header information
2197 such as creations, renames and mode changes.
2200 <dt class=
"hdlist1">
2205 Synonym for
<tt>-p --stat
</tt>.
2208 <dt class=
"hdlist1">
2213 Separate the commits with NULs instead of with new newlines.
2215 <div class=
"paragraph"><p>Also, when
<tt>--raw
</tt> or
<tt>--numstat
</tt> has been given, do not munge
2216 pathnames and use NULs as output field terminators.
</p></div>
2217 <div class=
"paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
2218 and backslash characters replaced with
<tt>\t
</tt>,
<tt>\n
</tt>,
<tt>\
"</tt>, and <tt>\\</tt>,
2219 respectively, and the pathname will be enclosed in double quotes if
2220 any of those replacements occurred.</p></div>
2222 <dt class="hdlist1
">
2227 Show only names of changed files.
2230 <dt class="hdlist1
">
2235 Show only names and status of changed files. See the description
2236 of the <tt>--diff-filter</tt> option on what the status letters mean.
2239 <dt class="hdlist1
">
2240 --submodule[=<format>]
2244 Chose the output format for submodule differences. <format> can be one of
2245 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
2246 is used when this option is not given. <em>log</em> is the default value for this
2247 option and lists the commits in that commit range like the <em>summary</em>
2248 option of <a href="git-submodule.html
">git-submodule(1)</a> does.
2251 <dt class="hdlist1
">
2252 --color[=<when>]
2257 The value must be <tt>always</tt> (the default for <tt><when></tt>), <tt>never</tt>, or <tt>auto</tt>.
2258 The default value is <tt>never</tt>.
2261 <dt class="hdlist1
">
2266 Turn off colored diff.
2267 It is the same as <tt>--color=never</tt>.
2270 <dt class="hdlist1
">
2271 --word-diff[=<mode>]
2275 Show a word diff, using the <mode> to delimit changed words.
2276 By default, words are delimited by whitespace; see
2277 <tt>--word-diff-regex</tt> below. The <mode> defaults to <em>plain</em>, and
2280 <div class="dlist
"><dl>
2281 <dt class="hdlist1
">
2286 Highlight changed words using only colors. Implies <tt>--color</tt>.
2289 <dt class="hdlist1
">
2294 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
2295 attempts to escape the delimiters if they appear in the input,
2296 so the output may be ambiguous.
2299 <dt class="hdlist1
">
2304 Use a special line-based format intended for script
2305 consumption. Added/removed/unchanged runs are printed in the
2306 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
2307 character at the beginning of the line and extending to the
2308 end of the line. Newlines in the input are represented by a
2309 tilde <tt>~</tt> on a line of its own.
2312 <dt class="hdlist1
">
2317 Disable word diff again.
2321 <div class="paragraph
"><p>Note that despite the name of the first mode, color is used to
2322 highlight the changed parts in all modes if enabled.</p></div>
2324 <dt class="hdlist1
">
2325 --word-diff-regex=<regex>
2329 Use <regex> to decide what a word is, instead of considering
2330 runs of non-whitespace to be a word. Also implies
2331 <tt>--word-diff</tt> unless it was already enabled.
2333 <div class="paragraph
"><p>Every non-overlapping match of the
2334 <regex> is considered a word. Anything between these matches is
2335 considered whitespace and ignored(!) for the purposes of finding
2336 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
2337 expression to make sure that it matches all non-whitespace characters.
2338 A match that contains a newline is silently truncated(!) at the
2340 <div class="paragraph
"><p>The regex can also be set via a diff driver or configuration option, see
2341 <a href="gitattributes.html
">gitattributes(1)</a> or <a href="git-config.html
">git-config(1)</a>. Giving it explicitly
2342 overrides any diff driver or configuration setting. Diff drivers
2343 override configuration settings.</p></div>
2345 <dt class="hdlist1
">
2346 --color-words[=<regex>]
2350 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
2351 specified) <tt>--word-diff-regex=<regex></tt>.
2354 <dt class="hdlist1
">
2359 Turn off rename detection, even when the configuration
2360 file gives the default to do so.
2363 <dt class="hdlist1
">
2368 Warn if changes introduce whitespace errors. What are
2369 considered whitespace errors is controlled by <tt>core.whitespace</tt>
2370 configuration. By default, trailing whitespaces (including
2371 lines that solely consist of whitespaces) and a space character
2372 that is immediately followed by a tab character inside the
2373 initial indent of the line are considered whitespace errors.
2374 Exits with non-zero status if problems are found. Not compatible
2378 <dt class="hdlist1
">
2383 Instead of the first handful of characters, show the full
2384 pre- and post-image blob object names on the "index
"
2385 line when generating patch format output.
2388 <dt class="hdlist1
">
2393 In addition to <tt>--full-index</tt>, output a binary diff that
2394 can be applied with <tt>git-apply</tt>.
2397 <dt class="hdlist1
">
2398 --abbrev[=<n>]
2402 Instead of showing the full 40-byte hexadecimal object
2403 name in diff-raw format output and diff-tree header
2404 lines, show only a partial prefix. This is
2405 independent of the <tt>--full-index</tt> option above, which controls
2406 the diff-patch output format. Non default number of
2407 digits can be specified with <tt>--abbrev=<n></tt>.
2410 <dt class="hdlist1
">
2411 -B[<n>][/<m>]
2413 <dt class="hdlist1
">
2414 --break-rewrites[=[<n>][/<m>]]
2418 Break complete rewrite changes into pairs of delete and
2419 create. This serves two purposes:
2421 <div class="paragraph
"><p>It affects the way a change that amounts to a total rewrite of a file
2422 not as a series of deletion and insertion mixed together with a very
2423 few lines that happen to match textually as the context, but as a
2424 single deletion of everything old followed by a single insertion of
2425 everything new, and the number <tt>m</tt> controls this aspect of the -B
2426 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
2427 original should remain in the result for git to consider it a total
2428 rewrite (i.e. otherwise the resulting patch will be a series of
2429 deletion and insertion mixed together with context lines).</p></div>
2430 <div class="paragraph
"><p>When used with -M, a totally-rewritten file is also considered as the
2431 source of a rename (usually -M only considers a file that disappeared
2432 as the source of a rename), and the number <tt>n</tt> controls this aspect of
2433 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
2434 addition and deletion compared to 20% or more of the file’s size are
2435 eligible for being picked up as a possible source of a rename to
2436 another file.</p></div>
2438 <dt class="hdlist1
">
2441 <dt class="hdlist1
">
2442 --find-renames[=<n>]
2446 If generating diffs, detect and report renames for each commit.
2447 For following files across renames while traversing history, see
2449 If <tt>n</tt> is specified, it is a threshold on the similarity
2450 index (i.e. amount of addition/deletions compared to the
2451 file’s size). For example, <tt>-M90%</tt> means git should consider a
2452 delete/add pair to be a rename if more than 90% of the file
2453 hasn’t changed.
2456 <dt class="hdlist1
">
2459 <dt class="hdlist1
">
2460 --find-copies[=<n>]
2464 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
2465 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M<n></tt>.
2468 <dt class="hdlist1
">
2469 --find-copies-harder
2473 For performance reasons, by default, <tt>-C</tt> option finds copies only
2474 if the original file of the copy was modified in the same
2475 changeset. This flag makes the command
2476 inspect unmodified files as candidates for the source of
2477 copy. This is a very expensive operation for large
2478 projects, so use it with caution. Giving more than one
2479 <tt>-C</tt> option has the same effect.
2482 <dt class="hdlist1
">
2485 <dt class="hdlist1
">
2486 --irreversible-delete
2490 Omit the preimage for deletes, i.e. print only the header but not
2491 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
2492 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
2493 solely for people who want to just concentrate on reviewing the
2494 text after the change. In addition, the output obviously lack
2495 enough information to apply such a patch in reverse, even manually,
2496 hence the name of the option.
2498 <div class="paragraph
"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
2499 of a delete/create pair.</p></div>
2501 <dt class="hdlist1
">
2506 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
2507 is the number of potential rename/copy targets. This
2508 option prevents rename/copy detection from running if
2509 the number of rename/copy targets exceeds the specified
2513 <dt class="hdlist1
">
2514 --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]]
2518 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
2519 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
2520 type (i.e. regular file, symlink, submodule, …) changed (<tt>T</tt>),
2521 are Unmerged (<tt>U</tt>), are
2522 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
2523 Any combination of the filter characters (including none) can be used.
2524 When <tt>*</tt> (All-or-none) is added to the combination, all
2525 paths are selected if there is any file that matches
2526 other criteria in the comparison; if there is no file
2527 that matches other criteria, nothing is selected.
2530 <dt class="hdlist1
">
2535 Look for differences that introduce or remove an instance of
2536 <string>. Note that this is different than the string simply
2537 appearing in diff output; see the <em>pickaxe</em> entry in
2538 <a href="gitdiffcore.html
">gitdiffcore(7)</a> for more details.
2541 <dt class="hdlist1
">
2546 Look for differences whose added or removed line matches
2547 the given <regex>.
2550 <dt class="hdlist1
">
2555 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
2556 changeset, not just the files that contain the change
2560 <dt class="hdlist1
">
2565 Make the <string> not a plain string but an extended POSIX
2569 <dt class="hdlist1
">
2574 Output the patch in the order specified in the
2575 <orderfile>, which has one shell glob pattern per line.
2578 <dt class="hdlist1
">
2583 Swap two inputs; that is, show differences from index or
2584 on-disk file to tree contents.
2587 <dt class="hdlist1
">
2588 --relative[=<path>]
2592 When run from a subdirectory of the project, it can be
2593 told to exclude changes outside the directory and show
2594 pathnames relative to it with this option. When you are
2595 not in a subdirectory (e.g. in a bare repository), you
2596 can name which subdirectory to make the output relative
2597 to by giving a <path> as an argument.
2600 <dt class="hdlist1
">
2603 <dt class="hdlist1
">
2608 Treat all files as text.
2611 <dt class="hdlist1
">
2612 --ignore-space-at-eol
2616 Ignore changes in whitespace at EOL.
2619 <dt class="hdlist1
">
2622 <dt class="hdlist1
">
2623 --ignore-space-change
2627 Ignore changes in amount of whitespace. This ignores whitespace
2628 at line end, and considers all other sequences of one or
2629 more whitespace characters to be equivalent.
2632 <dt class="hdlist1
">
2635 <dt class="hdlist1
">
2640 Ignore whitespace when comparing lines. This ignores
2641 differences even if one line has whitespace where the other
2645 <dt class="hdlist1
">
2646 --inter-hunk-context=<lines>
2650 Show the context between diff hunks, up to the specified number
2651 of lines, thereby fusing hunks that are close to each other.
2654 <dt class="hdlist1
">
2659 Make the program exit with codes similar to diff(1).
2660 That is, it exits with 1 if there were differences and
2661 0 means no differences.
2664 <dt class="hdlist1
">
2669 Disable all output of the program. Implies <tt>--exit-code</tt>.
2672 <dt class="hdlist1
">
2677 Allow an external diff helper to be executed. If you set an
2678 external diff driver with <a href="gitattributes.html
">gitattributes(5)</a>, you need
2679 to use this option with <a href="git-log.html
">git-log(1)</a> and friends.
2682 <dt class="hdlist1
">
2687 Disallow external diff drivers.
2690 <dt class="hdlist1
">
2693 <dt class="hdlist1
">
2698 Allow (or disallow) external text conversion filters to be run
2699 when comparing binary files. See <a href="gitattributes.html
">gitattributes(5)</a> for
2700 details. Because textconv filters are typically a one-way
2701 conversion, the resulting diff is suitable for human
2702 consumption, but cannot be applied. For this reason, textconv
2703 filters are enabled by default only for <a href="git-diff.html
">git-diff(1)</a> and
2704 <a href="git-log.html
">git-log(1)</a>, but not for <a href="git-format-patch.html
">git-format-patch(1)</a> or
2705 diff plumbing commands.
2708 <dt class="hdlist1
">
2709 --ignore-submodules[=<when>]
2713 Ignore changes to submodules in the diff generation. <when> can be
2714 either "none
", "untracked
", "dirty
" or "all
", which is the default
2715 Using "none
" will consider the submodule modified when it either contains
2716 untracked or modified files or its HEAD differs from the commit recorded
2717 in the superproject and can be used to override any settings of the
2718 <em>ignore</em> option in <a href="git-config.html
">git-config(1)</a> or <a href="gitmodules.html
">gitmodules(5)</a>. When
2719 "untracked
" is used submodules are not considered dirty when they only
2720 contain untracked content (but they are still scanned for modified
2721 content). Using "dirty
" ignores all changes to the work tree of submodules,
2722 only changes to the commits stored in the superproject are shown (this was
2723 the behavior until 1.7.0). Using "all
" hides all changes to submodules.
2726 <dt class="hdlist1
">
2727 --src-prefix=<prefix>
2731 Show the given source prefix instead of "a/
".
2734 <dt class="hdlist1
">
2735 --dst-prefix=<prefix>
2739 Show the given destination prefix instead of "b/
".
2742 <dt class="hdlist1
">
2747 Do not show any source or destination prefix.
2751 <div class="paragraph
"><p>For more detailed explanation on these common options, see also
2752 <a href="gitdiffcore.html
">gitdiffcore(7)</a>.</p></div>
2754 <h2 id="_generating_patches_with_p
">Generating patches with -p</h2>
2755 <div class="sectionbody
">
2756 <div class="paragraph
"><p>When "git-diff-index
", "git-diff-tree
", or "git-diff-files
" are run
2757 with a <em>-p</em> option, "git diff
" without the <em>--raw</em> option, or
2758 "git log
" with the "-p
" option, they
2759 do not produce the output described above; instead they produce a
2760 patch file. You can customize the creation of such patches via the
2761 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2762 <div class="paragraph
"><p>What the -p option produces is slightly different from the traditional
2763 diff format:</p></div>
2764 <div class="olist arabic
"><ol class="arabic
">
2767 It is preceded with a "git diff
" header that looks like this:
2769 <div class="literalblock
">
2770 <div class="content
">
2771 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2773 <div class="paragraph
"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2774 involved. Especially, even for a creation or a deletion,
2775 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2776 <div class="paragraph
"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2777 name of the source file of the rename/copy and the name of
2778 the file that rename/copy produces, respectively.</p></div>
2782 It is followed by one or more extended header lines:
2784 <div class="literalblock
">
2785 <div class="content
">
2786 <pre><tt>old mode <mode>
2787 new mode <mode>
2788 deleted file mode <mode>
2789 new file mode <mode>
2790 copy from <path>
2791 copy to <path>
2792 rename from <path>
2793 rename to <path>
2794 similarity index <number>
2795 dissimilarity index <number>
2796 index <hash>..<hash> <mode></tt></pre>
2798 <div class="paragraph
"><p>File modes are printed as 6-digit octal numbers including the file type
2799 and file permission bits.</p></div>
2800 <div class="paragraph
"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2801 <div class="paragraph
"><p>The similarity index is the percentage of unchanged lines, and
2802 the dissimilarity index is the percentage of changed lines. It
2803 is a rounded down integer, followed by a percent sign. The
2804 similarity index value of 100% is thus reserved for two equal
2805 files, while 100% dissimilarity means that no line from the old
2806 file made it into the new one.</p></div>
2807 <div class="paragraph
"><p>The index line includes the SHA-1 checksum before and after the change.
2808 The <mode> is included if the file mode does not change; otherwise,
2809 separate lines indicate the old and the new mode.</p></div>
2813 TAB, LF, double quote and backslash characters in pathnames
2814 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and
<tt>\\
</tt>, respectively.
2815 If there is need for such substitution then the whole
2816 pathname is put in double quotes.
2821 All the
<tt>file1
</tt> files in the output refer to files before the
2822 commit, and all the
<tt>file2
</tt> files refer to files after the commit.
2823 It is incorrect to apply each change to each file sequentially. For
2824 example, this patch will swap a and b:
2826 <div class=
"literalblock">
2827 <div class=
"content">
2828 <pre><tt>diff --git a/a b/b
2833 rename to a
</tt></pre>
2838 <h2 id=
"_combined_diff_format">combined diff format
</h2>
2839 <div class=
"sectionbody">
2840 <div class=
"paragraph"><p>Any diff-generating command can take the
‘-c` or
<tt>--cc
</tt> option to
2841 produce a
<em>combined diff
</em> when showing a merge. This is the default
2842 format when showing merges with
<a href=
"git-diff.html">git-diff(
1)
</a> or
2843 <a href=
"git-show.html">git-show(
1)
</a>. Note also that you can give the `-m
’ option to any
2844 of these commands to force generation of diffs with individual parents
2845 of a merge.
</p></div>
2846 <div class=
"paragraph"><p>A
<em>combined diff
</em> format looks like this:
</p></div>
2847 <div class=
"listingblock">
2848 <div class=
"content">
2849 <pre><tt>diff --combined describe.c
2850 index fabadb8,cc95eb0.
.4866510
2853 @@@ -
98,
20 -
98,
12 +
98,
20 @@@
2854 return (a_date
> b_date) ? -
1 : (a_date == b_date) ?
0 :
1;
2857 - static void describe(char *arg)
2858 -static void describe(struct commit *cmit, int last_one)
2859 ++static void describe(char *arg, int last_one)
2861 + unsigned char sha1[
20];
2862 + struct commit *cmit;
2863 struct commit_list *list;
2864 static int initialized =
0;
2865 struct commit_name *n;
2867 + if (get_sha1(arg, sha1)
< 0)
2868 + usage(describe_usage);
2869 + cmit = lookup_commit_reference(sha1);
2871 + usage(describe_usage);
2875 for_each_ref(get_name);
</tt></pre>
2877 <div class=
"olist arabic"><ol class=
"arabic">
2880 It is preceded with a
"git diff" header, that looks like
2881 this (when
<em>-c
</em> option is used):
2883 <div class=
"literalblock">
2884 <div class=
"content">
2885 <pre><tt>diff --combined file
</tt></pre>
2887 <div class=
"paragraph"><p>or like this (when
<em>--cc
</em> option is used):
</p></div>
2888 <div class=
"literalblock">
2889 <div class=
"content">
2890 <pre><tt>diff --cc file
</tt></pre>
2895 It is followed by one or more extended header lines
2896 (this example shows a merge with two parents):
2898 <div class=
"literalblock">
2899 <div class=
"content">
2900 <pre><tt>index
<hash
>,
<hash
>..
<hash
>
2901 mode
<mode
>,
<mode
>..
<mode
>
2902 new file mode
<mode
>
2903 deleted file mode
<mode
>,
<mode
></tt></pre>
2905 <div class=
"paragraph"><p>The
<tt>mode
<mode
>,
<mode
>..
<mode
></tt> line appears only if at least one of
2906 the
<mode
> is different from the rest. Extended headers with
2907 information about detected contents movement (renames and
2908 copying detection) are designed to work with diff of two
2909 <tree-ish
> and are not used by combined diff format.
</p></div>
2913 It is followed by two-line from-file/to-file header
2915 <div class=
"literalblock">
2916 <div class=
"content">
2918 +++ b/file
</tt></pre>
2920 <div class=
"paragraph"><p>Similar to two-line header for traditional
<em>unified
</em> diff
2921 format,
<tt>/dev/null
</tt> is used to signal created or deleted
2926 Chunk header format is modified to prevent people from
2927 accidentally feeding it to
<tt>patch -p1
</tt>. Combined diff format
2928 was created for review of merge commit changes, and was not
2929 meant for apply. The change is similar to the change in the
2930 extended
<em>index
</em> header:
2932 <div class=
"literalblock">
2933 <div class=
"content">
2934 <pre><tt>@@@
<from-file-range
> <from-file-range
> <to-file-range
> @@@
</tt></pre>
2936 <div class=
"paragraph"><p>There are (number of parents +
1)
<tt>@
</tt> characters in the chunk
2937 header for combined diff format.
</p></div>
2940 <div class=
"paragraph"><p>Unlike the traditional
<em>unified
</em> diff format, which shows two
2941 files A and B with a single column that has
<tt>-
</tt> (minus
 — appears in A but removed in B),
<tt>+
</tt> (plus
 — missing in A but
2942 added to B), or
<tt>" "</tt> (space
 — unchanged) prefix, this format
2943 compares two or more files file1, file2,
… with one file X, and
2944 shows how X differs from each of fileN. One column for each of
2945 fileN is prepended to the output line to note how X
’s line is
2946 different from it.
</p></div>
2947 <div class=
"paragraph"><p>A
<tt>-
</tt> character in the column N means that the line appears in
2948 fileN but it does not appear in the result. A
<tt>+
</tt> character
2949 in the column N means that the line appears in the result,
2950 and fileN does not have that line (in other words, the line was
2951 added, from the point of view of that parent).
</p></div>
2952 <div class=
"paragraph"><p>In the above example output, the function signature was changed
2953 from both files (hence two
<tt>-
</tt> removals from both file1 and
2954 file2, plus
<tt>++
</tt> to mean one line that was added does not appear
2955 in either file1 nor file2). Also eight other lines are the same
2956 from file1 but do not appear in file2 (hence prefixed with
<tt>+</tt>).
</p></div>
2957 <div class=
"paragraph"><p>When shown by
<tt>git diff-tree -c
</tt>, it compares the parents of a
2958 merge commit with the merge result (i.e. file1..fileN are the
2959 parents). When shown by
<tt>git diff-files -c
</tt>, it compares the
2960 two unresolved merge parents with the working tree file
2961 (i.e. file1 is stage
2 aka
"our version", file2 is stage
3 aka
2962 "their version").
</p></div>
2964 <h2 id=
"_examples">Examples
</h2>
2965 <div class=
"sectionbody">
2966 <div class=
"dlist"><dl>
2967 <dt class=
"hdlist1">
2968 <tt>git log --no-merges
</tt>
2972 Show the whole commit history, but skip any merges
2975 <dt class=
"hdlist1">
2976 <tt>git log v2.6
.12.. include/scsi drivers/scsi
</tt>
2980 Show all commits since version
<em>v2.6
.12</em> that changed any file
2981 in the include/scsi or drivers/scsi subdirectories
2984 <dt class=
"hdlist1">
2985 <tt>git log
--since=
"2 weeks ago" -- gitk
</tt>
2989 Show the changes during the last two weeks to the file
<em>gitk
</em>.
2990 The
"--" is necessary to avoid confusion with the
<strong>branch
</strong> named
2994 <dt class=
"hdlist1">
2995 <tt>git log --name-status release..test
</tt>
2999 Show the commits that are in the
"test" branch but not yet
3000 in the
"release" branch, along with the list of paths
3001 each commit modifies.
3004 <dt class=
"hdlist1">
3005 <tt>git log --follow builtin-rev-list.c
</tt>
3009 Shows the commits that changed builtin-rev-list.c, including
3010 those commits that occurred before the file was given its
3014 <dt class=
"hdlist1">
3015 <tt>git log --branches --not --remotes=origin
</tt>
3019 Shows all commits that are in any of local branches but not in
3020 any of remote-tracking branches for
<em>origin
</em> (what you have that
3021 origin doesn
’t).
3024 <dt class=
"hdlist1">
3025 <tt>git log master --not --remotes=*/master
</tt>
3029 Shows all commits that are in local master but not in any remote
3030 repository master branches.
3033 <dt class=
"hdlist1">
3034 <tt>git log -p -m --first-parent
</tt>
3038 Shows the history including change diffs, but only from the
3039 "main branch" perspective, skipping commits that come from merged
3040 branches, and showing full diffs of changes introduced by the merges.
3041 This makes sense only when following a strict policy of merging all
3042 topic branches when staying on a single integration branch.
3047 <h2 id=
"_discussion">Discussion
</h2>
3048 <div class=
"sectionbody">
3049 <div class=
"paragraph"><p>At the core level, git is character encoding agnostic.
</p></div>
3050 <div class=
"ulist"><ul>
3053 The pathnames recorded in the index and in the tree objects
3054 are treated as uninterpreted sequences of non-NUL bytes.
3055 What readdir(
2) returns are what are recorded and compared
3056 with the data git keeps track of, which in turn are expected
3057 to be what lstat(
2) and creat(
2) accepts. There is no such
3058 thing as pathname encoding translation.
3063 The contents of the blob objects are uninterpreted sequences
3064 of bytes. There is no encoding translation at the core
3070 The commit log messages are uninterpreted sequences of non-NUL
3075 <div class=
"paragraph"><p>Although we encourage that the commit log messages are encoded
3076 in UTF-
8, both the core and git Porcelain are designed not to
3077 force UTF-
8 on projects. If all participants of a particular
3078 project find it more convenient to use legacy encodings, git
3079 does not forbid it. However, there are a few things to keep in
3081 <div class=
"olist arabic"><ol class=
"arabic">
3084 <em>git commit
</em> and
<em>git commit-tree
</em> issues
3085 a warning if the commit log message given to it does not look
3086 like a valid UTF-
8 string, unless you explicitly say your
3087 project uses a legacy encoding. The way to say this is to
3088 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
3090 <div class=
"listingblock">
3091 <div class=
"content">
3093 commitencoding = ISO-
8859-
1</tt></pre>
3095 <div class=
"paragraph"><p>Commit objects created with the above setting record the value
3096 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
3097 help other people who look at them later. Lack of this header
3098 implies that the commit log message is encoded in UTF-
8.
</p></div>
3102 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
3103 <tt>encoding
</tt> header of a commit object, and try to re-code the
3104 log message into UTF-
8 unless otherwise specified. You can
3105 specify the desired output encoding with
3106 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
3108 <div class=
"listingblock">
3109 <div class=
"content">
3111 logoutputencoding = ISO-
8859-
1</tt></pre>
3113 <div class=
"paragraph"><p>If you do not have this configuration variable, the value of
3114 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
3117 <div class=
"paragraph"><p>Note that we deliberately chose not to re-code the commit log
3118 message when a commit is made to force UTF-
8 at the commit
3119 object level, because re-coding to UTF-
8 is not necessarily a
3120 reversible operation.
</p></div>
3122 <h2 id=
"_configuration">Configuration
</h2>
3123 <div class=
"sectionbody">
3124 <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>
3125 for settings related to diff generation.
</p></div>
3126 <div class=
"dlist"><dl>
3127 <dt class=
"hdlist1">
3132 Default for the
<tt>--format
</tt> option. (See
"PRETTY FORMATS" above.)
3133 Defaults to
"medium".
3136 <dt class=
"hdlist1">
3137 i18n.logOutputEncoding
3141 Encoding to use when displaying logs. (See
"Discussion", above.)
3142 Defaults to the value of
<tt>i18n.commitEncoding
</tt> if set, UTF-
8
3146 <dt class=
"hdlist1">
3151 Default format for human-readable dates. (Compare the
3152 <tt>--date
</tt> option.) Defaults to
"default", which means to write
3153 dates like
<tt>Sat May
8 19:
35:
34 2010 -
0500</tt>.
3156 <dt class=
"hdlist1">
3161 If
<tt>false
</tt>,
<em>git log
</em> and related commands will not treat the
3162 initial commit as a big creation event. Any root commits in
3163 <tt>git log -p
</tt> output would be shown without a diff attached.
3164 The default is
<tt>true
</tt>.
3167 <dt class=
"hdlist1">
3172 See
<a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
3175 <dt class=
"hdlist1">
3180 Which refs, in addition to the default set by
<tt>core.notesRef
</tt>
3181 or
<em>GIT_NOTES_REF
</em>, to read notes from when showing commit
3182 messages with the
<em>log
</em> family of commands. See
3183 <a href=
"git-notes.html">git-notes(
1)
</a>.
3185 <div class=
"paragraph"><p>May be an unabbreviated ref name or a glob and may be specified
3186 multiple times. A warning will be issued for refs that do not exist,
3187 but a glob that does not match any refs is silently ignored.
</p></div>
3188 <div class=
"paragraph"><p>This setting can be disabled by the
<tt>--no-notes
</tt> option,
3189 overridden by the
<em>GIT_NOTES_DISPLAY_REF
</em> environment variable,
3190 and overridden by the
<tt>--notes=
<ref
></tt> option.
</p></div>
3194 <h2 id=
"_git">GIT
</h2>
3195 <div class=
"sectionbody">
3196 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
3199 <div id=
"footer-text">
3200 Last updated
2011-
08-
05 00:
04:
52 UTC