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 Spend extra time to make sure the smallest possible
2247 <dt class=
"hdlist1">
2252 Generate a diff using the
"patience diff" algorithm.
2255 <dt class=
"hdlist1">
2256 --stat[=
<width
>[,
<name-width
>[,
<count
>]]]
2260 Generate a diffstat. You can override the default
2261 output width for
80-column terminal by
<tt>--stat=
<width
></tt>.
2262 The width of the filename part can be controlled by
2263 giving another width to it separated by a comma.
2264 By giving a third parameter
<tt><count
></tt>, you can limit the
2265 output to the first
<tt><count
></tt> lines, followed by
2266 <tt>…</tt> if there are more.
2268 <div class=
"paragraph"><p>These parameters can also be set individually with
<tt>--stat-width=
<width
></tt>,
2269 <tt>--stat-name-width=
<name-width
></tt> and
<tt>--stat-count=
<count
></tt>.
</p></div>
2271 <dt class=
"hdlist1">
2276 Similar to
<tt>--stat
</tt>, but shows number of added and
2277 deleted lines in decimal notation and pathname without
2278 abbreviation, to make it more machine friendly. For
2279 binary files, outputs two
<tt>-
</tt> instead of saying
2283 <dt class=
"hdlist1">
2288 Output only the last line of the
<tt>--stat
</tt> format containing total
2289 number of modified files, as well as number of added and deleted
2293 <dt class=
"hdlist1">
2294 --dirstat[=
<param1,param2,
…>]
2298 Output the distribution of relative amount of changes for each
2299 sub-directory. The behavior of
<tt>--dirstat
</tt> can be customized by
2300 passing it a comma separated list of parameters.
2301 The defaults are controlled by the
<tt>diff.dirstat
</tt> configuration
2302 variable (see
<a href=
"git-config.html">git-config(
1)
</a>).
2303 The following parameters are available:
2305 <div class=
"dlist"><dl>
2306 <dt class=
"hdlist1">
2311 Compute the dirstat numbers by counting the lines that have been
2312 removed from the source, or added to the destination. This ignores
2313 the amount of pure code movements within a file. In other words,
2314 rearranging lines in a file is not counted as much as other changes.
2315 This is the default behavior when no parameter is given.
2318 <dt class=
"hdlist1">
2323 Compute the dirstat numbers by doing the regular line-based diff
2324 analysis, and summing the removed/added line counts. (For binary
2325 files, count
64-byte chunks instead, since binary files have no
2326 natural concept of lines). This is a more expensive
<tt>--dirstat
</tt>
2327 behavior than the
<tt>changes
</tt> behavior, but it does count rearranged
2328 lines within a file as much as other changes. The resulting output
2329 is consistent with what you get from the other
<tt>--*stat
</tt> options.
2332 <dt class=
"hdlist1">
2337 Compute the dirstat numbers by counting the number of files changed.
2338 Each changed file counts equally in the dirstat analysis. This is
2339 the computationally cheapest
<tt>--dirstat
</tt> behavior, since it does
2340 not have to look at the file contents at all.
2343 <dt class=
"hdlist1">
2348 Count changes in a child directory for the parent directory as well.
2349 Note that when using
<tt>cumulative
</tt>, the sum of the percentages
2350 reported may exceed
100%. The default (non-cumulative) behavior can
2351 be specified with the
<tt>noncumulative
</tt> parameter.
2354 <dt class=
"hdlist1">
2359 An integer parameter specifies a cut-off percent (
3% by default).
2360 Directories contributing less than this percentage of the changes
2361 are not shown in the output.
2365 <div class=
"paragraph"><p>Example: The following will count changed files, while ignoring
2366 directories with less than
10% of the total amount of changed files,
2367 and accumulating child directory counts in the parent directories:
2368 <tt>--dirstat=files,
10,cumulative
</tt>.
</p></div>
2370 <dt class=
"hdlist1">
2375 Output a condensed summary of extended header information
2376 such as creations, renames and mode changes.
2379 <dt class=
"hdlist1">
2384 Synonym for
<tt>-p --stat
</tt>.
2387 <dt class=
"hdlist1">
2392 Separate the commits with NULs instead of with new newlines.
2394 <div class=
"paragraph"><p>Also, when
<tt>--raw
</tt> or
<tt>--numstat
</tt> has been given, do not munge
2395 pathnames and use NULs as output field terminators.
</p></div>
2396 <div class=
"paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
2397 and backslash characters replaced with
<tt>\t
</tt>,
<tt>\n
</tt>,
<tt>\
"</tt>, and <tt>\\</tt>,
2398 respectively, and the pathname will be enclosed in double quotes if
2399 any of those replacements occurred.</p></div>
2401 <dt class="hdlist1
">
2406 Show only names of changed files.
2409 <dt class="hdlist1
">
2414 Show only names and status of changed files. See the description
2415 of the <tt>--diff-filter</tt> option on what the status letters mean.
2418 <dt class="hdlist1
">
2419 --submodule[=<format>]
2423 Chose the output format for submodule differences. <format> can be one of
2424 <em>short</em> and <em>log</em>. <em>short</em> just shows pairs of commit names, this format
2425 is used when this option is not given. <em>log</em> is the default value for this
2426 option and lists the commits in that commit range like the <em>summary</em>
2427 option of <a href="git-submodule.html
">git-submodule(1)</a> does.
2430 <dt class="hdlist1
">
2431 --color[=<when>]
2436 The value must be <tt>always</tt> (the default for <tt><when></tt>), <tt>never</tt>, or <tt>auto</tt>.
2437 The default value is <tt>never</tt>.
2440 <dt class="hdlist1
">
2445 Turn off colored diff.
2446 It is the same as <tt>--color=never</tt>.
2449 <dt class="hdlist1
">
2450 --word-diff[=<mode>]
2454 Show a word diff, using the <mode> to delimit changed words.
2455 By default, words are delimited by whitespace; see
2456 <tt>--word-diff-regex</tt> below. The <mode> defaults to <em>plain</em>, and
2459 <div class="dlist
"><dl>
2460 <dt class="hdlist1
">
2465 Highlight changed words using only colors. Implies <tt>--color</tt>.
2468 <dt class="hdlist1
">
2473 Show words as <tt>[-removed-]</tt> and <tt>{<tt>added</tt>}</tt>. Makes no
2474 attempts to escape the delimiters if they appear in the input,
2475 so the output may be ambiguous.
2478 <dt class="hdlist1
">
2483 Use a special line-based format intended for script
2484 consumption. Added/removed/unchanged runs are printed in the
2485 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
2486 character at the beginning of the line and extending to the
2487 end of the line. Newlines in the input are represented by a
2488 tilde <tt>~</tt> on a line of its own.
2491 <dt class="hdlist1
">
2496 Disable word diff again.
2500 <div class="paragraph
"><p>Note that despite the name of the first mode, color is used to
2501 highlight the changed parts in all modes if enabled.</p></div>
2503 <dt class="hdlist1
">
2504 --word-diff-regex=<regex>
2508 Use <regex> to decide what a word is, instead of considering
2509 runs of non-whitespace to be a word. Also implies
2510 <tt>--word-diff</tt> unless it was already enabled.
2512 <div class="paragraph
"><p>Every non-overlapping match of the
2513 <regex> is considered a word. Anything between these matches is
2514 considered whitespace and ignored(!) for the purposes of finding
2515 differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
2516 expression to make sure that it matches all non-whitespace characters.
2517 A match that contains a newline is silently truncated(!) at the
2519 <div class="paragraph
"><p>The regex can also be set via a diff driver or configuration option, see
2520 <a href="gitattributes.html
">gitattributes(1)</a> or <a href="git-config.html
">git-config(1)</a>. Giving it explicitly
2521 overrides any diff driver or configuration setting. Diff drivers
2522 override configuration settings.</p></div>
2524 <dt class="hdlist1
">
2525 --color-words[=<regex>]
2529 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
2530 specified) <tt>--word-diff-regex=<regex></tt>.
2533 <dt class="hdlist1
">
2538 Turn off rename detection, even when the configuration
2539 file gives the default to do so.
2542 <dt class="hdlist1
">
2547 Warn if changes introduce whitespace errors. What are
2548 considered whitespace errors is controlled by <tt>core.whitespace</tt>
2549 configuration. By default, trailing whitespaces (including
2550 lines that solely consist of whitespaces) and a space character
2551 that is immediately followed by a tab character inside the
2552 initial indent of the line are considered whitespace errors.
2553 Exits with non-zero status if problems are found. Not compatible
2557 <dt class="hdlist1
">
2562 Instead of the first handful of characters, show the full
2563 pre- and post-image blob object names on the "index
"
2564 line when generating patch format output.
2567 <dt class="hdlist1
">
2572 In addition to <tt>--full-index</tt>, output a binary diff that
2573 can be applied with <tt>git-apply</tt>.
2576 <dt class="hdlist1
">
2577 --abbrev[=<n>]
2581 Instead of showing the full 40-byte hexadecimal object
2582 name in diff-raw format output and diff-tree header
2583 lines, show only a partial prefix. This is
2584 independent of the <tt>--full-index</tt> option above, which controls
2585 the diff-patch output format. Non default number of
2586 digits can be specified with <tt>--abbrev=<n></tt>.
2589 <dt class="hdlist1
">
2590 -B[<n>][/<m>]
2592 <dt class="hdlist1
">
2593 --break-rewrites[=[<n>][/<m>]]
2597 Break complete rewrite changes into pairs of delete and
2598 create. This serves two purposes:
2600 <div class="paragraph
"><p>It affects the way a change that amounts to a total rewrite of a file
2601 not as a series of deletion and insertion mixed together with a very
2602 few lines that happen to match textually as the context, but as a
2603 single deletion of everything old followed by a single insertion of
2604 everything new, and the number <tt>m</tt> controls this aspect of the -B
2605 option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
2606 original should remain in the result for git to consider it a total
2607 rewrite (i.e. otherwise the resulting patch will be a series of
2608 deletion and insertion mixed together with context lines).</p></div>
2609 <div class="paragraph
"><p>When used with -M, a totally-rewritten file is also considered as the
2610 source of a rename (usually -M only considers a file that disappeared
2611 as the source of a rename), and the number <tt>n</tt> controls this aspect of
2612 the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
2613 addition and deletion compared to 20% or more of the file’s size are
2614 eligible for being picked up as a possible source of a rename to
2615 another file.</p></div>
2617 <dt class="hdlist1
">
2620 <dt class="hdlist1
">
2621 --find-renames[=<n>]
2625 If generating diffs, detect and report renames for each commit.
2626 For following files across renames while traversing history, see
2628 If <tt>n</tt> is specified, it is a threshold on the similarity
2629 index (i.e. amount of addition/deletions compared to the
2630 file’s size). For example, <tt>-M90%</tt> means git should consider a
2631 delete/add pair to be a rename if more than 90% of the file
2632 hasn’t changed.
2635 <dt class="hdlist1
">
2638 <dt class="hdlist1
">
2639 --find-copies[=<n>]
2643 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
2644 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M<n></tt>.
2647 <dt class="hdlist1
">
2648 --find-copies-harder
2652 For performance reasons, by default, <tt>-C</tt> option finds copies only
2653 if the original file of the copy was modified in the same
2654 changeset. This flag makes the command
2655 inspect unmodified files as candidates for the source of
2656 copy. This is a very expensive operation for large
2657 projects, so use it with caution. Giving more than one
2658 <tt>-C</tt> option has the same effect.
2661 <dt class="hdlist1
">
2664 <dt class="hdlist1
">
2665 --irreversible-delete
2669 Omit the preimage for deletes, i.e. print only the header but not
2670 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
2671 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
2672 solely for people who want to just concentrate on reviewing the
2673 text after the change. In addition, the output obviously lack
2674 enough information to apply such a patch in reverse, even manually,
2675 hence the name of the option.
2677 <div class="paragraph
"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
2678 of a delete/create pair.</p></div>
2680 <dt class="hdlist1
">
2685 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
2686 is the number of potential rename/copy targets. This
2687 option prevents rename/copy detection from running if
2688 the number of rename/copy targets exceeds the specified
2692 <dt class="hdlist1
">
2693 --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]]
2697 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
2698 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
2699 type (i.e. regular file, symlink, submodule, …) changed (<tt>T</tt>),
2700 are Unmerged (<tt>U</tt>), are
2701 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
2702 Any combination of the filter characters (including none) can be used.
2703 When <tt>*</tt> (All-or-none) is added to the combination, all
2704 paths are selected if there is any file that matches
2705 other criteria in the comparison; if there is no file
2706 that matches other criteria, nothing is selected.
2709 <dt class="hdlist1
">
2714 Look for differences that introduce or remove an instance of
2715 <string>. Note that this is different than the string simply
2716 appearing in diff output; see the <em>pickaxe</em> entry in
2717 <a href="gitdiffcore.html
">gitdiffcore(7)</a> for more details.
2720 <dt class="hdlist1
">
2725 Look for differences whose added or removed line matches
2726 the given <regex>.
2729 <dt class="hdlist1
">
2734 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
2735 changeset, not just the files that contain the change
2739 <dt class="hdlist1
">
2744 Make the <string> not a plain string but an extended POSIX
2748 <dt class="hdlist1
">
2753 Output the patch in the order specified in the
2754 <orderfile>, which has one shell glob pattern per line.
2757 <dt class="hdlist1
">
2762 Swap two inputs; that is, show differences from index or
2763 on-disk file to tree contents.
2766 <dt class="hdlist1
">
2767 --relative[=<path>]
2771 When run from a subdirectory of the project, it can be
2772 told to exclude changes outside the directory and show
2773 pathnames relative to it with this option. When you are
2774 not in a subdirectory (e.g. in a bare repository), you
2775 can name which subdirectory to make the output relative
2776 to by giving a <path> as an argument.
2779 <dt class="hdlist1
">
2782 <dt class="hdlist1
">
2787 Treat all files as text.
2790 <dt class="hdlist1
">
2791 --ignore-space-at-eol
2795 Ignore changes in whitespace at EOL.
2798 <dt class="hdlist1
">
2801 <dt class="hdlist1
">
2802 --ignore-space-change
2806 Ignore changes in amount of whitespace. This ignores whitespace
2807 at line end, and considers all other sequences of one or
2808 more whitespace characters to be equivalent.
2811 <dt class="hdlist1
">
2814 <dt class="hdlist1
">
2819 Ignore whitespace when comparing lines. This ignores
2820 differences even if one line has whitespace where the other
2824 <dt class="hdlist1
">
2825 --inter-hunk-context=<lines>
2829 Show the context between diff hunks, up to the specified number
2830 of lines, thereby fusing hunks that are close to each other.
2833 <dt class="hdlist1
">
2838 Make the program exit with codes similar to diff(1).
2839 That is, it exits with 1 if there were differences and
2840 0 means no differences.
2843 <dt class="hdlist1
">
2848 Disable all output of the program. Implies <tt>--exit-code</tt>.
2851 <dt class="hdlist1
">
2856 Allow an external diff helper to be executed. If you set an
2857 external diff driver with <a href="gitattributes.html
">gitattributes(5)</a>, you need
2858 to use this option with <a href="git-log.html
">git-log(1)</a> and friends.
2861 <dt class="hdlist1
">
2866 Disallow external diff drivers.
2869 <dt class="hdlist1
">
2872 <dt class="hdlist1
">
2877 Allow (or disallow) external text conversion filters to be run
2878 when comparing binary files. See <a href="gitattributes.html
">gitattributes(5)</a> for
2879 details. Because textconv filters are typically a one-way
2880 conversion, the resulting diff is suitable for human
2881 consumption, but cannot be applied. For this reason, textconv
2882 filters are enabled by default only for <a href="git-diff.html
">git-diff(1)</a> and
2883 <a href="git-log.html
">git-log(1)</a>, but not for <a href="git-format-patch.html
">git-format-patch(1)</a> or
2884 diff plumbing commands.
2887 <dt class="hdlist1
">
2888 --ignore-submodules[=<when>]
2892 Ignore changes to submodules in the diff generation. <when> can be
2893 either "none
", "untracked
", "dirty
" or "all
", which is the default
2894 Using "none
" will consider the submodule modified when it either contains
2895 untracked or modified files or its HEAD differs from the commit recorded
2896 in the superproject and can be used to override any settings of the
2897 <em>ignore</em> option in <a href="git-config.html
">git-config(1)</a> or <a href="gitmodules.html
">gitmodules(5)</a>. When
2898 "untracked
" is used submodules are not considered dirty when they only
2899 contain untracked content (but they are still scanned for modified
2900 content). Using "dirty
" ignores all changes to the work tree of submodules,
2901 only changes to the commits stored in the superproject are shown (this was
2902 the behavior until 1.7.0). Using "all
" hides all changes to submodules.
2905 <dt class="hdlist1
">
2906 --src-prefix=<prefix>
2910 Show the given source prefix instead of "a/
".
2913 <dt class="hdlist1
">
2914 --dst-prefix=<prefix>
2918 Show the given destination prefix instead of "b/
".
2921 <dt class="hdlist1
">
2926 Do not show any source or destination prefix.
2930 <div class="paragraph
"><p>For more detailed explanation on these common options, see also
2931 <a href="gitdiffcore.html
">gitdiffcore(7)</a>.</p></div>
2933 <h2 id="_generating_patches_with_p
">Generating patches with -p</h2>
2934 <div class="sectionbody
">
2935 <div class="paragraph
"><p>When "git-diff-index
", "git-diff-tree
", or "git-diff-files
" are run
2936 with a <em>-p</em> option, "git diff
" without the <em>--raw</em> option, or
2937 "git log
" with the "-p
" option, they
2938 do not produce the output described above; instead they produce a
2939 patch file. You can customize the creation of such patches via the
2940 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
2941 <div class="paragraph
"><p>What the -p option produces is slightly different from the traditional
2942 diff format:</p></div>
2943 <div class="olist arabic
"><ol class="arabic
">
2946 It is preceded with a "git diff
" header that looks like this:
2948 <div class="literalblock
">
2949 <div class="content
">
2950 <pre><tt>diff --git a/file1 b/file2</tt></pre>
2952 <div class="paragraph
"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
2953 involved. Especially, even for a creation or a deletion,
2954 <tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
2955 <div class="paragraph
"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
2956 name of the source file of the rename/copy and the name of
2957 the file that rename/copy produces, respectively.</p></div>
2961 It is followed by one or more extended header lines:
2963 <div class="literalblock
">
2964 <div class="content
">
2965 <pre><tt>old mode <mode>
2966 new mode <mode>
2967 deleted file mode <mode>
2968 new file mode <mode>
2969 copy from <path>
2970 copy to <path>
2971 rename from <path>
2972 rename to <path>
2973 similarity index <number>
2974 dissimilarity index <number>
2975 index <hash>..<hash> <mode></tt></pre>
2977 <div class="paragraph
"><p>File modes are printed as 6-digit octal numbers including the file type
2978 and file permission bits.</p></div>
2979 <div class="paragraph
"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
2980 <div class="paragraph
"><p>The similarity index is the percentage of unchanged lines, and
2981 the dissimilarity index is the percentage of changed lines. It
2982 is a rounded down integer, followed by a percent sign. The
2983 similarity index value of 100% is thus reserved for two equal
2984 files, while 100% dissimilarity means that no line from the old
2985 file made it into the new one.</p></div>
2986 <div class="paragraph
"><p>The index line includes the SHA-1 checksum before and after the change.
2987 The <mode> is included if the file mode does not change; otherwise,
2988 separate lines indicate the old and the new mode.</p></div>
2992 TAB, LF, double quote and backslash characters in pathnames
2993 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and
<tt>\\
</tt>, respectively.
2994 If there is need for such substitution then the whole
2995 pathname is put in double quotes.
3000 All the
<tt>file1
</tt> files in the output refer to files before the
3001 commit, and all the
<tt>file2
</tt> files refer to files after the commit.
3002 It is incorrect to apply each change to each file sequentially. For
3003 example, this patch will swap a and b:
3005 <div class=
"literalblock">
3006 <div class=
"content">
3007 <pre><tt>diff --git a/a b/b
3012 rename to a
</tt></pre>
3017 <h2 id=
"_combined_diff_format">combined diff format
</h2>
3018 <div class=
"sectionbody">
3019 <div class=
"paragraph"><p>Any diff-generating command can take the
‘-c` or
<tt>--cc
</tt> option to
3020 produce a
<em>combined diff
</em> when showing a merge. This is the default
3021 format when showing merges with
<a href=
"git-diff.html">git-diff(
1)
</a> or
3022 <a href=
"git-show.html">git-show(
1)
</a>. Note also that you can give the `-m
’ option to any
3023 of these commands to force generation of diffs with individual parents
3024 of a merge.
</p></div>
3025 <div class=
"paragraph"><p>A
<em>combined diff
</em> format looks like this:
</p></div>
3026 <div class=
"listingblock">
3027 <div class=
"content">
3028 <pre><tt>diff --combined describe.c
3029 index fabadb8,cc95eb0.
.4866510
3032 @@@ -
98,
20 -
98,
12 +
98,
20 @@@
3033 return (a_date
> b_date) ? -
1 : (a_date == b_date) ?
0 :
1;
3036 - static void describe(char *arg)
3037 -static void describe(struct commit *cmit, int last_one)
3038 ++static void describe(char *arg, int last_one)
3040 + unsigned char sha1[
20];
3041 + struct commit *cmit;
3042 struct commit_list *list;
3043 static int initialized =
0;
3044 struct commit_name *n;
3046 + if (get_sha1(arg, sha1)
< 0)
3047 + usage(describe_usage);
3048 + cmit = lookup_commit_reference(sha1);
3050 + usage(describe_usage);
3054 for_each_ref(get_name);
</tt></pre>
3056 <div class=
"olist arabic"><ol class=
"arabic">
3059 It is preceded with a
"git diff" header, that looks like
3060 this (when
<em>-c
</em> option is used):
3062 <div class=
"literalblock">
3063 <div class=
"content">
3064 <pre><tt>diff --combined file
</tt></pre>
3066 <div class=
"paragraph"><p>or like this (when
<em>--cc
</em> option is used):
</p></div>
3067 <div class=
"literalblock">
3068 <div class=
"content">
3069 <pre><tt>diff --cc file
</tt></pre>
3074 It is followed by one or more extended header lines
3075 (this example shows a merge with two parents):
3077 <div class=
"literalblock">
3078 <div class=
"content">
3079 <pre><tt>index
<hash
>,
<hash
>..
<hash
>
3080 mode
<mode
>,
<mode
>..
<mode
>
3081 new file mode
<mode
>
3082 deleted file mode
<mode
>,
<mode
></tt></pre>
3084 <div class=
"paragraph"><p>The
<tt>mode
<mode
>,
<mode
>..
<mode
></tt> line appears only if at least one of
3085 the
<mode
> is different from the rest. Extended headers with
3086 information about detected contents movement (renames and
3087 copying detection) are designed to work with diff of two
3088 <tree-ish
> and are not used by combined diff format.
</p></div>
3092 It is followed by two-line from-file/to-file header
3094 <div class=
"literalblock">
3095 <div class=
"content">
3097 +++ b/file
</tt></pre>
3099 <div class=
"paragraph"><p>Similar to two-line header for traditional
<em>unified
</em> diff
3100 format,
<tt>/dev/null
</tt> is used to signal created or deleted
3105 Chunk header format is modified to prevent people from
3106 accidentally feeding it to
<tt>patch -p1
</tt>. Combined diff format
3107 was created for review of merge commit changes, and was not
3108 meant for apply. The change is similar to the change in the
3109 extended
<em>index
</em> header:
3111 <div class=
"literalblock">
3112 <div class=
"content">
3113 <pre><tt>@@@
<from-file-range
> <from-file-range
> <to-file-range
> @@@
</tt></pre>
3115 <div class=
"paragraph"><p>There are (number of parents +
1)
<tt>@
</tt> characters in the chunk
3116 header for combined diff format.
</p></div>
3119 <div class=
"paragraph"><p>Unlike the traditional
<em>unified
</em> diff format, which shows two
3120 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
3121 added to B), or
<tt>" "</tt> (space
 — unchanged) prefix, this format
3122 compares two or more files file1, file2,
… with one file X, and
3123 shows how X differs from each of fileN. One column for each of
3124 fileN is prepended to the output line to note how X
’s line is
3125 different from it.
</p></div>
3126 <div class=
"paragraph"><p>A
<tt>-
</tt> character in the column N means that the line appears in
3127 fileN but it does not appear in the result. A
<tt>+
</tt> character
3128 in the column N means that the line appears in the result,
3129 and fileN does not have that line (in other words, the line was
3130 added, from the point of view of that parent).
</p></div>
3131 <div class=
"paragraph"><p>In the above example output, the function signature was changed
3132 from both files (hence two
<tt>-
</tt> removals from both file1 and
3133 file2, plus
<tt>++
</tt> to mean one line that was added does not appear
3134 in either file1 nor file2). Also eight other lines are the same
3135 from file1 but do not appear in file2 (hence prefixed with
<tt>+</tt>).
</p></div>
3136 <div class=
"paragraph"><p>When shown by
<tt>git diff-tree -c
</tt>, it compares the parents of a
3137 merge commit with the merge result (i.e. file1..fileN are the
3138 parents). When shown by
<tt>git diff-files -c
</tt>, it compares the
3139 two unresolved merge parents with the working tree file
3140 (i.e. file1 is stage
2 aka
"our version", file2 is stage
3 aka
3141 "their version").
</p></div>
3143 <h2 id=
"_examples">Examples
</h2>
3144 <div class=
"sectionbody">
3145 <div class=
"dlist"><dl>
3146 <dt class=
"hdlist1">
3147 <tt>git log --no-merges
</tt>
3151 Show the whole commit history, but skip any merges
3154 <dt class=
"hdlist1">
3155 <tt>git log v2.6
.12.. include/scsi drivers/scsi
</tt>
3159 Show all commits since version
<em>v2.6
.12</em> that changed any file
3160 in the include/scsi or drivers/scsi subdirectories
3163 <dt class=
"hdlist1">
3164 <tt>git log
--since=
"2 weeks ago" -- gitk
</tt>
3168 Show the changes during the last two weeks to the file
<em>gitk
</em>.
3169 The
"--" is necessary to avoid confusion with the
<strong>branch
</strong> named
3173 <dt class=
"hdlist1">
3174 <tt>git log --name-status release..test
</tt>
3178 Show the commits that are in the
"test" branch but not yet
3179 in the
"release" branch, along with the list of paths
3180 each commit modifies.
3183 <dt class=
"hdlist1">
3184 <tt>git log --follow builtin-rev-list.c
</tt>
3188 Shows the commits that changed builtin-rev-list.c, including
3189 those commits that occurred before the file was given its
3193 <dt class=
"hdlist1">
3194 <tt>git log --branches --not --remotes=origin
</tt>
3198 Shows all commits that are in any of local branches but not in
3199 any of remote-tracking branches for
<em>origin
</em> (what you have that
3200 origin doesn
’t).
3203 <dt class=
"hdlist1">
3204 <tt>git log master --not --remotes=*/master
</tt>
3208 Shows all commits that are in local master but not in any remote
3209 repository master branches.
3212 <dt class=
"hdlist1">
3213 <tt>git log -p -m --first-parent
</tt>
3217 Shows the history including change diffs, but only from the
3218 "main branch" perspective, skipping commits that come from merged
3219 branches, and showing full diffs of changes introduced by the merges.
3220 This makes sense only when following a strict policy of merging all
3221 topic branches when staying on a single integration branch.
3226 <h2 id=
"_discussion">Discussion
</h2>
3227 <div class=
"sectionbody">
3228 <div class=
"paragraph"><p>At the core level, git is character encoding agnostic.
</p></div>
3229 <div class=
"ulist"><ul>
3232 The pathnames recorded in the index and in the tree objects
3233 are treated as uninterpreted sequences of non-NUL bytes.
3234 What readdir(
2) returns are what are recorded and compared
3235 with the data git keeps track of, which in turn are expected
3236 to be what lstat(
2) and creat(
2) accepts. There is no such
3237 thing as pathname encoding translation.
3242 The contents of the blob objects are uninterpreted sequences
3243 of bytes. There is no encoding translation at the core
3249 The commit log messages are uninterpreted sequences of non-NUL
3254 <div class=
"paragraph"><p>Although we encourage that the commit log messages are encoded
3255 in UTF-
8, both the core and git Porcelain are designed not to
3256 force UTF-
8 on projects. If all participants of a particular
3257 project find it more convenient to use legacy encodings, git
3258 does not forbid it. However, there are a few things to keep in
3260 <div class=
"olist arabic"><ol class=
"arabic">
3263 <em>git commit
</em> and
<em>git commit-tree
</em> issues
3264 a warning if the commit log message given to it does not look
3265 like a valid UTF-
8 string, unless you explicitly say your
3266 project uses a legacy encoding. The way to say this is to
3267 have i18n.commitencoding in
<tt>.git/config
</tt> file, like this:
3269 <div class=
"listingblock">
3270 <div class=
"content">
3272 commitencoding = ISO-
8859-
1</tt></pre>
3274 <div class=
"paragraph"><p>Commit objects created with the above setting record the value
3275 of
<tt>i18n.commitencoding
</tt> in its
<tt>encoding
</tt> header. This is to
3276 help other people who look at them later. Lack of this header
3277 implies that the commit log message is encoded in UTF-
8.
</p></div>
3281 <em>git log
</em>,
<em>git show
</em>,
<em>git blame
</em> and friends look at the
3282 <tt>encoding
</tt> header of a commit object, and try to re-code the
3283 log message into UTF-
8 unless otherwise specified. You can
3284 specify the desired output encoding with
3285 <tt>i18n.logoutputencoding
</tt> in
<tt>.git/config
</tt> file, like this:
3287 <div class=
"listingblock">
3288 <div class=
"content">
3290 logoutputencoding = ISO-
8859-
1</tt></pre>
3292 <div class=
"paragraph"><p>If you do not have this configuration variable, the value of
3293 <tt>i18n.commitencoding
</tt> is used instead.
</p></div>
3296 <div class=
"paragraph"><p>Note that we deliberately chose not to re-code the commit log
3297 message when a commit is made to force UTF-
8 at the commit
3298 object level, because re-coding to UTF-
8 is not necessarily a
3299 reversible operation.
</p></div>
3301 <h2 id=
"_configuration">Configuration
</h2>
3302 <div class=
"sectionbody">
3303 <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>
3304 for settings related to diff generation.
</p></div>
3305 <div class=
"dlist"><dl>
3306 <dt class=
"hdlist1">
3311 Default for the
<tt>--format
</tt> option. (See
"PRETTY FORMATS" above.)
3312 Defaults to
"medium".
3315 <dt class=
"hdlist1">
3316 i18n.logOutputEncoding
3320 Encoding to use when displaying logs. (See
"Discussion", above.)
3321 Defaults to the value of
<tt>i18n.commitEncoding
</tt> if set, UTF-
8
3325 <dt class=
"hdlist1">
3330 Default format for human-readable dates. (Compare the
3331 <tt>--date
</tt> option.) Defaults to
"default", which means to write
3332 dates like
<tt>Sat May
8 19:
35:
34 2010 -
0500</tt>.
3335 <dt class=
"hdlist1">
3340 If
<tt>false
</tt>,
<em>git log
</em> and related commands will not treat the
3341 initial commit as a big creation event. Any root commits in
3342 <tt>git log -p
</tt> output would be shown without a diff attached.
3343 The default is
<tt>true
</tt>.
3346 <dt class=
"hdlist1">
3351 See
<a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
3354 <dt class=
"hdlist1">
3359 Which refs, in addition to the default set by
<tt>core.notesRef
</tt>
3360 or
<em>GIT_NOTES_REF
</em>, to read notes from when showing commit
3361 messages with the
<em>log
</em> family of commands. See
3362 <a href=
"git-notes.html">git-notes(
1)
</a>.
3364 <div class=
"paragraph"><p>May be an unabbreviated ref name or a glob and may be specified
3365 multiple times. A warning will be issued for refs that do not exist,
3366 but a glob that does not match any refs is silently ignored.
</p></div>
3367 <div class=
"paragraph"><p>This setting can be disabled by the
<tt>--no-notes
</tt> option,
3368 overridden by the
<em>GIT_NOTES_DISPLAY_REF
</em> environment variable,
3369 and overridden by the
<tt>--notes=
<ref
></tt> option.
</p></div>
3373 <h2 id=
"_git">GIT
</h2>
3374 <div class=
"sectionbody">
3375 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
3378 <div id=
"footnotes"><hr /></div>
3380 <div id=
"footer-text">
3381 Last updated
2011-
09-
21 23:
01:
14 PDT