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.5.2" />
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.0em;
131 div
.content
{ /* Block element content. */
135 /* Block element titles. */
136 div
.title
, caption
.title
{
138 font-family: sans-serif
;
142 margin-bottom: 0.5em;
148 td div
.title:first-child
{
151 div
.content div
.title:first-child
{
154 div
.content
+ div
.title
{
158 div
.sidebarblock
> div
.content
{
160 border: 1px solid silver
;
164 div
.listingblock
> div
.content
{
165 border: 1px solid silver
;
170 div
.quoteblock
, div
.verseblock
{
174 border-left: 5px solid
#dddddd;
178 div
.quoteblock
> div
.attribution
{
183 div
.verseblock
> div
.content
{
186 div
.verseblock
> div
.attribution
{
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div
.verseblock
+ div
.attribution
{
195 div
.admonitionblock
.icon
{
199 text-decoration: underline
;
201 padding-right: 0.5em;
203 div
.admonitionblock td
.content
{
205 border-left: 3px solid
#dddddd;
208 div
.exampleblock
> div
.content
{
209 border-left: 3px solid
#dddddd;
213 div
.imageblock div
.content
{ padding-left: 0; }
214 span
.image img
{ border-style: none
; }
215 a
.image:visited
{ color: white
; }
219 margin-bottom: 0.8em;
232 list-style-position: outside
;
235 list-style-type: decimal
;
238 list-style-type: lower-alpha
;
241 list-style-type: upper-alpha
;
244 list-style-type: lower-roman
;
247 list-style-type: upper-roman
;
250 div
.compact ul
, div
.compact ol
,
251 div
.compact p
, div
.compact p
,
252 div
.compact div
, div
.compact div
{
254 margin-bottom: 0.1em;
257 div
.tableblock
> table
{
258 border: 3px solid
#527bbd;
260 thead
, p
.table
.header
{
261 font-family: sans-serif
;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div
.tableblock
> table
[frame
="void"] {
277 div
.tableblock
> table
[frame
="hsides"] {
278 border-left-style: none
;
279 border-right-style: none
;
281 div
.tableblock
> table
[frame
="vsides"] {
282 border-top-style: none
;
283 border-bottom-style: none
;
289 margin-bottom: 0.8em;
292 padding-bottom: 15px;
294 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
300 padding-right: 0.8em;
306 div
.hdlist
.compact tr
{
315 .footnote, .footnoteref {
319 span
.footnote
, span
.footnoteref
{
320 vertical-align: super
;
324 margin: 20px 0 20px 0;
328 #footnotes div
.footnote
{
334 border-top: 1px solid silver
;
344 div#footer-badges
{ display: none
; }
348 margin-bottom: 2.5em;
353 font-family: sans-serif
;
357 margin-bottom: 0.1em;
360 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
376 /* Overrides for manpage documents */
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver
;
381 border-bottom: 2px solid silver
;
391 div#toc
{ display: none
; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div
.sidebar-content
{
398 border: 1px solid silver
;
401 div
.sidebar-title
, div
.image-title
{
403 font-family: sans-serif
;
406 margin-bottom: 0.5em;
409 div
.listingblock div
.content
{
410 border: 1px solid silver
;
415 div
.quoteblock-attribution
{
420 div
.verseblock-content
{
423 div
.verseblock-attribution
{
428 div
.exampleblock-content
{
429 border-left: 3px solid
#dddddd;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc
a:visited
{ color: blue
; }
436 <script type=
"text/javascript">
438 window
.onload = function(){asciidoc
.footnotes();}
439 var asciidoc
= { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
459 toc: function (toclevels
) {
461 function getText(el
) {
463 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
464 if (i
.nodeType
== 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
466 else if (i
.firstChild
!= null)
472 function TocEntry(el
, text
, toclevel
) {
475 this.toclevel
= toclevel
;
478 function tocEntries(el
, toclevels
) {
479 var result
= new Array
;
480 var re
= new RegExp('[hH]([2-'+(toclevels
+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
484 var iterate = function (el
) {
485 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
486 if (i
.nodeType
== 1 /* Node.ELEMENT_NODE */) {
487 var mo
= re
.exec(i
.tagName
);
488 if (mo
&& (i
.getAttribute("class") || i
.getAttribute("className")) != "float") {
489 result
[result
.length
] = new TocEntry(i
, getText(i
), mo
[1]-1);
499 var toc
= document
.getElementById("toc");
500 var entries
= tocEntries(document
.getElementById("content"), toclevels
);
501 for (var i
= 0; i
< entries
.length
; ++i
) {
502 var entry
= entries
[i
];
503 if (entry
.element
.id
== "")
504 entry
.element
.id
= "_toc_" + i
;
505 var a
= document
.createElement("a");
506 a
.href
= "#" + entry
.element
.id
;
507 a
.appendChild(document
.createTextNode(entry
.text
));
508 var div
= document
.createElement("div");
510 div
.className
= "toclevel" + entry
.toclevel
;
511 toc
.appendChild(div
);
513 if (entries
.length
== 0)
514 toc
.parentNode
.removeChild(toc
);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont
= document
.getElementById("content");
528 var noteholder
= document
.getElementById("footnotes");
529 var spans
= cont
.getElementsByTagName("span");
532 for (i
=0; i
<spans
.length
; i
++) {
533 if (spans
[i
].className
== "footnote") {
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note
= spans
[i
].innerHTML
.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder
.innerHTML
+=
539 "<div class='footnote' id='_footnote_" + n
+ "'>" +
540 "<a href='#_footnoteref_" + n
+ "' title='Return to text'>" +
541 n
+ "</a>. " + note
+ "</div>";
543 "[<a id='_footnoteref_" + n
+ "' href='#_footnote_" + n
+
544 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
545 var id
=spans
[i
].getAttribute("id");
546 if (id
!= null) refs
["#"+id
] = n
;
550 noteholder
.parentNode
.removeChild(noteholder
);
552 // Process footnoterefs.
553 for (i
=0; i
<spans
.length
; i
++) {
554 if (spans
[i
].className
== "footnoteref") {
555 var href
= spans
[i
].getElementsByTagName("a")[0].getAttribute("href");
556 href
= href
.match(/#.*/)[0]; // Because IE return full URL.
559 "[<a href='#_footnote_" + n
+
560 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
573 git-log(
1) Manual Page
576 <div class=
"sectionbody">
583 <h2 id=
"_synopsis">SYNOPSIS
</h2>
584 <div class=
"sectionbody">
585 <div class=
"verseblock">
586 <div class=
"verseblock-content"><em>git log
</em> [
<options
>] [
<since
>..
<until
>] [[--]
<path
>…]
</div>
587 <div class=
"verseblock-attribution">
590 <h2 id=
"_description">DESCRIPTION
</h2>
591 <div class=
"sectionbody">
592 <div class=
"paragraph"><p>Shows the commit logs.
</p></div>
593 <div class=
"paragraph"><p>The command takes options applicable to the
<em>git rev-list
</em>
594 command to control what is shown and how, and options applicable to
595 the
<em>git diff-*
</em> commands to control how the changes
596 each commit introduces are shown.
</p></div>
598 <h2 id=
"_options">OPTIONS
</h2>
599 <div class=
"sectionbody">
600 <div class=
"dlist"><dl>
606 Limits the number of commits to show.
607 Note that this is a commit limiting option, see below.
611 <since
>..
<until
>
615 Show only commits between the named two commits. When
616 either
<since
> or
<until
> is omitted, it defaults to
617 <tt>HEAD
</tt>, i.e. the tip of the current branch.
618 For a more complete list of ways to spell
<since
>
619 and
<until
>, see
<a href=
"gitrevisions.html">gitrevisions(
7)
</a>.
627 Continue listing the history of a file beyond renames
628 (works only for a single file).
635 --decorate[=short|full|no]
639 Print out the ref names of any commits that are shown. If
<em>short
</em> is
640 specified, the ref name prefixes
<em>refs/heads/
</em>,
<em>refs/tags/
</em> and
641 <em>refs/remotes/
</em> will not be printed. If
<em>full
</em> is specified, the
642 full ref name (including prefix) will be printed. The default option
651 Print out the ref name given on the command line by which each
660 Without this flag,
"git log -p <path>…" shows commits that
661 touch the specified paths, and diffs about the same specified
662 paths. With this, the full diff is shown for commits that touch
663 the specified paths; this means that
"<path>…" limits only
664 commits, and doesn
’t limit diff for those commits.
666 <div class=
"paragraph"><p>Note that this affects all diff-based output types, e.g. those
667 produced by --stat etc.
</p></div>
674 Before the log message print out its size in bytes. Intended
675 mainly for porcelain tools consumption. If git is unable to
676 produce a valid value size is set to zero.
677 Note that only message is considered, if also a diff is shown
678 its size is not included.
682 [--]
<path
>…
686 Show only commits that are enough to explain how the files
687 that match the specified paths came to be. See
"History
688 Simplification" below for details and other simplification
691 <div class=
"paragraph"><p>To prevent confusion with options and branch names, paths may need to
692 be prefixed with
"-- " to separate them from options or refnames.
</p></div>
695 <h3 id=
"_commit_limiting">Commit Limiting
</h3><div style=
"clear:left"></div>
696 <div class=
"paragraph"><p>Besides specifying a range of commits that should be listed using the
697 special notations explained in the description, additional commit
698 limiting may be applied. Note that they are applied before commit
699 ordering and formatting options, such as
<em>--reverse
</em>.
</p></div>
700 <div class=
"dlist"><dl>
705 --max-count=
<number
>
709 Limit the number of commits to output.
713 --skip=
<number
>
717 Skip
<em>number
</em> commits before starting to show the commit output.
728 Show commits more recent than a specific date.
735 --before=
<date
>
739 Show commits older than a specific date.
743 --author=
<pattern
>
746 --committer=
<pattern
>
750 Limit the commits output to ones with author/committer
751 header lines that match the specified pattern (regular expression).
755 --grep=
<pattern
>
759 Limit the commits output to ones with log message that
760 matches the specified pattern (regular expression).
768 Limit the commits output to ones that match all given --grep,
769 --author and --committer instead of ones that match at least one.
780 Match the regexp limiting patterns without regard to letters case.
791 Consider the limiting patterns to be extended regular expressions
792 instead of the default basic regular expressions.
803 Consider the limiting patterns to be fixed strings (don
’t interpret
804 pattern as a regular expression).
812 Stop when a given path disappears from the tree.
820 Print only merge commits. This is exactly the same as
<tt>--min-parents=
2</tt>.
828 Do not print commits with more than one parent. This is
829 exactly the same as
<tt>--max-parents=
1</tt>.
833 --min-parents=
<number
>
836 --max-parents=
<number
>
846 Show only commits which have at least (or at most) that many
847 commits. In particular,
<tt>--max-parents=
1</tt> is the same as
<tt>--no-merges
</tt>,
848 <tt>--min-parents=
2</tt> is the same as
<tt>--merges
</tt>.
<tt>--max-parents=
0</tt>
849 gives all root commits and
<tt>--min-parents=
3</tt> all octopus merges.
851 <div class=
"paragraph"><p><tt>--no-min-parents
</tt> and
<tt>--no-max-parents
</tt> reset these limits (to no limit)
852 again. Equivalent forms are
<tt>--min-parents=
0</tt> (any commit has
0 or more
853 parents) and
<tt>--max-parents=-
1</tt> (negative numbers denote no upper limit).
</p></div>
860 Follow only the first parent commit upon seeing a merge
861 commit. This option can give a better overview when
862 viewing the evolution of a particular topic branch,
863 because merges into a topic branch tend to be only about
864 adjusting to updated upstream from time to time, and
865 this option allows you to ignore the individual commits
866 brought in to your history by such a merge.
874 Reverses the meaning of the
<em>^</em> prefix (or lack thereof)
875 for all following revision specifiers, up to the next
<em>--not
</em>.
883 Pretend as if all the refs in
<tt>refs/
</tt> are listed on the
884 command line as
<em><commit
></em>.
888 --branches[=
<pattern
>]
892 Pretend as if all the refs in
<tt>refs/heads
</tt> are listed
893 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
894 branches to ones matching given shell glob. If pattern lacks
<em>?
</em>,
895 <em><strong></em>, or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
899 --tags[=
<pattern
>]
903 Pretend as if all the refs in
<tt>refs/tags
</tt> are listed
904 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
905 tags to ones matching given shell glob. If pattern lacks
<em>?
</em>,
<em><strong></em>,
906 or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
910 --remotes[=
<pattern
>]
914 Pretend as if all the refs in
<tt>refs/remotes
</tt> are listed
915 on the command line as
<em><commit
></em>. If
<em><pattern
></em> is given, limit
916 remote-tracking branches to ones matching given shell glob.
917 If pattern lacks
<em>?
</em>,
<em><strong></em>, or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
921 --glob=
<glob-pattern
>
925 Pretend as if all the refs matching shell glob
<em><glob-pattern
></em>
926 are listed on the command line as
<em><commit
></em>. Leading
<em>refs/
</em>,
927 is automatically prepended if missing. If pattern lacks
<em>?
</em>,
<em><strong></em>,
928 or
<em>[
</em>,
<em>/
</strong></em> at the end is implied.
936 Upon seeing an invalid object name in the input, pretend as if
937 the bad input was not given.
945 Pretend as if the bad bisection ref
<tt>refs/bisect/bad
</tt>
946 was listed and as if it was followed by
<tt>--not
</tt> and the good
947 bisection refs
<tt>refs/bisect/good-*
</tt> on the command
956 In addition to the
<em><commit
></em> listed on the command
957 line, read them from the standard input. If a
<em>--
</em> separator is
958 seen, stop reading commits and start reading paths to limit the
967 Like
<tt>--cherry-pick
</tt> (see below) but mark equivalent commits
968 with
<tt>=
</tt> rather than omitting them, and inequivalent ones with
<tt>+
</tt>.
976 Omit any commit that introduces the same change as
977 another commit on the
"other side" when the set of
978 commits are limited with symmetric difference.
980 <div class=
"paragraph"><p>For example, if you have two branches,
<tt>A
</tt> and
<tt>B
</tt>, a usual way
981 to list all commits on only one side of them is with
982 <tt>--left-right
</tt> (see the example below in the description of
983 the
<tt>--left-right
</tt> option). It however shows the commits that were cherry-picked
984 from the other branch (for example,
"3rd on b" may be cherry-picked
985 from branch A). With this option, such pairs of commits are
986 excluded from the output.
</p></div>
996 List only commits on the respective side of a symmetric range,
997 i.e. only those which would be marked
<tt><</tt> resp.
<tt>></tt> by
998 <tt>--left-right
</tt>.
1000 <div class=
"paragraph"><p>For example,
<tt>--cherry-pick --right-only A
…B
</tt> omits those
1001 commits from
<tt>B
</tt> which are in
<tt>A
</tt> or are patch-equivalent to a commit in
1002 <tt>A
</tt>. In other words, this lists the
<tt>+</tt> commits from
<tt>git cherry A B
</tt>.
1003 More precisely,
<tt>--cherry-pick --right-only --no-merges
</tt> gives the exact
1006 <dt class=
"hdlist1">
1011 A synonym for
<tt>--right-only --cherry-mark --no-merges
</tt>; useful to
1012 limit the output to the commits on our side and mark those that
1013 have been applied to the other side of a forked history with
1014 <tt>git log --cherry upstream
…mybranch
</tt>, similar to
1015 <tt>git cherry upstream mybranch
</tt>.
1018 <dt class=
"hdlist1">
1021 <dt class=
"hdlist1">
1026 Instead of walking the commit ancestry chain, walk
1027 reflog entries from the most recent one to older ones.
1028 When this option is used you cannot specify commits to
1029 exclude (that is,
<em>^commit
</em>,
<em>commit1..commit2
</em>,
1030 nor
<em>commit1...commit2
</em> notations cannot be used).
1032 <div class=
"paragraph"><p>With
<em>--pretty
</em> format other than oneline (for obvious reasons),
1033 this causes the output to have two extra lines of information
1034 taken from the reflog. By default,
<em>commit@{Nth}
</em> notation is
1035 used in the output. When the starting commit is specified as
1036 <em>commit@{now}
</em>, output also uses
<em>commit@{timestamp}
</em> notation
1037 instead. Under
<em>--pretty=oneline
</em>, the commit message is
1038 prefixed with this information on the same line.
1039 This option cannot be combined with
<em>--reverse
</em>.
1040 See also
<a href=
"git-reflog.html">git-reflog(
1)
</a>.
</p></div>
1042 <dt class=
"hdlist1">
1047 After a failed merge, show refs that touch files having a
1048 conflict and don
’t exist on all heads to merge.
1051 <dt class=
"hdlist1">
1056 Output uninteresting commits at the boundary, which are usually
1061 <h3 id=
"_history_simplification">History Simplification
</h3><div style=
"clear:left"></div>
1062 <div class=
"paragraph"><p>Sometimes you are only interested in parts of the history, for example the
1063 commits modifying a particular
<path
>. But there are two parts of
1064 <em>History Simplification
</em>, one part is selecting the commits and the other
1065 is how to do it, as there are various strategies to simplify the history.
</p></div>
1066 <div class=
"paragraph"><p>The following options select the commits to be shown:
</p></div>
1067 <div class=
"dlist"><dl>
1068 <dt class=
"hdlist1">
1073 Commits modifying the given
<paths
> are selected.
1076 <dt class=
"hdlist1">
1077 --simplify-by-decoration
1081 Commits that are referred by some branch or tag are selected.
1085 <div class=
"paragraph"><p>Note that extra commits can be shown to give a meaningful history.
</p></div>
1086 <div class=
"paragraph"><p>The following options affect the way the simplification is performed:
</p></div>
1087 <div class=
"dlist"><dl>
1088 <dt class=
"hdlist1">
1093 Simplifies the history to the simplest history explaining the
1094 final state of the tree. Simplest because it prunes some side
1095 branches if the end result is the same (i.e. merging branches
1096 with the same content)
1099 <dt class=
"hdlist1">
1104 Same as the default mode, but does not prune some history.
1107 <dt class=
"hdlist1">
1112 Only the selected commits are shown, plus some to have a
1116 <dt class=
"hdlist1">
1121 All commits in the simplified history are shown.
1124 <dt class=
"hdlist1">
1129 Additional option to
<em>--full-history
</em> to remove some needless
1130 merges from the resulting history, as there are no selected
1131 commits contributing to this merge.
1134 <dt class=
"hdlist1">
1139 When given a range of commits to display (e.g.
<em>commit1..commit2
</em>
1140 or
<em>commit2
^commit1
</em>), only display commits that exist
1141 directly on the ancestry chain between the
<em>commit1
</em> and
1142 <em>commit2
</em>, i.e. commits that are both descendants of
<em>commit1
</em>,
1143 and ancestors of
<em>commit2
</em>.
1147 <div class=
"paragraph"><p>A more detailed explanation follows.
</p></div>
1148 <div class=
"paragraph"><p>Suppose you specified
<tt>foo
</tt> as the
<paths
>. We shall call commits
1149 that modify
<tt>foo
</tt> !TREESAME, and the rest TREESAME. (In a diff
1150 filtered for
<tt>foo
</tt>, they look different and equal, respectively.)
</p></div>
1151 <div class=
"paragraph"><p>In the following, we will always refer to the same example history to
1152 illustrate the differences between simplification settings. We assume
1153 that you are filtering for a file
<tt>foo
</tt> in this commit graph:
</p></div>
1154 <div class=
"listingblock">
1155 <div class=
"content">
1156 <pre><tt> .-A---M---N---O---P
1160 `-------------'
</tt></pre>
1162 <div class=
"paragraph"><p>The horizontal line of history A---P is taken to be the first parent of
1163 each merge. The commits are:
</p></div>
1164 <div class=
"ulist"><ul>
1167 <tt>I
</tt> is the initial commit, in which
<tt>foo
</tt> exists with contents
1168 "asdf", and a file
<tt>quux
</tt> exists with contents
"quux". Initial
1169 commits are compared to an empty tree, so
<tt>I
</tt> is !TREESAME.
1174 In
<tt>A
</tt>,
<tt>foo
</tt> contains just
"foo".
1179 <tt>B
</tt> contains the same change as
<tt>A
</tt>. Its merge
<tt>M
</tt> is trivial and
1180 hence TREESAME to all parents.
1185 <tt>C
</tt> does not change
<tt>foo
</tt>, but its merge
<tt>N
</tt> changes it to
"foobar",
1186 so it is not TREESAME to any parent.
1191 <tt>D
</tt> sets
<tt>foo
</tt> to
"baz". Its merge
<tt>O
</tt> combines the strings from
1192 <tt>N
</tt> and
<tt>D
</tt> to
"foobarbaz"; i.e., it is not TREESAME to any parent.
1197 <tt>E
</tt> changes
<tt>quux
</tt> to
"xyzzy", and its merge
<tt>P
</tt> combines the
1198 strings to
"quux xyzzy". Despite appearing interesting,
<tt>P
</tt> is
1199 TREESAME to all parents.
1203 <div class=
"paragraph"><p><em>rev-list
</em> walks backwards through history, including or excluding
1204 commits based on whether
<em>--full-history
</em> and/or parent rewriting
1205 (via
<em>--parents
</em> or
<em>--children
</em>) are used. The following settings
1206 are available.
</p></div>
1207 <div class=
"dlist"><dl>
1208 <dt class=
"hdlist1">
1213 Commits are included if they are not TREESAME to any parent
1214 (though this can be changed, see
<em>--sparse
</em> below). If the
1215 commit was a merge, and it was TREESAME to one parent, follow
1216 only that parent. (Even if there are several TREESAME
1217 parents, follow only one of them.) Otherwise, follow all
1220 <div class=
"paragraph"><p>This results in:
</p></div>
1221 <div class=
"listingblock">
1222 <div class=
"content">
1223 <pre><tt> .-A---N---O
1225 I---------D
</tt></pre>
1227 <div class=
"paragraph"><p>Note how the rule to only follow the TREESAME parent, if one is
1228 available, removed
<tt>B
</tt> from consideration entirely.
<tt>C
</tt> was
1229 considered via
<tt>N
</tt>, but is TREESAME. Root commits are compared to an
1230 empty tree, so
<tt>I
</tt> is !TREESAME.
</p></div>
1231 <div class=
"paragraph"><p>Parent/child relations are only visible with --parents, but that does
1232 not affect the commits selected in default mode, so we have shown the
1233 parent lines.
</p></div>
1235 <dt class=
"hdlist1">
1236 --full-history without parent rewriting
1240 This mode differs from the default in one point: always follow
1241 all parents of a merge, even if it is TREESAME to one of them.
1242 Even if more than one side of the merge has commits that are
1243 included, this does not imply that the merge itself is! In
1246 <div class=
"listingblock">
1247 <div class=
"content">
1248 <pre><tt> I A B N D O
</tt></pre>
1250 <div class=
"paragraph"><p><tt>P
</tt> and
<tt>M
</tt> were excluded because they are TREESAME to a parent.
<tt>E
</tt>,
1251 <tt>C
</tt> and
<tt>B
</tt> were all walked, but only
<tt>B
</tt> was !TREESAME, so the others
1252 do not appear.
</p></div>
1253 <div class=
"paragraph"><p>Note that without parent rewriting, it is not really possible to talk
1254 about the parent/child relationships between the commits, so we show
1255 them disconnected.
</p></div>
1257 <dt class=
"hdlist1">
1258 --full-history with parent rewriting
1262 Ordinary commits are only included if they are !TREESAME
1263 (though this can be changed, see
<em>--sparse
</em> below).
1265 <div class=
"paragraph"><p>Merges are always included. However, their parent list is rewritten:
1266 Along each parent, prune away commits that are not included
1267 themselves. This results in
</p></div>
1268 <div class=
"listingblock">
1269 <div class=
"content">
1270 <pre><tt> .-A---M---N---O---P
1274 `-------------'
</tt></pre>
1276 <div class=
"paragraph"><p>Compare to
<em>--full-history
</em> without rewriting above. Note that
<tt>E
</tt>
1277 was pruned away because it is TREESAME, but the parent list of P was
1278 rewritten to contain
<tt>E
</tt>'s parent
<tt>I
</tt>. The same happened for
<tt>C
</tt> and
1279 <tt>N
</tt>. Note also that
<tt>P
</tt> was included despite being TREESAME.
</p></div>
1282 <div class=
"paragraph"><p>In addition to the above settings, you can change whether TREESAME
1283 affects inclusion:
</p></div>
1284 <div class=
"dlist"><dl>
1285 <dt class=
"hdlist1">
1290 Commits that are walked are included if they are not TREESAME
1294 <dt class=
"hdlist1">
1299 All commits that are walked are included.
1301 <div class=
"paragraph"><p>Note that without
<em>--full-history
</em>, this still simplifies merges: if
1302 one of the parents is TREESAME, we follow only that one, so the other
1303 sides of the merge are never walked.
</p></div>
1305 <dt class=
"hdlist1">
1310 First, build a history graph in the same way that
1311 <em>--full-history
</em> with parent rewriting does (see above).
1313 <div class=
"paragraph"><p>Then simplify each commit
‘C` to its replacement
<tt>C
’</tt> in the final
1314 history according to the following rules:
</p></div>
1315 <div class=
"ulist"><ul>
1318 Set
‘C
’` to
<tt>C
</tt>.
1323 Replace each parent
‘P` of
<tt>C
’</tt> with its simplification
‘P
’`. In
1324 the process, drop parents that are ancestors of other parents, and
1330 If after this parent rewriting,
‘C
’` is a root or merge commit (has
1331 zero or
>1 parents), a boundary commit, or !TREESAME, it remains.
1332 Otherwise, it is replaced with its only parent.
1336 <div class=
"paragraph"><p>The effect of this is best shown by way of comparing to
1337 <em>--full-history
</em> with parent rewriting. The example turns into:
</p></div>
1338 <div class=
"listingblock">
1339 <div class=
"content">
1340 <pre><tt> .-A---M---N---O
1344 `---------'
</tt></pre>
1346 <div class=
"paragraph"><p>Note the major differences in
<tt>N
</tt> and
<tt>P
</tt> over
<em>--full-history
</em>:
</p></div>
1347 <div class=
"ulist"><ul>
1350 <tt>N
</tt>'s parent list had
<tt>I
</tt> removed, because it is an ancestor of the
1351 other parent
<tt>M
</tt>. Still,
<tt>N
</tt> remained because it is !TREESAME.
1356 <tt>P
</tt>'s parent list similarly had
<tt>I
</tt> removed.
<tt>P
</tt> was then
1357 removed completely, because it had one parent and is TREESAME.
1363 <div class=
"paragraph"><p>Finally, there is a fifth simplification mode available:
</p></div>
1364 <div class=
"dlist"><dl>
1365 <dt class=
"hdlist1">
1370 Limit the displayed commits to those directly on the ancestry
1371 chain between the
"from" and
"to" commits in the given commit
1372 range. I.e. only display commits that are ancestor of the
"to"
1373 commit, and descendants of the
"from" commit.
1375 <div class=
"paragraph"><p>As an example use case, consider the following commit history:
</p></div>
1376 <div class=
"listingblock">
1377 <div class=
"content">
1378 <pre><tt> D---E-------F
1380 B---C---G---H---I---J
1382 A-------K---------------L--M
</tt></pre>
1384 <div class=
"paragraph"><p>A regular
<em>D..M
</em> computes the set of commits that are ancestors of
<tt>M
</tt>,
1385 but excludes the ones that are ancestors of
<tt>D
</tt>. This is useful to see
1386 what happened to the history leading to
<tt>M
</tt> since
<tt>D
</tt>, in the sense
1387 that
"what does <tt>M</tt> have that did not exist in <tt>D</tt>". The result in this
1388 example would be all the commits, except
<tt>A
</tt> and
<tt>B
</tt> (and
<tt>D
</tt> itself,
1389 of course).
</p></div>
1390 <div class=
"paragraph"><p>When we want to find out what commits in
<tt>M
</tt> are contaminated with the
1391 bug introduced by
<tt>D
</tt> and need fixing, however, we might want to view
1392 only the subset of
<em>D..M
</em> that are actually descendants of
<tt>D
</tt>, i.e.
1393 excluding
<tt>C
</tt> and
<tt>K
</tt>. This is exactly what the
<em>--ancestry-path
</em>
1394 option does. Applied to the
<em>D..M
</em> range, it results in:
</p></div>
1395 <div class=
"listingblock">
1396 <div class=
"content">
1405 <div class=
"paragraph"><p>The
<em>--simplify-by-decoration
</em> option allows you to view only the
1406 big picture of the topology of the history, by omitting commits
1407 that are not referenced by tags. Commits are marked as !TREESAME
1408 (in other words, kept after history simplification rules described
1409 above) if (
1) they are referenced by tags, or (
2) they change the
1410 contents of the paths given on the command line. All other
1411 commits are marked as TREESAME (subject to be simplified away).
</p></div>
1412 <h3 id=
"_commit_ordering">Commit Ordering
</h3><div style=
"clear:left"></div>
1413 <div class=
"paragraph"><p>By default, the commits are shown in reverse chronological order.
</p></div>
1414 <div class=
"dlist"><dl>
1415 <dt class=
"hdlist1">
1420 This option makes them appear in topological order (i.e.
1421 descendant commits are shown before their parents).
1424 <dt class=
"hdlist1">
1429 This option is similar to
<em>--topo-order
</em> in the sense that no
1430 parent comes before all of its children, but otherwise things
1431 are still ordered in the commit timestamp order.
1434 <dt class=
"hdlist1">
1439 Output the commits in reverse order.
1440 Cannot be combined with
<em>--walk-reflogs
</em>.
1444 <h3 id=
"_object_traversal">Object Traversal
</h3><div style=
"clear:left"></div>
1445 <div class=
"paragraph"><p>These options are mostly targeted for packing of git repositories.
</p></div>
1446 <div class=
"dlist"><dl>
1447 <dt class=
"hdlist1">
1452 Print the object IDs of any object referenced by the listed
1453 commits.
<em>--objects foo ^bar
</em> thus means
"send me
1454 all object IDs which I need to download if I have the commit
1455 object <em>bar</em>, but not <em>foo</em>".
1458 <dt class=
"hdlist1">
1463 Similar to
<em>--objects
</em>, but also print the IDs of excluded
1464 commits prefixed with a
"-" character. This is used by
1465 <a href=
"git-pack-objects.html">git-pack-objects(
1)
</a> to build
"thin" pack, which records
1466 objects in deltified form based on objects contained in these
1467 excluded commits to reduce network traffic.
1470 <dt class=
"hdlist1">
1475 Only useful with
<em>--objects
</em>; print the object IDs that are not
1479 <dt class=
"hdlist1">
1484 Only show the given revs, but do not traverse their ancestors.
1487 <dt class=
"hdlist1">
1492 Overrides a previous --no-walk.
1496 <h3 id=
"_commit_formatting">Commit Formatting
</h3><div style=
"clear:left"></div>
1497 <div class=
"dlist"><dl>
1498 <dt class=
"hdlist1">
1499 --pretty[=
<format
>]
1501 <dt class=
"hdlist1">
1502 --format=
<format
>
1506 Pretty-print the contents of the commit logs in a given format,
1507 where
<em><format
></em> can be one of
<em>oneline
</em>,
<em>short
</em>,
<em>medium
</em>,
1508 <em>full
</em>,
<em>fuller
</em>,
<em>email
</em>,
<em>raw
</em> and
<em>format:
<string
></em>. See
1509 the
"PRETTY FORMATS" section for some additional details for each
1510 format. When omitted, the format defaults to
<em>medium
</em>.
1512 <div class=
"paragraph"><p>Note: you can specify the default pretty format in the repository
1513 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1515 <dt class=
"hdlist1">
1520 Instead of showing the full
40-byte hexadecimal commit object
1521 name, show only a partial prefix. Non default number of
1522 digits can be specified with
"--abbrev=<n>" (which also modifies
1523 diff output, if it is displayed).
1525 <div class=
"paragraph"><p>This should make
"--pretty=oneline" a whole lot more readable for
1526 people using
80-column terminals.
</p></div>
1528 <dt class=
"hdlist1">
1533 Show the full
40-byte hexadecimal commit object name. This negates
1534 <tt>--abbrev-commit
</tt> and those options which imply it such as
1535 "--oneline". It also overrides the
<em>log.abbrevCommit
</em> variable.
1538 <dt class=
"hdlist1">
1543 This is a shorthand for
"--pretty=oneline --abbrev-commit"
1547 <dt class=
"hdlist1">
1548 --encoding[=
<encoding
>]
1552 The commit objects record the encoding used for the log message
1553 in their encoding header; this option can be used to tell the
1554 command to re-code the commit log message in the encoding
1555 preferred by the user. For non plumbing commands this
1559 <dt class=
"hdlist1">
1560 --notes[=
<ref
>]
1564 Show the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) that annotate the
1565 commit, when showing the commit log message. This is the default
1566 for
<tt>git log
</tt>,
<tt>git show
</tt> and
<tt>git whatchanged
</tt> commands when
1567 there is no
<tt>--pretty
</tt>,
<tt>--format
</tt> nor
<tt>--oneline
</tt> option given
1568 on the command line.
1570 <div class=
"paragraph"><p>By default, the notes shown are from the notes refs listed in the
1571 <em>core.notesRef
</em> and
<em>notes.displayRef
</em> variables (or corresponding
1572 environment overrides). See
<a href=
"git-config.html">git-config(
1)
</a> for more details.
</p></div>
1573 <div class=
"paragraph"><p>With an optional
<em><ref
></em> argument, show this notes ref instead of the
1574 default notes ref(s). The ref is taken to be in
<tt>refs/notes/
</tt> if it
1575 is not qualified.
</p></div>
1576 <div class=
"paragraph"><p>Multiple --notes options can be combined to control which notes are
1577 being displayed. Examples:
"--notes=foo" will show only notes from
1578 "refs/notes/foo";
"--notes=foo --notes" will show both notes from
1579 "refs/notes/foo" and from the default notes ref(s).
</p></div>
1581 <dt class=
"hdlist1">
1586 Do not show notes. This negates the above
<tt>--notes
</tt> option, by
1587 resetting the list of notes refs from which notes are shown.
1588 Options are parsed in the order given on the command line, so e.g.
1589 "--notes --notes=foo --no-notes --notes=bar" will only show notes
1590 from
"refs/notes/bar".
1593 <dt class=
"hdlist1">
1594 --show-notes[=
<ref
>]
1596 <dt class=
"hdlist1">
1597 --[no-]standard-notes
1601 These options are deprecated. Use the above --notes/--no-notes
1605 <dt class=
"hdlist1">
1610 Synonym for
<tt>--date=relative
</tt>.
1613 <dt class=
"hdlist1">
1614 --date=(relative|local|default|iso|rfc|short|raw)
1618 Only takes effect for dates shown in human-readable format, such
1619 as when using
"--pretty".
<tt>log.date
</tt> config variable sets a default
1620 value for log command
’s --date option.
1622 <div class=
"paragraph"><p><tt>--date=relative
</tt> shows dates relative to the current time,
1623 e.g.
"2 hours ago".
</p></div>
1624 <div class=
"paragraph"><p><tt>--date=local
</tt> shows timestamps in user
’s local timezone.
</p></div>
1625 <div class=
"paragraph"><p><tt>--date=iso
</tt> (or
<tt>--date=iso8601
</tt>) shows timestamps in ISO
8601 format.
</p></div>
1626 <div class=
"paragraph"><p><tt>--date=rfc
</tt> (or
<tt>--date=rfc2822
</tt>) shows timestamps in RFC
2822
1627 format, often found in E-mail messages.
</p></div>
1628 <div class=
"paragraph"><p><tt>--date=short
</tt> shows only date but not time, in
<tt>YYYY-MM-DD
</tt> format.
</p></div>
1629 <div class=
"paragraph"><p><tt>--date=raw
</tt> shows the date in the internal raw git format
<tt>%s %z
</tt> format.
</p></div>
1630 <div class=
"paragraph"><p><tt>--date=default
</tt> shows timestamps in the original timezone
1631 (either committer
’s or author
’s).
</p></div>
1633 <dt class=
"hdlist1">
1638 Print also the parents of the commit (in the form
"commit parent…").
1639 Also enables parent rewriting, see
<em>History Simplification
</em> below.
1642 <dt class=
"hdlist1">
1647 Print also the children of the commit (in the form
"commit child…").
1648 Also enables parent rewriting, see
<em>History Simplification
</em> below.
1651 <dt class=
"hdlist1">
1656 Mark which side of a symmetric diff a commit is reachable from.
1657 Commits from the left side are prefixed with
<tt><</tt> and those from
1658 the right with
<tt>></tt>. If combined with
<tt>--boundary
</tt>, those
1659 commits are prefixed with
<tt>-
</tt>.
1661 <div class=
"paragraph"><p>For example, if you have this topology:
</p></div>
1662 <div class=
"listingblock">
1663 <div class=
"content">
1664 <pre><tt> y---b---b branch B
1668 o---x---a---a branch A
</tt></pre>
1670 <div class=
"paragraph"><p>you would get an output like this:
</p></div>
1671 <div class=
"listingblock">
1672 <div class=
"content">
1673 <pre><tt> $ git rev-list --left-right --boundary --pretty=oneline A...B
1675 >bbbbbbb...
3rd on b
1676 >bbbbbbb...
2nd on b
1677 <aaaaaaa...
3rd on a
1678 <aaaaaaa...
2nd on a
1679 -yyyyyyy...
1st on b
1680 -xxxxxxx...
1st on a
</tt></pre>
1683 <dt class=
"hdlist1">
1688 Draw a text-based graphical representation of the commit history
1689 on the left hand side of the output. This may cause extra lines
1690 to be printed in between commits, in order for the graph history
1691 to be drawn properly.
1693 <div class=
"paragraph"><p>This enables parent rewriting, see
<em>History Simplification
</em> below.
</p></div>
1694 <div class=
"paragraph"><p>This implies the
<em>--topo-order
</em> option by default, but the
1695 <em>--date-order
</em> option may also be specified.
</p></div>
1698 <h3 id=
"_diff_formatting">Diff Formatting
</h3><div style=
"clear:left"></div>
1699 <div class=
"paragraph"><p>Below are listed options that control the formatting of diff output.
1700 Some of them are specific to
<a href=
"git-rev-list.html">git-rev-list(
1)
</a>, however other diff
1701 options may be given. See
<a href=
"git-diff-files.html">git-diff-files(
1)
</a> for more options.
</p></div>
1702 <div class=
"dlist"><dl>
1703 <dt class=
"hdlist1">
1708 With this option, diff output for a merge commit
1709 shows the differences from each of the parents to the merge result
1710 simultaneously instead of showing pairwise diff between a parent
1711 and the result one at a time. Furthermore, it lists only files
1712 which were modified from all parents.
1715 <dt class=
"hdlist1">
1720 This flag implies the
<em>-c
</em> options and further compresses the
1721 patch output by omitting uninteresting hunks whose contents in
1722 the parents have only two variants and the merge result picks
1723 one of them without modification.
1726 <dt class=
"hdlist1">
1731 This flag makes the merge commits show the full diff like
1732 regular commits; for each merge parent, a separate log entry
1733 and diff is generated. An exception is that only diff against
1734 the first parent is shown when
<em>--first-parent
</em> option is given;
1735 in that case, the output represents the changes the merge
1736 brought
<em>into
</em> the then-current branch.
1739 <dt class=
"hdlist1">
1744 Show recursive diffs.
1747 <dt class=
"hdlist1">
1752 Show the tree objects in the diff output. This implies
<em>-r
</em>.
1755 <dt class=
"hdlist1">
1760 Suppress diff output.
1765 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
1766 <div class=
"sectionbody">
1767 <div class=
"paragraph"><p>If the commit is a merge, and if the pretty-format
1768 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
1769 inserted before the
<em>Author:
</em> line. This line begins with
1770 "Merge: " and the sha1s of ancestral commits are printed,
1771 separated by spaces. Note that the listed commits may not
1772 necessarily be the list of the
<strong>direct
</strong> parent commits if you
1773 have limited your view of history: for example, if you are
1774 only interested in changes related to a certain directory or
1776 <div class=
"paragraph"><p>There are several built-in formats, and you can define
1777 additional formats by setting a pretty.
<name
>
1778 config option to either another format name, or a
1779 <em>format:
</em> string, as described below (see
1780 <a href=
"git-config.html">git-config(
1)
</a>). Here are the details of the
1781 built-in formats:
</p></div>
1782 <div class=
"ulist"><ul>
1787 <div class=
"literalblock">
1788 <div class=
"content">
1789 <pre><tt><sha1
> <title line
></tt></pre>
1791 <div class=
"paragraph"><p>This is designed to be as compact as possible.
</p></div>
1797 <div class=
"literalblock">
1798 <div class=
"content">
1799 <pre><tt>commit
<sha1
>
1800 Author:
<author
></tt></pre>
1802 <div class=
"literalblock">
1803 <div class=
"content">
1804 <pre><tt><title line
></tt></pre>
1811 <div class=
"literalblock">
1812 <div class=
"content">
1813 <pre><tt>commit
<sha1
>
1814 Author:
<author
>
1815 Date:
<author date
></tt></pre>
1817 <div class=
"literalblock">
1818 <div class=
"content">
1819 <pre><tt><title line
></tt></pre>
1821 <div class=
"literalblock">
1822 <div class=
"content">
1823 <pre><tt><full commit message
></tt></pre>
1830 <div class=
"literalblock">
1831 <div class=
"content">
1832 <pre><tt>commit
<sha1
>
1833 Author:
<author
>
1834 Commit:
<committer
></tt></pre>
1836 <div class=
"literalblock">
1837 <div class=
"content">
1838 <pre><tt><title line
></tt></pre>
1840 <div class=
"literalblock">
1841 <div class=
"content">
1842 <pre><tt><full commit message
></tt></pre>
1849 <div class=
"literalblock">
1850 <div class=
"content">
1851 <pre><tt>commit
<sha1
>
1852 Author:
<author
>
1853 AuthorDate:
<author date
>
1854 Commit:
<committer
>
1855 CommitDate:
<committer date
></tt></pre>
1857 <div class=
"literalblock">
1858 <div class=
"content">
1859 <pre><tt><title line
></tt></pre>
1861 <div class=
"literalblock">
1862 <div class=
"content">
1863 <pre><tt><full commit message
></tt></pre>
1870 <div class=
"literalblock">
1871 <div class=
"content">
1872 <pre><tt>From
<sha1
> <date
>
1873 From:
<author
>
1874 Date:
<author date
>
1875 Subject: [PATCH]
<title line
></tt></pre>
1877 <div class=
"literalblock">
1878 <div class=
"content">
1879 <pre><tt><full commit message
></tt></pre>
1886 <div class=
"paragraph"><p>The
<em>raw
</em> format shows the entire commit exactly as
1887 stored in the commit object. Notably, the SHA1s are
1888 displayed in full, regardless of whether --abbrev or
1889 --no-abbrev are used, and
<em>parents
</em> information show the
1890 true parent commits, without taking grafts nor history
1891 simplification into account.
</p></div>
1895 <em>format:
<string
></em>
1897 <div class=
"paragraph"><p>The
<em>format:
<string
></em> format allows you to specify which information
1898 you want to show. It works a little bit like printf format,
1899 with the notable exception that you get a newline with
<em>%n
</em>
1900 instead of
<em>\n
</em>.
</p></div>
1901 <div class=
"paragraph"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
1902 would show something like this:
</p></div>
1903 <div class=
"listingblock">
1904 <div class=
"content">
1905 <pre><tt>The author of fe6e0ee was Junio C Hamano,
23 hours ago
1906 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<</tt></pre>
1908 <div class=
"paragraph"><p>The placeholders are:
</p></div>
1909 <div class=
"ulist"><ul>
1912 <em>%H
</em>: commit hash
1917 <em>%h
</em>: abbreviated commit hash
1922 <em>%T
</em>: tree hash
1927 <em>%t
</em>: abbreviated tree hash
1932 <em>%P
</em>: parent hashes
1937 <em>%p
</em>: abbreviated parent hashes
1942 <em>%an
</em>: author name
1947 <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>)
1952 <em>%ae
</em>: author email
1957 <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>)
1962 <em>%ad
</em>: author date (format respects --date= option)
1967 <em>%aD
</em>: author date, RFC2822 style
1972 <em>%ar
</em>: author date, relative
1977 <em>%at
</em>: author date, UNIX timestamp
1982 <em>%ai
</em>: author date, ISO
8601 format
1987 <em>%cn
</em>: committer name
1992 <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>)
1997 <em>%ce
</em>: committer email
2002 <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>)
2007 <em>%cd
</em>: committer date
2012 <em>%cD
</em>: committer date, RFC2822 style
2017 <em>%cr
</em>: committer date, relative
2022 <em>%ct
</em>: committer date, UNIX timestamp
2027 <em>%ci
</em>: committer date, ISO
8601 format
2032 <em>%d
</em>: ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
2037 <em>%e
</em>: encoding
2042 <em>%s
</em>: subject
2047 <em>%f
</em>: sanitized subject line, suitable for a filename
2057 <em>%B
</em>: raw body (unwrapped subject and body)
2062 <em>%N
</em>: commit notes
2067 <em>%gD
</em>: reflog selector, e.g.,
<tt>refs/stash@{
1}
</tt>
2072 <em>%gd
</em>: shortened reflog selector, e.g.,
<tt>stash@{
1}
</tt>
2077 <em>%gs
</em>: reflog subject
2082 <em>%Cred
</em>: switch color to red
2087 <em>%Cgreen
</em>: switch color to green
2092 <em>%Cblue
</em>: switch color to blue
2097 <em>%Creset
</em>: reset color
2102 <em>%C(
…)
</em>: color specification, as described in color.branch.* config option
2107 <em>%m
</em>: left, right or boundary mark
2112 <em>%n
</em>: newline
2117 <em>%%
</em>: a raw
<em>%
</em>
2122 <em>%x00
</em>: print a byte from a hex code
2127 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>: switch line wrapping, like the -w option of
2128 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
2134 <div class=
"admonitionblock">
2137 <div class=
"title">Note
</div>
2139 <td class=
"content">Some placeholders may depend on other options given to the
2140 revision traversal engine. For example, the
<tt>%g*
</tt> reflog options will
2141 insert an empty string unless we are traversing reflog entries (e.g., by
2142 <tt>git log -g
</tt>). The
<tt>%d
</tt> placeholder will use the
"short" decoration
2143 format if
<tt>--decorate
</tt> was not already provided on the command line.
</td>
2146 <div class=
"paragraph"><p>If you add a
<tt>+</tt> (plus sign) after
<em>%
</em> of a placeholder, a line-feed
2147 is inserted immediately before the expansion if and only if the
2148 placeholder expands to a non-empty string.
</p></div>
2149 <div class=
"paragraph"><p>If you add a
<tt>-
</tt> (minus sign) after
<em>%
</em> of a placeholder, line-feeds that
2150 immediately precede the expansion are deleted if and only if the
2151 placeholder expands to an empty string.
</p></div>
2152 <div class=
"paragraph"><p>If you add a ` ` (space) after
<em>%
</em> of a placeholder, a space
2153 is inserted immediately before the expansion if and only if the
2154 placeholder expands to a non-empty string.
</p></div>
2155 <div class=
"ulist"><ul>
2160 <div class=
"paragraph"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
2161 provides
"terminator" semantics instead of
"separator" semantics. In
2162 other words, each commit has the message terminator character (usually a
2163 newline) appended, rather than a separator placed between entries.
2164 This means that the final entry of a single-line format will be properly
2165 terminated with a new line, just as the
"oneline" format does.
2166 For example:
</p></div>
2167 <div class=
"listingblock">
2168 <div class=
"content">
2169 <pre><tt>$ git log -
2 --pretty=format:%h
4da45bef \
2170 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
2172 7134973 -- NO NEWLINE
2174 $ git log -
2 --pretty=tformat:%h
4da45bef \
2175 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
2179 <div class=
"paragraph"><p>In addition, any unrecognized string that has a
<tt>%
</tt> in it is interpreted
2180 as if it has
<tt>tformat:
</tt> in front of it. For example, these two are
2181 equivalent:
</p></div>
2182 <div class=
"listingblock">
2183 <div class=
"content">
2184 <pre><tt>$ git log -
2 --pretty=tformat:%h
4da45bef
2185 $ git log -
2 --pretty=%h
4da45bef
</tt></pre>
2190 <h2 id=
"_common_diff_options">Common diff options
</h2>
2191 <div class=
"sectionbody">
2192 <div class=
"dlist"><dl>
2193 <dt class=
"hdlist1">
2196 <dt class=
"hdlist1">
2199 <dt class=
"hdlist1">
2204 Generate patch (see section on generating patches).
2208 <dt class=
"hdlist1">
2211 <dt class=
"hdlist1">
2216 Generate diffs with
<n
> lines of context instead of
2218 Implies
<tt>-p
</tt>.
2221 <dt class=
"hdlist1">
2226 Generate the raw format.
2230 <dt class=
"hdlist1">
2235 Synonym for
<tt>-p --raw
</tt>.
2238 <dt class=
"hdlist1">
2243 Generate a diff using the
"patience diff" algorithm.
2246 <dt class=
"hdlist1">
2247 --stat[=
<width
>[,
<name-width
>[,
<count
>]]]
2251 Generate a diffstat. You can override the default
2252 output width for
80-column terminal by
<tt>--stat=
<width
></tt>.
2253 The width of the filename part can be controlled by
2254 giving another width to it separated by a comma.
2255 By giving a third parameter
<tt><count
></tt>, you can limit the
2256 output to the first
<tt><count
></tt> lines, followed by
2257 <tt>…</tt> if there are more.
2259 <div class=
"paragraph"><p>These parameters can also be set individually with
<tt>--stat-width=
<width
></tt>,
2260 <tt>--stat-name-width=
<name-width
></tt> and
<tt>--stat-count=
<count
></tt>.
</p></div>
2262 <dt class=
"hdlist1">
2267 Similar to
<tt>--stat
</tt>, but shows number of added and
2268 deleted lines in decimal notation and pathname without
2269 abbreviation, to make it more machine friendly. For
2270 binary files, outputs two
<tt>-
</tt> instead of saying
2274 <dt class=
"hdlist1">
2279 Output only the last line of the
<tt>--stat
</tt> format containing total
2280 number of modified files, as well as number of added and deleted
2284 <dt class=
"hdlist1">
2285 --dirstat[=
<param1,param2,
…>]
2289 Output the distribution of relative amount of changes for each
2290 sub-directory. The behavior of
<tt>--dirstat
</tt> can be customized by
2291 passing it a comma separated list of parameters.
2292 The defaults are controlled by the
<tt>diff.dirstat
</tt> configuration
2293 variable (see
<a href=
"git-config.html">git-config(
1)
</a>).
2294 The following parameters are available:
2296 <div class=
"dlist"><dl>
2297 <dt class=
"hdlist1">
2302 Compute the dirstat numbers by counting the lines that have been
2303 removed from the source, or added to the destination. This ignores
2304 the amount of pure code movements within a file. In other words,
2305 rearranging lines in a file is not counted as much as other changes.
2306 This is the default behavior when no parameter is given.
2309 <dt class=
"hdlist1">
2314 Compute the dirstat numbers by doing the regular line-based diff
2315 analysis, and summing the removed/added line counts. (For binary
2316 files, count
64-byte chunks instead, since binary files have no
2317 natural concept of lines). This is a more expensive
<tt>--dirstat
</tt>
2318 behavior than the
<tt>changes
</tt> behavior, but it does count rearranged
2319 lines within a file as much as other changes. The resulting output
2320 is consistent with what you get from the other
<tt>--*stat
</tt> options.
2323 <dt class=
"hdlist1">
2328 Compute the dirstat numbers by counting the number of files changed.
2329 Each changed file counts equally in the dirstat analysis. This is
2330 the computationally cheapest
<tt>--dirstat
</tt> behavior, since it does
2331 not have to look at the file contents at all.
2334 <dt class=
"hdlist1">
2339 Count changes in a child directory for the parent directory as well.
2340 Note that when using
<tt>cumulative
</tt>, the sum of the percentages
2341 reported may exceed
100%. The default (non-cumulative) behavior can
2342 be specified with the
<tt>noncumulative
</tt> parameter.
2345 <dt class=
"hdlist1">
2350 An integer parameter specifies a cut-off percent (
3% by default).
2351 Directories contributing less than this percentage of the changes
2352 are not shown in the output.
2356 <div class=
"paragraph"><p>Example: The following will count changed files, while ignoring
2357 directories with less than
10% of the total amount of changed files,
2358 and accumulating child directory counts in the parent directories:
2359 <tt>--dirstat=files,
10,cumulative
</tt>.
</p></div>
2361 <dt class=
"hdlist1">
2366 Output a condensed summary of extended header information
2367 such as creations, renames and mode changes.
2370 <dt class=
"hdlist1">
2375 Synonym for
<tt>-p --stat
</tt>.
2378 <dt class=
"hdlist1">
2383 Separate the commits with NULs instead of with new newlines.
2385 <div class=
"paragraph"><p>Also, when
<tt>--raw
</tt> or
<tt>--numstat
</tt> has been given, do not munge
2386 pathnames and use NULs as output field terminators.
</p></div>
2387 <div class=
"paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
2388 and backslash characters replaced with
<tt>\t
</tt>,
<tt>\n
</tt>,
<tt>\
"</tt>, and <tt>\\</tt>,
2389 respectively, and the pathname will be enclosed in double quotes if
2390 any of those replacements occurred.</p></div>
2392 <dt class="hdlist1
">
2397 Show only names of changed files.
2400 <dt class="hdlist1
">
2405 Show only names and status of changed files. See the description
2406 of the <tt>--diff-filter</tt> option on what the status letters mean.
2409 <dt class="hdlist1
">
2410 --submodule[=<format>]
2414 Chose the output format for submodule differences. <format> can be one of
2415 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
2416 is used when this option is not given. <em>log</em> is the default value for this
2417 option and lists the commits in that commit range like the <em>summary</em>
2418 option of <a href="git-submodule.html
">git-submodule(1)</a> does.
2421 <dt class="hdlist1
">
2422 --color[=<when>]
2427 The value must be <tt>always</tt> (the default for <tt><when></tt>), <tt>never</tt>, or <tt>auto</tt>.
2428 The default value is <tt>never</tt>.
2431 <dt class="hdlist1
">
2436 Turn off colored diff.
2437 It is the same as <tt>--color=never</tt>.
2440 <dt class="hdlist1
">
2441 --word-diff[=<mode>]
2445 Show a word diff, using the <mode> to delimit changed words.
2446 By default, words are delimited by whitespace; see
2447 <tt>--word-diff-regex</tt> below. The <mode> defaults to <em>plain</em>, and
2450 <div class="dlist
"><dl>
2451 <dt class="hdlist1
">
2456 Highlight changed words using only colors. Implies <tt>--color</tt>.
2459 <dt class="hdlist1
">
2464 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
2465 attempts to escape the delimiters if they appear in the input,
2466 so the output may be ambiguous.
2469 <dt class="hdlist1
">
2474 Use a special line-based format intended for script
2475 consumption. Added/removed/unchanged runs are printed in the
2476 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
2477 character at the beginning of the line and extending to the
2478 end of the line. Newlines in the input are represented by a
2479 tilde <tt>~</tt> on a line of its own.
2482 <dt class="hdlist1
">
2487 Disable word diff again.
2491 <div class="paragraph
"><p>Note that despite the name of the first mode, color is used to
2492 highlight the changed parts in all modes if enabled.</p></div>
2494 <dt class="hdlist1
">
2495 --word-diff-regex=<regex>
2499 Use <regex> to decide what a word is, instead of considering
2500 runs of non-whitespace to be a word. Also implies
2501 <tt>--word-diff</tt> unless it was already enabled.
2503 <div class="paragraph
"><p>Every non-overlapping match of the
2504 <regex> is considered a word. Anything between these matches is
2505 considered whitespace and ignored(!) for the purposes of finding
2506 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
2507 expression to make sure that it matches all non-whitespace characters.
2508 A match that contains a newline is silently truncated(!) at the
2510 <div class="paragraph
"><p>The regex can also be set via a diff driver or configuration option, see
2511 <a href="gitattributes.html
">gitattributes(1)</a> or <a href="git-config.html
">git-config(1)</a>. Giving it explicitly
2512 overrides any diff driver or configuration setting. Diff drivers
2513 override configuration settings.</p></div>
2515 <dt class="hdlist1
">
2516 --color-words[=<regex>]
2520 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
2521 specified) <tt>--word-diff-regex=<regex></tt>.
2524 <dt class="hdlist1
">
2529 Turn off rename detection, even when the configuration
2530 file gives the default to do so.
2533 <dt class="hdlist1
">
2538 Warn if changes introduce whitespace errors. What are
2539 considered whitespace errors is controlled by <tt>core.whitespace</tt>
2540 configuration. By default, trailing whitespaces (including
2541 lines that solely consist of whitespaces) and a space character
2542 that is immediately followed by a tab character inside the
2543 initial indent of the line are considered whitespace errors.
2544 Exits with non-zero status if problems are found. Not compatible
2548 <dt class="hdlist1
">
2553 Instead of the first handful of characters, show the full
2554 pre- and post-image blob object names on the "index
"
2555 line when generating patch format output.
2558 <dt class="hdlist1
">
2563 In addition to <tt>--full-index</tt>, output a binary diff that
2564 can be applied with <tt>git-apply</tt>.
2567 <dt class="hdlist1
">
2568 --abbrev[=<n>]
2572 Instead of showing the full 40-byte hexadecimal object
2573 name in diff-raw format output and diff-tree header
2574 lines, show only a partial prefix. This is
2575 independent of the <tt>--full-index</tt> option above, which controls
2576 the diff-patch output format. Non default number of
2577 digits can be specified with <tt>--abbrev=<n></tt>.
2580 <dt class="hdlist1
">
2581 -B[<n>][/<m>]
2583 <dt class="hdlist1
">
2584 --break-rewrites[=[<n>][/<m>]]
2588 Break complete rewrite changes into pairs of delete and
2589 create. This serves two purposes:
2591 <div class="paragraph
"><p>It affects the way a change that amounts to a total rewrite of a file
2592 not as a series of deletion and insertion mixed together with a very
2593 few lines that happen to match textually as the context, but as a
2594 single deletion of everything old followed by a single insertion of
2595 everything new, and the number <tt>m</tt> controls this aspect of the -B
2596 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
2597 original should remain in the result for git to consider it a total
2598 rewrite (i.e. otherwise the resulting patch will be a series of
2599 deletion and insertion mixed together with context lines).</p></div>
2600 <div class="paragraph
"><p>When used with -M, a totally-rewritten file is also considered as the
2601 source of a rename (usually -M only considers a file that disappeared
2602 as the source of a rename), and the number <tt>n</tt> controls this aspect of
2603 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
2604 addition and deletion compared to 20% or more of the file’s size are
2605 eligible for being picked up as a possible source of a rename to
2606 another file.</p></div>
2608 <dt class="hdlist1
">
2611 <dt class="hdlist1
">
2612 --find-renames[=<n>]
2616 If generating diffs, detect and report renames for each commit.
2617 For following files across renames while traversing history, see
2619 If <tt>n</tt> is specified, it is a threshold on the similarity
2620 index (i.e. amount of addition/deletions compared to the
2621 file’s size). For example, <tt>-M90%</tt> means git should consider a
2622 delete/add pair to be a rename if more than 90% of the file
2623 hasn’t changed.
2626 <dt class="hdlist1
">
2629 <dt class="hdlist1
">
2630 --find-copies[=<n>]
2634 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
2635 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M<n></tt>.
2638 <dt class="hdlist1
">
2639 --find-copies-harder
2643 For performance reasons, by default, <tt>-C</tt> option finds copies only
2644 if the original file of the copy was modified in the same
2645 changeset. This flag makes the command
2646 inspect unmodified files as candidates for the source of
2647 copy. This is a very expensive operation for large
2648 projects, so use it with caution. Giving more than one
2649 <tt>-C</tt> option has the same effect.
2652 <dt class="hdlist1
">
2655 <dt class="hdlist1
">
2656 --irreversible-delete
2660 Omit the preimage for deletes, i.e. print only the header but not
2661 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
2662 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
2663 solely for people who want to just concentrate on reviewing the
2664 text after the change. In addition, the output obviously lack
2665 enough information to apply such a patch in reverse, even manually,
2666 hence the name of the option.
2668 <div class="paragraph
"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
2669 of a delete/create pair.</p></div>
2671 <dt class="hdlist1
">
2676 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
2677 is the number of potential rename/copy targets. This
2678 option prevents rename/copy detection from running if
2679 the number of rename/copy targets exceeds the specified
2683 <dt class="hdlist1
">
2684 --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]]
2688 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
2689 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
2690 type (i.e. regular file, symlink, submodule, …) changed (<tt>T</tt>),
2691 are Unmerged (<tt>U</tt>), are
2692 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
2693 Any combination of the filter characters (including none) can be used.
2694 When <tt>*</tt> (All-or-none) is added to the combination, all
2695 paths are selected if there is any file that matches
2696 other criteria in the comparison; if there is no file
2697 that matches other criteria, nothing is selected.
2700 <dt class="hdlist1
">
2705 Look for differences that introduce or remove an instance of
2706 <string>. Note that this is different than the string simply
2707 appearing in diff output; see the <em>pickaxe</em> entry in
2708 <a href="gitdiffcore.html
">gitdiffcore(7)</a> for more details.
2711 <dt class="hdlist1
">
2716 Look for differences whose added or removed line matches
2717 the given <regex>.
2720 <dt class="hdlist1
">
2725 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
2726 changeset, not just the files that contain the change
2730 <dt class="hdlist1
">
2735 Make the <string> not a plain string but an extended POSIX
2739 <dt class="hdlist1
">
2744 Output the patch in the order specified in the
2745 <orderfile>, which has one shell glob pattern per line.
2748 <dt class="hdlist1
">
2753 Swap two inputs; that is, show differences from index or
2754 on-disk file to tree contents.
2757 <dt class="hdlist1
">
2758 --relative[=<path>]
2762 When run from a subdirectory of the project, it can be
2763 told to exclude changes outside the directory and show
2764 pathnames relative to it with this option. When you are
2765 not in a subdirectory (e.g. in a bare repository), you
2766 can name which subdirectory to make the output relative
2767 to by giving a <path> as an argument.
2770 <dt class="hdlist1
">
2773 <dt class="hdlist1
">
2778 Treat all files as text.
2781 <dt class="hdlist1
">
2782 --ignore-space-at-eol
2786 Ignore changes in whitespace at EOL.
2789 <dt class="hdlist1
">
2792 <dt class="hdlist1
">
2793 --ignore-space-change
2797 Ignore changes in amount of whitespace. This ignores whitespace
2798 at line end, and considers all other sequences of one or
2799 more whitespace characters to be equivalent.
2802 <dt class="hdlist1
">
2805 <dt class="hdlist1
">
2810 Ignore whitespace when comparing lines. This ignores
2811 differences even if one line has whitespace where the other
2815 <dt class="hdlist1
">
2816 --inter-hunk-context=<lines>
2820 Show the context between diff hunks, up to the specified number
2821 of lines, thereby fusing hunks that are close to each other.
2824 <dt class="hdlist1
">
2829 Make the program exit with codes similar to diff(1).
2830 That is, it exits with 1 if there were differences and
2831 0 means no differences.
2834 <dt class="hdlist1
">
2839 Disable all output of the program. Implies <tt>--exit-code</tt>.
2842 <dt class="hdlist1
">
2847 Allow an external diff helper to be executed. If you set an
2848 external diff driver with <a href="gitattributes.html
">gitattributes(5)</a>, you need
2849 to use this option with <a href="git-log.html
">git-log(1)</a> and friends.
2852 <dt class="hdlist1
">
2857 Disallow external diff drivers.
2860 <dt class="hdlist1
">
2863 <dt class="hdlist1
">
2868 Allow (or disallow) external text conversion filters to be run
2869 when comparing binary files. See <a href="gitattributes.html
">gitattributes(5)</a> for
2870 details. Because textconv filters are typically a one-way
2871 conversion, the resulting diff is suitable for human
2872 consumption, but cannot be applied. For this reason, textconv
2873 filters are enabled by default only for <a href="git-diff.html
">git-diff(1)</a> and
2874 <a href="git-log.html
">git-log(1)</a>, but not for <a href="git-format-patch.html
">git-format-patch(1)</a> or
2875 diff plumbing commands.
2878 <dt class="hdlist1
">
2879 --ignore-submodules[=<when>]
2883 Ignore changes to submodules in the diff generation. <when> can be
2884 either "none
", "untracked
", "dirty
" or "all
", which is the default
2885 Using "none
" will consider the submodule modified when it either contains
2886 untracked or modified files or its HEAD differs from the commit recorded
2887 in the superproject and can be used to override any settings of the
2888 <em>ignore</em> option in <a href="git-config.html
">git-config(1)</a> or <a href="gitmodules.html
">gitmodules(5)</a>. When
2889 "untracked
" is used submodules are not considered dirty when they only
2890 contain untracked content (but they are still scanned for modified
2891 content). Using "dirty
" ignores all changes to the work tree of submodules,
2892 only changes to the commits stored in the superproject are shown (this was
2893 the behavior until 1.7.0). Using "all
" hides all changes to submodules.
2896 <dt class="hdlist1
">
2897 --src-prefix=<prefix>
2901 Show the given source prefix instead of "a/
".
2904 <dt class="hdlist1
">
2905 --dst-prefix=<prefix>
2909 Show the given destination prefix instead of "b/
".
2912 <dt class="hdlist1
">
2917 Do not show any source or destination prefix.
2921 <div class="paragraph
"><p>For more detailed explanation on these common options, see also
2922 <a href="gitdiffcore.html
">gitdiffcore(7)</a>.</p></div>
2924 <h2 id="_generating_patches_with_p
">Generating patches with -p</h2>
2925 <div class="sectionbody
">
2926 <div class="paragraph
"><p>When "git-diff-index
", "git-diff-tree
", or "git-diff-files
" are run
2927 with a <em>-p</em> option, "git diff
" without the <em>--raw</em> option, or
2928 "git log
" with the "-p
" option, they
2929 do not produce the output described above; instead they produce a
2930 patch file. You can customize the creation of such patches via the
2931 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2932 <div class="paragraph
"><p>What the -p option produces is slightly different from the traditional
2933 diff format:</p></div>
2934 <div class="olist arabic
"><ol class="arabic
">
2937 It is preceded with a "git diff
" header that looks like this:
2939 <div class="literalblock
">
2940 <div class="content
">
2941 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2943 <div class="paragraph
"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2944 involved. Especially, even for a creation or a deletion,
2945 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2946 <div class="paragraph
"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2947 name of the source file of the rename/copy and the name of
2948 the file that rename/copy produces, respectively.</p></div>
2952 It is followed by one or more extended header lines:
2954 <div class="literalblock
">
2955 <div class="content
">
2956 <pre><tt>old mode <mode>
2957 new mode <mode>
2958 deleted file mode <mode>
2959 new file mode <mode>
2960 copy from <path>
2961 copy to <path>
2962 rename from <path>
2963 rename to <path>
2964 similarity index <number>
2965 dissimilarity index <number>
2966 index <hash>..<hash> <mode></tt></pre>
2968 <div class="paragraph
"><p>File modes are printed as 6-digit octal numbers including the file type
2969 and file permission bits.</p></div>
2970 <div class="paragraph
"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2971 <div class="paragraph
"><p>The similarity index is the percentage of unchanged lines, and
2972 the dissimilarity index is the percentage of changed lines. It
2973 is a rounded down integer, followed by a percent sign. The
2974 similarity index value of 100% is thus reserved for two equal
2975 files, while 100% dissimilarity means that no line from the old
2976 file made it into the new one.</p></div>
2977 <div class="paragraph
"><p>The index line includes the SHA-1 checksum before and after the change.
2978 The <mode> is included if the file mode does not change; otherwise,
2979 separate lines indicate the old and the new mode.</p></div>
2983 TAB, LF, double quote and backslash characters in pathnames
2984 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and
<tt>\\
</tt>, respectively.
2985 If there is need for such substitution then the whole
2986 pathname is put in double quotes.
2991 All the
<tt>file1
</tt> files in the output refer to files before the
2992 commit, and all the
<tt>file2
</tt> files refer to files after the commit.
2993 It is incorrect to apply each change to each file sequentially. For
2994 example, this patch will swap a and b:
2996 <div class=
"literalblock">
2997 <div class=
"content">
2998 <pre><tt>diff --git a/a b/b
3003 rename to a
</tt></pre>
3008 <h2 id=
"_combined_diff_format">combined diff format
</h2>
3009 <div class=
"sectionbody">
3010 <div class=
"paragraph"><p>Any diff-generating command can take the
‘-c` or
<tt>--cc
</tt> option to
3011 produce a
<em>combined diff
</em> when showing a merge. This is the default
3012 format when showing merges with
<a href=
"git-diff.html">git-diff(
1)
</a> or
3013 <a href=
"git-show.html">git-show(
1)
</a>. Note also that you can give the `-m
’ option to any
3014 of these commands to force generation of diffs with individual parents
3015 of a merge.
</p></div>
3016 <div class=
"paragraph"><p>A
<em>combined diff
</em> format looks like this:
</p></div>
3017 <div class=
"listingblock">
3018 <div class=
"content">
3019 <pre><tt>diff --combined describe.c
3020 index fabadb8,cc95eb0.
.4866510
3023 @@@ -
98,
20 -
98,
12 +
98,
20 @@@
3024 return (a_date
> b_date) ? -
1 : (a_date == b_date) ?
0 :
1;
3027 - static void describe(char *arg)
3028 -static void describe(struct commit *cmit, int last_one)
3029 ++static void describe(char *arg, int last_one)
3031 + unsigned char sha1[
20];
3032 + struct commit *cmit;
3033 struct commit_list *list;
3034 static int initialized =
0;
3035 struct commit_name *n;
3037 + if (get_sha1(arg, sha1)
< 0)
3038 + usage(describe_usage);
3039 + cmit = lookup_commit_reference(sha1);
3041 + usage(describe_usage);
3045 for_each_ref(get_name);
</tt></pre>
3047 <div class=
"olist arabic"><ol class=
"arabic">
3050 It is preceded with a
"git diff" header, that looks like
3051 this (when
<em>-c
</em> option is used):
3053 <div class=
"literalblock">
3054 <div class=
"content">
3055 <pre><tt>diff --combined file
</tt></pre>
3057 <div class=
"paragraph"><p>or like this (when
<em>--cc
</em> option is used):
</p></div>
3058 <div class=
"literalblock">
3059 <div class=
"content">
3060 <pre><tt>diff --cc file
</tt></pre>
3065 It is followed by one or more extended header lines
3066 (this example shows a merge with two parents):
3068 <div class=
"literalblock">
3069 <div class=
"content">
3070 <pre><tt>index
<hash
>,
<hash
>..
<hash
>
3071 mode
<mode
>,
<mode
>..
<mode
>
3072 new file mode
<mode
>
3073 deleted file mode
<mode
>,
<mode
></tt></pre>
3075 <div class=
"paragraph"><p>The
<tt>mode
<mode
>,
<mode
>..
<mode
></tt> line appears only if at least one of
3076 the
<mode
> is different from the rest. Extended headers with
3077 information about detected contents movement (renames and
3078 copying detection) are designed to work with diff of two
3079 <tree-ish
> and are not used by combined diff format.
</p></div>
3083 It is followed by two-line from-file/to-file header
3085 <div class=
"literalblock">
3086 <div class=
"content">
3088 +++ b/file
</tt></pre>
3090 <div class=
"paragraph"><p>Similar to two-line header for traditional
<em>unified
</em> diff
3091 format,
<tt>/dev/null
</tt> is used to signal created or deleted
3096 Chunk header format is modified to prevent people from
3097 accidentally feeding it to
<tt>patch -p1
</tt>. Combined diff format
3098 was created for review of merge commit changes, and was not
3099 meant for apply. The change is similar to the change in the
3100 extended
<em>index
</em> header:
3102 <div class=
"literalblock">
3103 <div class=
"content">
3104 <pre><tt>@@@
<from-file-range
> <from-file-range
> <to-file-range
> @@@
</tt></pre>
3106 <div class=
"paragraph"><p>There are (number of parents +
1)
<tt>@
</tt> characters in the chunk
3107 header for combined diff format.
</p></div>
3110 <div class=
"paragraph"><p>Unlike the traditional
<em>unified
</em> diff format, which shows two
3111 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
3112 added to B), or
<tt>" "</tt> (space
 — unchanged) prefix, this format
3113 compares two or more files file1, file2,
… with one file X, and
3114 shows how X differs from each of fileN. One column for each of
3115 fileN is prepended to the output line to note how X
’s line is
3116 different from it.
</p></div>
3117 <div class=
"paragraph"><p>A
<tt>-
</tt> character in the column N means that the line appears in
3118 fileN but it does not appear in the result. A
<tt>+
</tt> character
3119 in the column N means that the line appears in the result,
3120 and fileN does not have that line (in other words, the line was
3121 added, from the point of view of that parent).
</p></div>
3122 <div class=
"paragraph"><p>In the above example output, the function signature was changed
3123 from both files (hence two
<tt>-
</tt> removals from both file1 and
3124 file2, plus
<tt>++
</tt> to mean one line that was added does not appear
3125 in either file1 nor file2). Also eight other lines are the same
3126 from file1 but do not appear in file2 (hence prefixed with
<tt>+</tt>).
</p></div>
3127 <div class=
"paragraph"><p>When shown by
<tt>git diff-tree -c
</tt>, it compares the parents of a
3128 merge commit with the merge result (i.e. file1..fileN are the
3129 parents). When shown by
<tt>git diff-files -c
</tt>, it compares the
3130 two unresolved merge parents with the working tree file
3131 (i.e. file1 is stage
2 aka
"our version", file2 is stage
3 aka
3132 "their version").
</p></div>
3134 <h2 id=
"_examples">Examples
</h2>
3135 <div class=
"sectionbody">
3136 <div class=
"dlist"><dl>
3137 <dt class=
"hdlist1">
3138 <tt>git log --no-merges
</tt>
3142 Show the whole commit history, but skip any merges
3145 <dt class=
"hdlist1">
3146 <tt>git log v2.6
.12.. include/scsi drivers/scsi
</tt>
3150 Show all commits since version
<em>v2.6
.12</em> that changed any file
3151 in the include/scsi or drivers/scsi subdirectories
3154 <dt class=
"hdlist1">
3155 <tt>git log
--since=
"2 weeks ago" -- gitk
</tt>
3159 Show the changes during the last two weeks to the file
<em>gitk
</em>.
3160 The
"--" is necessary to avoid confusion with the
<strong>branch
</strong> named
3164 <dt class=
"hdlist1">
3165 <tt>git log --name-status release..test
</tt>
3169 Show the commits that are in the
"test" branch but not yet
3170 in the
"release" branch, along with the list of paths
3171 each commit modifies.
3174 <dt class=
"hdlist1">
3175 <tt>git log --follow builtin-rev-list.c
</tt>
3179 Shows the commits that changed builtin-rev-list.c, including
3180 those commits that occurred before the file was given its
3184 <dt class=
"hdlist1">
3185 <tt>git log --branches --not --remotes=origin
</tt>
3189 Shows all commits that are in any of local branches but not in
3190 any of remote-tracking branches for
<em>origin
</em> (what you have that
3191 origin doesn
’t).
3194 <dt class=
"hdlist1">
3195 <tt>git log master --not --remotes=*/master
</tt>
3199 Shows all commits that are in local master but not in any remote
3200 repository master branches.
3203 <dt class=
"hdlist1">
3204 <tt>git log -p -m --first-parent
</tt>
3208 Shows the history including change diffs, but only from the
3209 "main branch" perspective, skipping commits that come from merged
3210 branches, and showing full diffs of changes introduced by the merges.
3211 This makes sense only when following a strict policy of merging all
3212 topic branches when staying on a single integration branch.
3217 <h2 id=
"_discussion">Discussion
</h2>
3218 <div class=
"sectionbody">
3219 <div class=
"paragraph"><p>At the core level, git is character encoding agnostic.
</p></div>
3220 <div class=
"ulist"><ul>
3223 The pathnames recorded in the index and in the tree objects
3224 are treated as uninterpreted sequences of non-NUL bytes.
3225 What readdir(
2) returns are what are recorded and compared
3226 with the data git keeps track of, which in turn are expected
3227 to be what lstat(
2) and creat(
2) accepts. There is no such
3228 thing as pathname encoding translation.
3233 The contents of the blob objects are uninterpreted sequences
3234 of bytes. There is no encoding translation at the core
3240 The commit log messages are uninterpreted sequences of non-NUL
3245 <div class=
"paragraph"><p>Although we encourage that the commit log messages are encoded
3246 in UTF-
8, both the core and git Porcelain are designed not to
3247 force UTF-
8 on projects. If all participants of a particular
3248 project find it more convenient to use legacy encodings, git
3249 does not forbid it. However, there are a few things to keep in
3251 <div class=
"olist arabic"><ol class=
"arabic">
3254 <em>git commit
</em> and
<em>git commit-tree
</em> issues
3255 a warning if the commit log message given to it does not look
3256 like a valid UTF-
8 string, unless you explicitly say your
3257 project uses a legacy encoding. The way to say this is to
3258 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
3260 <div class=
"listingblock">
3261 <div class=
"content">
3263 commitencoding = ISO-
8859-
1</tt></pre>
3265 <div class=
"paragraph"><p>Commit objects created with the above setting record the value
3266 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
3267 help other people who look at them later. Lack of this header
3268 implies that the commit log message is encoded in UTF-
8.
</p></div>
3272 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
3273 <tt>encoding
</tt> header of a commit object, and try to re-code the
3274 log message into UTF-
8 unless otherwise specified. You can
3275 specify the desired output encoding with
3276 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
3278 <div class=
"listingblock">
3279 <div class=
"content">
3281 logoutputencoding = ISO-
8859-
1</tt></pre>
3283 <div class=
"paragraph"><p>If you do not have this configuration variable, the value of
3284 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
3287 <div class=
"paragraph"><p>Note that we deliberately chose not to re-code the commit log
3288 message when a commit is made to force UTF-
8 at the commit
3289 object level, because re-coding to UTF-
8 is not necessarily a
3290 reversible operation.
</p></div>
3292 <h2 id=
"_configuration">Configuration
</h2>
3293 <div class=
"sectionbody">
3294 <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>
3295 for settings related to diff generation.
</p></div>
3296 <div class=
"dlist"><dl>
3297 <dt class=
"hdlist1">
3302 Default for the
<tt>--format
</tt> option. (See
"PRETTY FORMATS" above.)
3303 Defaults to
"medium".
3306 <dt class=
"hdlist1">
3307 i18n.logOutputEncoding
3311 Encoding to use when displaying logs. (See
"Discussion", above.)
3312 Defaults to the value of
<tt>i18n.commitEncoding
</tt> if set, UTF-
8
3316 <dt class=
"hdlist1">
3321 Default format for human-readable dates. (Compare the
3322 <tt>--date
</tt> option.) Defaults to
"default", which means to write
3323 dates like
<tt>Sat May
8 19:
35:
34 2010 -
0500</tt>.
3326 <dt class=
"hdlist1">
3331 If
<tt>false
</tt>,
<em>git log
</em> and related commands will not treat the
3332 initial commit as a big creation event. Any root commits in
3333 <tt>git log -p
</tt> output would be shown without a diff attached.
3334 The default is
<tt>true
</tt>.
3337 <dt class=
"hdlist1">
3342 See
<a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
3345 <dt class=
"hdlist1">
3350 Which refs, in addition to the default set by
<tt>core.notesRef
</tt>
3351 or
<em>GIT_NOTES_REF
</em>, to read notes from when showing commit
3352 messages with the
<em>log
</em> family of commands. See
3353 <a href=
"git-notes.html">git-notes(
1)
</a>.
3355 <div class=
"paragraph"><p>May be an unabbreviated ref name or a glob and may be specified
3356 multiple times. A warning will be issued for refs that do not exist,
3357 but a glob that does not match any refs is silently ignored.
</p></div>
3358 <div class=
"paragraph"><p>This setting can be disabled by the
<tt>--no-notes
</tt> option,
3359 overridden by the
<em>GIT_NOTES_DISPLAY_REF
</em> environment variable,
3360 and overridden by the
<tt>--notes=
<ref
></tt> option.
</p></div>
3364 <h2 id=
"_git">GIT
</h2>
3365 <div class=
"sectionbody">
3366 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
3369 <div id=
"footnotes"><hr /></div>
3371 <div id=
"footer-text">
3372 Last updated
2011-
09-
21 23:
01:
14 PDT