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=
"paragraph"><p><em>git log
</em> [
<options
>] [
<since
>..
<until
>] [[--]
<path
>…]
</p></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>
427 <h2 id=
"_options">OPTIONS
</h2>
428 <div class=
"sectionbody">
429 <div class=
"dlist"><dl>
435 Limits the number of commits to show.
436 Note that this is a commit limiting option, see below.
440 <since
>..
<until
>
444 Show only commits between the named two commits. When
445 either
<since
> or
<until
> 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
<since
>
448 and
<until
>, see
<a href=
"gitrevisions.html">gitrevisions(
7)
</a>.
456 Continue listing the history of a file beyond renames
457 (works only for a single file).
464 --decorate[=short|full|no]
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
480 Print out the ref name given on the command line by which each
489 Without this flag,
"git log -p <path>…" 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
"<path>…" limits only
493 commits, and doesn
’t limit diff for those commits.
495 <div class=
"paragraph"><p>Note that this affects all diff-based output types, e.g. those
496 produced by --stat etc.
</p></div>
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.
511 [--]
<path
>…
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
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>
532 --max-count=
<number
>
536 Limit the number of commits to output.
540 --skip=
<number
>
544 Skip
<em>number
</em> commits before starting to show the commit output.
555 Show commits more recent than a specific date.
562 --before=
<date
>
566 Show commits older than a specific date.
570 --author=
<pattern
>
573 --committer=
<pattern
>
577 Limit the commits output to ones with author/committer
578 header lines that match the specified pattern (regular expression).
582 --grep=
<pattern
>
586 Limit the commits output to ones with log message that
587 matches the specified pattern (regular expression).
595 Limit the commits output to ones that match all given --grep,
596 --author and --committer instead of ones that match at least one.
607 Match the regexp limiting patterns without regard to letters case.
618 Consider the limiting patterns to be extended regular expressions
619 instead of the default basic regular expressions.
630 Consider the limiting patterns to be fixed strings (don
’t interpret
631 pattern as a regular expression).
639 Stop when a given path disappears from the tree.
647 Print only merge commits. This is exactly the same as
<tt>--min-parents=
2</tt>.
655 Do not print commits with more than one parent. This is
656 exactly the same as
<tt>--max-parents=
1</tt>.
660 --min-parents=
<number
>
663 --max-parents=
<number
>
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.
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>
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.
701 Reverses the meaning of the
<em>^</em> prefix (or lack thereof)
702 for all following revision specifiers, up to the next
<em>--not
</em>.
710 Pretend as if all the refs in
<tt>refs/
</tt> are listed on the
711 command line as
<em><commit
></em>.
715 --branches[=
<pattern
>]
719 Pretend as if all the refs in
<tt>refs/heads
</tt> are listed
720 on the command line as
<em><commit
></em>. If
<em><pattern
></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.
726 --tags[=
<pattern
>]
730 Pretend as if all the refs in
<tt>refs/tags
</tt> are listed
731 on the command line as
<em><commit
></em>. If
<em><pattern
></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.
737 --remotes[=
<pattern
>]
741 Pretend as if all the refs in
<tt>refs/remotes
</tt> are listed
742 on the command line as
<em><commit
></em>. If
<em><pattern
></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.
748 --glob=
<glob-pattern
>
752 Pretend as if all the refs matching shell glob
<em><glob-pattern
></em>
753 are listed on the command line as
<em><commit
></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.
763 Upon seeing an invalid object name in the input, pretend as if
764 the bad input was not given.
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
783 In addition to the
<em><commit
></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
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>.
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.
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>
823 List only commits on the respective side of a symmetric range,
824 i.e. only those which would be marked
<tt><</tt> resp.
<tt>></tt> by
825 <tt>--left-right
</tt>.
827 <div class=
"paragraph"><p>For example,
<tt>--cherry-pick --right-only A
…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>+</tt> commits from
<tt>git cherry A B
</tt>.
830 More precisely,
<tt>--cherry-pick --right-only --no-merges
</tt> gives the exact
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
…mybranch
</tt>, similar to
842 <tt>git cherry upstream mybranch
</tt>.
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>^commit
</em>,
<em>commit1..commit2
</em>,
857 nor
<em>commit1...commit2
</em> notations cannot be used).
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>
874 After a failed merge, show refs that touch files having a
875 conflict and don
’t exist on all heads to merge.
883 Output uninteresting commits at the boundary, which are usually
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
<path
>. 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>
900 Commits modifying the given
<paths
> are selected.
904 --simplify-by-decoration
908 Commits that are referred by some branch or tag are selected.
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>
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)
931 As the default mode but does not prune some history.
939 Only the selected commits are shown, plus some to have a
948 All commits in the simplified history are shown.
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.
966 When given a range of commits to display (e.g.
<em>commit1..commit2
</em>
967 or
<em>commit2
^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>.
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
<paths
>. 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
987 `-------------'
</tt></pre>
989 <div class=
"paragraph"><p>The horizontal line of history A
—P is taken to be the first parent of
990 each merge. The commits are:
</p></div>
991 <div class=
"ulist"><ul>
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.
1001 In
<tt>A
</tt>,
<tt>foo
</tt> contains just
"foo".
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.
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.
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.
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.
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">
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
1047 <div class=
"paragraph"><p>This results in:
</p></div>
1048 <div class=
"listingblock">
1049 <div class=
"content">
1050 <pre><tt> .-A---N---O
1052 I---------D
</tt></pre>
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>
1062 <dt class=
"hdlist1">
1063 --full-history without parent rewriting
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
1073 <div class=
"listingblock">
1074 <div class=
"content">
1075 <pre><tt> I A B N D O
</tt></pre>
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>
1084 <dt class=
"hdlist1">
1085 --full-history with parent rewriting
1089 Ordinary commits are only included if they are !TREESAME
1090 (though this can be changed, see
<em>--sparse
</em> below).
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
1101 `-------------'
</tt></pre>
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>
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">
1117 Commits that are walked are included if they are not TREESAME
1121 <dt class=
"hdlist1">
1126 All commits that are walked are included.
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>
1132 <dt class=
"hdlist1">
1137 First, build a history graph in the same way that
1138 <em>--full-history
</em> with parent rewriting does (see above).
1140 <div class=
"paragraph"><p>Then simplify each commit
‘C` to its replacement
<tt>C
’</tt> in the final
1141 history according to the following rules:
</p></div>
1142 <div class=
"ulist"><ul>
1145 Set
‘C
’` to
<tt>C
</tt>.
1150 Replace each parent
‘P` of
<tt>C
’</tt> with its simplification
‘P
’`. In
1151 the process, drop parents that are ancestors of other parents, and
1157 If after this parent rewriting,
‘C
’` is a root or merge commit (has
1158 zero or
>1 parents), a boundary commit, or !TREESAME, it remains.
1159 Otherwise, it is replaced with its only parent.
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
1171 `---------'
</tt></pre>
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>
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.
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.
1190 <div class=
"paragraph"><p>Finally, there is a fifth simplification mode available:
</p></div>
1191 <div class=
"dlist"><dl>
1192 <dt class=
"hdlist1">
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.
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
1207 B---C---G---H---I---J
1209 A-------K---------------L--M
</tt></pre>
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">
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">
1247 This option makes them appear in topological order (i.e.
1248 descendant commits are shown before their parents).
1251 <dt class=
"hdlist1">
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.
1261 <dt class=
"hdlist1">
1266 Output the commits in reverse order.
1267 Cannot be combined with
<em>--walk-reflogs
</em>.
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">
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>".
1285 <dt class=
"hdlist1">
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.
1297 <dt class=
"hdlist1">
1302 Only useful with
<em>--objects
</em>; print the object IDs that are not
1306 <dt class=
"hdlist1">
1311 Only show the given revs, but do not traverse their ancestors.
1314 <dt class=
"hdlist1">
1319 Overrides a previous --no-walk.
1323 <h3 id=
"_commit_formatting">Commit Formatting
</h3><div style=
"clear:left"></div>
1324 <div class=
"dlist"><dl>
1325 <dt class=
"hdlist1">
1326 --pretty[=
<format
>]
1328 <dt class=
"hdlist1">
1329 --format=
<format
>
1333 Pretty-print the contents of the commit logs in a given format,
1334 where
<em><format
></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:
<string
></em>. See
1336 the
"PRETTY FORMATS" section for some additional details for each
1337 format. When omitted, the format defaults to
<em>medium
</em>.
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>
1342 <dt class=
"hdlist1">
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=<n>" (which also modifies
1350 diff output, if it is displayed).
1352 <div class=
"paragraph"><p>This should make
"--pretty=oneline" a whole lot more readable for
1353 people using
80-column terminals.
</p></div>
1355 <dt class=
"hdlist1">
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.
1365 <dt class=
"hdlist1">
1370 This is a shorthand for
"--pretty=oneline --abbrev-commit"
1374 <dt class=
"hdlist1">
1375 --encoding[=
<encoding
>]
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
1386 <dt class=
"hdlist1">
1387 --notes[=
<ref
>]
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.
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><ref
></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>
1408 <dt class=
"hdlist1">
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".
1420 <dt class=
"hdlist1">
1421 --show-notes[=
<ref
>]
1423 <dt class=
"hdlist1">
1424 --[no-]standard-notes
1428 These options are deprecated. Use the above --notes/--no-notes
1432 <dt class=
"hdlist1">
1437 Synonym for
<tt>--date=relative
</tt>.
1440 <dt class=
"hdlist1">
1441 --date=(relative|local|default|iso|rfc|short|raw)
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
’s --date option.
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
’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
’s or author
’s).
</p></div>
1460 <dt class=
"hdlist1">
1465 Print also the parents of the commit (in the form
"commit parent…").
1466 Also enables parent rewriting, see
<em>History Simplification
</em> below.
1469 <dt class=
"hdlist1">
1474 Print also the children of the commit (in the form
"commit child…").
1475 Also enables parent rewriting, see
<em>History Simplification
</em> below.
1478 <dt class=
"hdlist1">
1483 Mark which side of a symmetric diff a commit is reachable from.
1484 Commits from the left side are prefixed with
<tt><</tt> and those from
1485 the right with
<tt>></tt>. If combined with
<tt>--boundary
</tt>, those
1486 commits are prefixed with
<tt>-
</tt>.
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
1495 o---x---a---a branch A
</tt></pre>
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 >bbbbbbb...
3rd on b
1503 >bbbbbbb...
2nd on b
1504 <aaaaaaa...
3rd on a
1505 <aaaaaaa...
2nd on a
1506 -yyyyyyy...
1st on b
1507 -xxxxxxx...
1st on a
</tt></pre>
1510 <dt class=
"hdlist1">
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.
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>
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">
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.
1542 <dt class=
"hdlist1">
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.
1553 <dt class=
"hdlist1">
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.
1566 <dt class=
"hdlist1">
1571 Show recursive diffs.
1574 <dt class=
"hdlist1">
1579 Show the tree objects in the diff output. This implies
<em>-r
</em>.
1582 <dt class=
"hdlist1">
1587 Suppress diff output.
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
1603 <div class=
"paragraph"><p>There are several built-in formats, and you can define
1604 additional formats by setting a pretty.
<name
>
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>
1614 <div class=
"literalblock">
1615 <div class=
"content">
1616 <pre><tt><sha1
> <title line
></tt></pre>
1618 <div class=
"paragraph"><p>This is designed to be as compact as possible.
</p></div>
1624 <div class=
"literalblock">
1625 <div class=
"content">
1626 <pre><tt>commit
<sha1
>
1627 Author:
<author
></tt></pre>
1629 <div class=
"literalblock">
1630 <div class=
"content">
1631 <pre><tt><title line
></tt></pre>
1638 <div class=
"literalblock">
1639 <div class=
"content">
1640 <pre><tt>commit
<sha1
>
1641 Author:
<author
>
1642 Date:
<author date
></tt></pre>
1644 <div class=
"literalblock">
1645 <div class=
"content">
1646 <pre><tt><title line
></tt></pre>
1648 <div class=
"literalblock">
1649 <div class=
"content">
1650 <pre><tt><full commit message
></tt></pre>
1657 <div class=
"literalblock">
1658 <div class=
"content">
1659 <pre><tt>commit
<sha1
>
1660 Author:
<author
>
1661 Commit:
<committer
></tt></pre>
1663 <div class=
"literalblock">
1664 <div class=
"content">
1665 <pre><tt><title line
></tt></pre>
1667 <div class=
"literalblock">
1668 <div class=
"content">
1669 <pre><tt><full commit message
></tt></pre>
1676 <div class=
"literalblock">
1677 <div class=
"content">
1678 <pre><tt>commit
<sha1
>
1679 Author:
<author
>
1680 AuthorDate:
<author date
>
1681 Commit:
<committer
>
1682 CommitDate:
<committer date
></tt></pre>
1684 <div class=
"literalblock">
1685 <div class=
"content">
1686 <pre><tt><title line
></tt></pre>
1688 <div class=
"literalblock">
1689 <div class=
"content">
1690 <pre><tt><full commit message
></tt></pre>
1697 <div class=
"literalblock">
1698 <div class=
"content">
1699 <pre><tt>From
<sha1
> <date
>
1700 From:
<author
>
1701 Date:
<author date
>
1702 Subject: [PATCH]
<title line
></tt></pre>
1704 <div class=
"literalblock">
1705 <div class=
"content">
1706 <pre><tt><full commit message
></tt></pre>
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>
1722 <em>format:
<string
></em>
1724 <div class=
"paragraph"><p>The
<em>format:
<string
></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 >>%s<<%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
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<</tt></pre>
1735 <div class=
"paragraph"><p>The placeholders are:
</p></div>
1736 <div class=
"ulist"><ul>
1739 <em>%H
</em>: commit hash
1744 <em>%h
</em>: abbreviated commit hash
1749 <em>%T
</em>: tree hash
1754 <em>%t
</em>: abbreviated tree hash
1759 <em>%P
</em>: parent hashes
1764 <em>%p
</em>: abbreviated parent hashes
1769 <em>%an
</em>: author name
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>)
1779 <em>%ae
</em>: author email
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>)
1789 <em>%ad
</em>: author date (format respects --date= option)
1794 <em>%aD
</em>: author date, RFC2822 style
1799 <em>%ar
</em>: author date, relative
1804 <em>%at
</em>: author date, UNIX timestamp
1809 <em>%ai
</em>: author date, ISO
8601 format
1814 <em>%cn
</em>: committer name
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>)
1824 <em>%ce
</em>: committer email
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>)
1834 <em>%cd
</em>: committer date
1839 <em>%cD
</em>: committer date, RFC2822 style
1844 <em>%cr
</em>: committer date, relative
1849 <em>%ct
</em>: committer date, UNIX timestamp
1854 <em>%ci
</em>: committer date, ISO
8601 format
1859 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
1864 <em>%e
</em>: encoding
1869 <em>%s
</em>: subject
1874 <em>%f
</em>: sanitized subject line, suitable for a filename
1884 <em>%B
</em>: raw body (unwrapped subject and body)
1889 <em>%N
</em>: commit notes
1894 <em>%gD
</em>: reflog selector, e.g.,
<tt>refs/stash@{
1}
</tt>
1899 <em>%gd
</em>: shortened reflog selector, e.g.,
<tt>stash@{
1}
</tt>
1904 <em>%gs
</em>: reflog subject
1909 <em>%Cred
</em>: switch color to red
1914 <em>%Cgreen
</em>: switch color to green
1919 <em>%Cblue
</em>: switch color to blue
1924 <em>%Creset
</em>: reset color
1929 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
1934 <em>%m
</em>: left, right or boundary mark
1939 <em>%n
</em>: newline
1944 <em>%%
</em>: a raw
<em>%
</em>
1949 <em>%x00
</em>: print a byte from a hex code
1954 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>: switch line wrapping, like the -w option of
1955 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
1961 <div class=
"admonitionblock">
1964 <div class=
"title">Note
</div>
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>
1973 <div class=
"paragraph"><p>If you add a
<tt>+</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>
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/'
1999 7134973 -- NO NEWLINE
2001 $ git log -
2 --pretty=tformat:%h
4da45bef \
2002 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
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>
2017 <h2 id=
"_common_diff_options">Common diff options
</h2>
2018 <div class=
"sectionbody">
2019 <div class=
"dlist"><dl>
2020 <dt class=
"hdlist1">
2023 <dt class=
"hdlist1">
2026 <dt class=
"hdlist1">
2031 Generate patch (see section on generating patches).
2035 <dt class=
"hdlist1">
2038 <dt class=
"hdlist1">
2043 Generate diffs with
<n
> lines of context instead of
2045 Implies
<tt>-p
</tt>.
2048 <dt class=
"hdlist1">
2053 Generate the raw format.
2057 <dt class=
"hdlist1">
2062 Synonym for
<tt>-p --raw
</tt>.
2065 <dt class=
"hdlist1">
2070 Generate a diff using the
"patience diff" algorithm.
2073 <dt class=
"hdlist1">
2074 --stat[=
<width
>[,
<name-width
>]]
2078 Generate a diffstat. You can override the default
2079 output width for
80-column terminal by
<tt>--stat=
<width
></tt>.
2080 The width of the filename part can be controlled by
2081 giving another width to it separated by a comma.
2084 <dt class=
"hdlist1">
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
2096 <dt class=
"hdlist1">
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
2106 <dt class=
"hdlist1">
2107 --dirstat[=
<param1,param2,
…>]
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:
2118 <div class=
"dlist"><dl>
2119 <dt class=
"hdlist1">
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.
2131 <dt class=
"hdlist1">
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.
2145 <dt class=
"hdlist1">
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.
2156 <dt class=
"hdlist1">
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.
2167 <dt class=
"hdlist1">
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.
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>
2183 <dt class=
"hdlist1">
2188 Output a condensed summary of extended header information
2189 such as creations, renames and mode changes.
2192 <dt class=
"hdlist1">
2197 Synonym for
<tt>-p --stat
</tt>.
2200 <dt class=
"hdlist1">
2205 Separate the commits with NULs instead of with new newlines.
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>
2214 <dt class="hdlist1
">
2219 Show only names of changed files.
2222 <dt class="hdlist1
">
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.
2231 <dt class="hdlist1
">
2232 --submodule[=<format>]
2236 Chose the output format for submodule differences. <format> 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.
2243 <dt class="hdlist1
">
2244 --color[=<when>]
2249 The value must be <tt>always</tt> (the default for <tt><when></tt>), <tt>never</tt>, or <tt>auto</tt>.
2250 The default value is <tt>never</tt>.
2253 <dt class="hdlist1
">
2258 Turn off colored diff.
2259 It is the same as <tt>--color=never</tt>.
2262 <dt class="hdlist1
">
2263 --word-diff[=<mode>]
2267 Show a word diff, using the <mode> to delimit changed words.
2268 By default, words are delimited by whitespace; see
2269 <tt>--word-diff-regex</tt> below. The <mode> defaults to <em>plain</em>, and
2272 <div class="dlist
"><dl>
2273 <dt class="hdlist1
">
2278 Highlight changed words using only colors. Implies <tt>--color</tt>.
2281 <dt class="hdlist1
">
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.
2291 <dt class="hdlist1
">
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.
2304 <dt class="hdlist1
">
2309 Disable word diff again.
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>
2316 <dt class="hdlist1
">
2317 --word-diff-regex=<regex>
2321 Use <regex> 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.
2325 <div class="paragraph
"><p>Every non-overlapping match of the
2326 <regex> 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
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>
2337 <dt class="hdlist1
">
2338 --color-words[=<regex>]
2342 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
2343 specified) <tt>--word-diff-regex=<regex></tt>.
2346 <dt class="hdlist1
">
2351 Turn off rename detection, even when the configuration
2352 file gives the default to do so.
2355 <dt class="hdlist1
">
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
2366 <dt class="hdlist1
">
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.
2376 <dt class="hdlist1
">
2381 In addition to <tt>--full-index</tt>, output a binary diff that
2382 can be applied with <tt>git-apply</tt>.
2385 <dt class="hdlist1
">
2386 --abbrev[=<n>]
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=<n></tt>.
2398 <dt class="hdlist1
">
2399 -B[<n>][/<m>]
2401 <dt class="hdlist1
">
2402 --break-rewrites[=[<n>][/<m>]]
2406 Break complete rewrite changes into pairs of delete and
2407 create. This serves two purposes:
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’s size are
2423 eligible for being picked up as a possible source of a rename to
2424 another file.</p></div>
2426 <dt class="hdlist1
">
2429 <dt class="hdlist1
">
2430 --find-renames[=<n>]
2434 If generating diffs, detect and report renames for each commit.
2435 For following files across renames while traversing history, see
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’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’t changed.
2444 <dt class="hdlist1
">
2447 <dt class="hdlist1
">
2448 --find-copies[=<n>]
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<n></tt>.
2456 <dt class="hdlist1
">
2457 --find-copies-harder
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.
2470 <dt class="hdlist1
">
2473 <dt class="hdlist1
">
2474 --irreversible-delete
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.
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>
2489 <dt class="hdlist1
">
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
2501 <dt class="hdlist1
">
2502 --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]]
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, …) 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.
2518 <dt class="hdlist1
">
2523 Look for differences that introduce or remove an instance of
2524 <string>. 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.
2529 <dt class="hdlist1
">
2534 Look for differences whose added or removed line matches
2535 the given <regex>.
2538 <dt class="hdlist1
">
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
2548 <dt class="hdlist1
">
2553 Make the <string> not a plain string but an extended POSIX
2557 <dt class="hdlist1
">
2562 Output the patch in the order specified in the
2563 <orderfile>, which has one shell glob pattern per line.
2566 <dt class="hdlist1
">
2571 Swap two inputs; that is, show differences from index or
2572 on-disk file to tree contents.
2575 <dt class="hdlist1
">
2576 --relative[=<path>]
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 <path> as an argument.
2588 <dt class="hdlist1
">
2591 <dt class="hdlist1
">
2596 Treat all files as text.
2599 <dt class="hdlist1
">
2600 --ignore-space-at-eol
2604 Ignore changes in whitespace at EOL.
2607 <dt class="hdlist1
">
2610 <dt class="hdlist1
">
2611 --ignore-space-change
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.
2620 <dt class="hdlist1
">
2623 <dt class="hdlist1
">
2628 Ignore whitespace when comparing lines. This ignores
2629 differences even if one line has whitespace where the other
2633 <dt class="hdlist1
">
2634 --inter-hunk-context=<lines>
2638 Show the context between diff hunks, up to the specified number
2639 of lines, thereby fusing hunks that are close to each other.
2642 <dt class="hdlist1
">
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.
2652 <dt class="hdlist1
">
2657 Disable all output of the program. Implies <tt>--exit-code</tt>.
2660 <dt class="hdlist1
">
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.
2670 <dt class="hdlist1
">
2675 Disallow external diff drivers.
2678 <dt class="hdlist1
">
2679 --ignore-submodules[=<when>]
2683 Ignore changes to submodules in the diff generation. <when> 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.
2696 <dt class="hdlist1
">
2697 --src-prefix=<prefix>
2701 Show the given source prefix instead of "a/
".
2704 <dt class="hdlist1
">
2705 --dst-prefix=<prefix>
2709 Show the given destination prefix instead of "b/
".
2712 <dt class="hdlist1
">
2717 Do not show any source or destination prefix.
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>
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
">
2737 It is preceded with a "git diff
" header that looks like this:
2739 <div class="literalblock
">
2740 <div class="content
">
2741 <pre><tt>diff --git a/file1 b/file2</tt></pre>
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>
2752 It is followed by one or more extended header lines:
2754 <div class="literalblock
">
2755 <div class="content
">
2756 <pre><tt>old mode <mode>
2757 new mode <mode>
2758 deleted file mode <mode>
2759 new file mode <mode>
2760 copy from <path>
2761 copy to <path>
2762 rename from <path>
2763 rename to <path>
2764 similarity index <number>
2765 dissimilarity index <number>
2766 index <hash>..<hash> <mode></tt></pre>
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 <mode> is included if the file mode does not change; otherwise,
2779 separate lines indicate the old and the new mode.</p></div>
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.
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:
2796 <div class=
"literalblock">
2797 <div class=
"content">
2798 <pre><tt>diff --git a/a b/b
2803 rename to a
</tt></pre>
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
‘-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
’ 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
2823 @@@ -
98,
20 -
98,
12 +
98,
20 @@@
2824 return (a_date
> 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)
< 0)
2838 + usage(describe_usage);
2839 + cmit = lookup_commit_reference(sha1);
2841 + usage(describe_usage);
2845 for_each_ref(get_name);
</tt></pre>
2847 <div class=
"olist arabic"><ol class=
"arabic">
2850 It is preceded with a
"git diff" header, that looks like
2851 this (when
<em>-c
</em> option is used):
2853 <div class=
"literalblock">
2854 <div class=
"content">
2855 <pre><tt>diff --combined file
</tt></pre>
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>
2865 It is followed by one or more extended header lines
2866 (this example shows a merge with two parents):
2868 <div class=
"literalblock">
2869 <div class=
"content">
2870 <pre><tt>index
<hash
>,
<hash
>..
<hash
>
2871 mode
<mode
>,
<mode
>..
<mode
>
2872 new file mode
<mode
>
2873 deleted file mode
<mode
>,
<mode
></tt></pre>
2875 <div class=
"paragraph"><p>The
<tt>mode
<mode
>,
<mode
>..
<mode
></tt> line appears only if at least one of
2876 the
<mode
> 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 <tree-ish
> and are not used by combined diff format.
</p></div>
2883 It is followed by two-line from-file/to-file header
2885 <div class=
"literalblock">
2886 <div class=
"content">
2888 +++ b/file
</tt></pre>
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
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:
2902 <div class=
"literalblock">
2903 <div class=
"content">
2904 <pre><tt>@@@
<from-file-range
> <from-file-range
> <to-file-range
> @@@
</tt></pre>
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>
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
 — appears in A but removed in B),
<tt>+
</tt> (plus
 — missing in A but
2912 added to B), or
<tt>" "</tt> (space
 — unchanged) prefix, this format
2913 compares two or more files file1, file2,
… 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
’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>+</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>
2934 <h2 id=
"_examples">Examples
</h2>
2935 <div class=
"sectionbody">
2936 <div class=
"dlist"><dl>
2937 <dt class=
"hdlist1">
2942 Show the whole commit history, but skip any merges
2945 <dt class=
"hdlist1">
2946 git log v2.6
.12.. include/scsi drivers/scsi
2950 Show all commits since version
<em>v2.6
.12</em> that changed any file
2951 in the include/scsi or drivers/scsi subdirectories
2954 <dt class=
"hdlist1">
2955 git log
--since=
"2 weeks ago" -- gitk
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
2964 <dt class=
"hdlist1">
2965 git log --name-status release..test
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.
2974 <dt class=
"hdlist1">
2975 git log --follow builtin-rev-list.c
2979 Shows the commits that changed builtin-rev-list.c, including
2980 those commits that occurred before the file was given its
2984 <dt class=
"hdlist1">
2985 git log --branches --not --remotes=origin
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
’t).
2994 <dt class=
"hdlist1">
2995 git log master --not --remotes=*/master
2999 Shows all commits that are in local master but not in any remote
3000 repository master branches.
3003 <dt class=
"hdlist1">
3004 git log -p -m --first-parent
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.
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>
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.
3033 The contents of the blob objects are uninterpreted sequences
3034 of bytes. There is no encoding translation at the core
3040 The commit log messages are uninterpreted sequences of non-NUL
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
3051 <div class=
"olist arabic"><ol class=
"arabic">
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:
3060 <div class=
"listingblock">
3061 <div class=
"content">
3063 commitencoding = ISO-
8859-
1</tt></pre>
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>
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:
3078 <div class=
"listingblock">
3079 <div class=
"content">
3081 logoutputencoding = ISO-
8859-
1</tt></pre>
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>
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>
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">
3102 Default for the
<tt>--format
</tt> option. (See
"PRETTY FORMATS" above.)
3103 Defaults to
"medium".
3106 <dt class=
"hdlist1">
3107 i18n.logOutputEncoding
3111 Encoding to use when displaying logs. (See
"Discussion", above.)
3112 Defaults to the value of
<tt>i18n.commitEncoding
</tt> if set, UTF-
8
3116 <dt class=
"hdlist1">
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>.
3126 <dt class=
"hdlist1">
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>.
3137 <dt class=
"hdlist1">
3142 See
<a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
3145 <dt class=
"hdlist1">
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>.
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=
<ref
></tt> option.
</p></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>
3169 <div id=
"footer-text">
3170 Last updated
2011-
05-
03 00:
48:
04 UTC