1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
6 <meta http-equiv=
"Content-Type" content=
"application/xhtml+xml; charset=UTF-8" />
7 <meta name=
"generator" content=
"AsciiDoc 10.2.0" />
8 <title>git-diff-tree(
1)
</title>
9 <style type=
"text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.5em;
129 margin-bottom:
1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
228 div.imageblock div.content { padding-left:
0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size:
2em; }
411 span.small { font-size:
0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
443 div.tableblock
> table[
frame=
"hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock
> table[
frame=
"vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
480 border-color: #
527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-top {
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September
2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September
2006. License: GPL */
559 /* modified by Stuart Rackham,
2006,
2009. License: GPL */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([
1-'+(toclevels+
1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType ==
1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute(
"class") || i.getAttribute(
"className")) !=
"float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[
1]-
1);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
610 for (i =
0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute(
"class")
614 && entry.getAttribute(
"class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i =
0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById(
"content"), toclevels);
623 for (var i =
0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id ==
"")
626 entry.element.id =
"_toc_" + i;
627 var a = document.createElement(
"a");
628 a.href =
"#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement(
"div");
632 div.className =
"toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length ==
0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/
2005/
07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
651 var noteholder = document.getElementById(
"footnotes");
655 var entriesToRemove = [];
656 for (i =
0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute(
"class") ==
"footnote")
659 entriesToRemove.push(entry);
661 for (i =
0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById(
"content");
667 var spans = cont.getElementsByTagName(
"span");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-note");
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[
1];
679 "[<a id='_footnoteref_" + n +
"' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n +
"</a>]";
681 spans[i].setAttribute(
"data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n +
"'>" +
685 "<a href='#_footnoteref_" + n +
"' title='Return to text'>" +
686 n +
"</a>. " + note +
"</div>";
687 var id =spans[i].getAttribute(
"id");
688 if (id != null) refs[
"#"+id] = n;
692 noteholder.parentNode.removeChild(noteholder);
694 // Process footnoterefs.
695 for (i=
0; i
<spans.length; i++) {
696 if (spans[i].className ==
"footnoteref") {
697 var href = spans[i].getElementsByTagName(
"a")[
0].getAttribute(
"href");
698 href = href.match(/#.*/)[
0]; // Because IE return full URL.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-diff-tree(
1) Manual Page
741 <div class=
"sectionbody">
743 Compares the content and mode of blobs found via two tree objects
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"verseblock">
752 <pre class=
"content"><em>git diff-tree
</em> [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
753 [-t] [-r] [-c | --cc] [--combined-all-paths] [--root] [--merge-base]
754 [
<common-diff-options
>]
<tree-ish
> [
<tree-ish
>] [
<path
>…]
</pre>
755 <div class=
"attribution">
760 <h2 id=
"_description">DESCRIPTION
</h2>
761 <div class=
"sectionbody">
762 <div class=
"paragraph"><p>Compare the content and mode of blobs found via two tree objects.
</p></div>
763 <div class=
"paragraph"><p>If there is only one
<tree-ish
> given, the commit is compared with its parents
764 (see --stdin below).
</p></div>
765 <div class=
"paragraph"><p>Note that
<em>git diff-tree
</em> can use the tree encapsulated in a commit object.
</p></div>
769 <h2 id=
"_options">OPTIONS
</h2>
770 <div class=
"sectionbody">
771 <div class=
"dlist"><dl>
783 Generate patch (see
<a href=
"#generate_patch_text_with_p">[generate_patch_text_with_p]
</a>).
794 Suppress all output from the diff machinery. Useful for
795 commands like
<code>git show
</code> that show the patch by default to
796 squelch their output, or to cancel the effect of options like
797 <code>--patch
</code>,
<code>--stat
</code> earlier on the command line in an alias.
808 Generate diffs with
<n
> lines of context instead of
810 Implies
<code>--patch
</code>.
814 --output=
<file
>
818 Output to a specific file instead of stdout.
822 --output-indicator-new=
<char
>
825 --output-indicator-old=
<char
>
828 --output-indicator-context=
<char
>
832 Specify the character used to indicate new, old or context
833 lines in the generated patch. Normally they are
<em>+
</em>,
<em>-
</em> and
842 Generate the diff in raw format.
851 Synonym for
<code>-p --raw
</code>.
859 Enable the heuristic that shifts diff hunk boundaries to make patches
860 easier to read. This is the default.
864 --no-indent-heuristic
868 Disable the indent heuristic.
876 Spend extra time to make sure the smallest possible
885 Generate a diff using the
"patience diff" algorithm.
893 Generate a diff using the
"histogram diff" algorithm.
897 --anchored=
<text
>
901 Generate a diff using the
"anchored diff" algorithm.
903 <div class=
"paragraph"><p>This option may be specified more than once.
</p></div>
904 <div class=
"paragraph"><p>If a line exists in both the source and destination, exists only once,
905 and starts with this text, this algorithm attempts to prevent it from
906 appearing as a deletion or addition in the output. It uses the
"patience
907 diff" algorithm internally.
</p></div>
910 --diff-algorithm={patience|minimal|histogram|myers}
914 Choose a diff algorithm. The variants are as follows:
916 <div class=
"openblock">
917 <div class=
"content">
918 <div class=
"dlist"><dl>
920 <code>default
</code>,
<code>myers
</code>
924 The basic greedy diff algorithm. Currently, this is the default.
932 Spend extra time to make sure the smallest possible diff is
937 <code>patience
</code>
941 Use
"patience diff" algorithm when generating patches.
945 <code>histogram
</code>
949 This algorithm extends the patience algorithm to
"support
950 low-occurrence common elements".
955 <div class=
"paragraph"><p>For instance, if you configured the
<code>diff.algorithm
</code> variable to a
956 non-default value and want to use the default one, then you
957 have to use
<code>--diff-algorithm=default
</code> option.
</p></div>
960 --stat[=
<width
>[,
<name-width
>[,
<count
>]]]
964 Generate a diffstat. By default, as much space as necessary
965 will be used for the filename part, and the rest for the graph
966 part. Maximum width defaults to terminal width, or
80 columns
967 if not connected to a terminal, and can be overridden by
968 <code><width
></code>. The width of the filename part can be limited by
969 giving another width
<code><name-width
></code> after a comma or by setting
970 <code>diff.statNameWidth=
<width
></code>. The width of the graph part can be
971 limited by using
<code>--stat-graph-width=
<width
></code> or by setting
972 <code>diff.statGraphWidth=
<width
></code>. Using
<code>--stat
</code> or
973 <code>--stat-graph-width
</code> affects all commands generating a stat graph,
974 while setting
<code>diff.statNameWidth
</code> or
<code>diff.statGraphWidth
</code>
975 does not affect
<code>git format-patch
</code>.
976 By giving a third parameter
<code><count
></code>, you can limit the output to
977 the first
<code><count
></code> lines, followed by
<code>...
</code> if there are more.
979 <div class=
"paragraph"><p>These parameters can also be set individually with
<code>--stat-width=
<width
></code>,
980 <code>--stat-name-width=
<name-width
></code> and
<code>--stat-count=
<count
></code>.
</p></div>
987 Output a condensed summary of extended header information such
988 as file creations or deletions (
"new" or
"gone", optionally
"+l"
989 if it
’s a symlink) and mode changes (
"+x" or
"-x" for adding
990 or removing executable bit respectively) in diffstat. The
991 information is put between the filename part and the graph
992 part. Implies
<code>--stat
</code>.
1000 Similar to
<code>--stat
</code>, but shows number of added and
1001 deleted lines in decimal notation and pathname without
1002 abbreviation, to make it more machine friendly. For
1003 binary files, outputs two
<code>-
</code> instead of saying
1007 <dt class=
"hdlist1">
1012 Output only the last line of the
<code>--stat
</code> format containing total
1013 number of modified files, as well as number of added and deleted
1017 <dt class=
"hdlist1">
1018 -X[
<param1,param2,
…>]
1020 <dt class=
"hdlist1">
1021 --dirstat[=
<param1,param2,
…>]
1025 Output the distribution of relative amount of changes for each
1026 sub-directory. The behavior of
<code>--dirstat
</code> can be customized by
1027 passing it a comma separated list of parameters.
1028 The defaults are controlled by the
<code>diff.dirstat
</code> configuration
1029 variable (see
<a href=
"git-config.html">git-config(
1)
</a>).
1030 The following parameters are available:
1032 <div class=
"openblock">
1033 <div class=
"content">
1034 <div class=
"dlist"><dl>
1035 <dt class=
"hdlist1">
1036 <code>changes
</code>
1040 Compute the dirstat numbers by counting the lines that have been
1041 removed from the source, or added to the destination. This ignores
1042 the amount of pure code movements within a file. In other words,
1043 rearranging lines in a file is not counted as much as other changes.
1044 This is the default behavior when no parameter is given.
1047 <dt class=
"hdlist1">
1052 Compute the dirstat numbers by doing the regular line-based diff
1053 analysis, and summing the removed/added line counts. (For binary
1054 files, count
64-byte chunks instead, since binary files have no
1055 natural concept of lines). This is a more expensive
<code>--dirstat
</code>
1056 behavior than the
<code>changes
</code> behavior, but it does count rearranged
1057 lines within a file as much as other changes. The resulting output
1058 is consistent with what you get from the other
<code>--*stat
</code> options.
1061 <dt class=
"hdlist1">
1066 Compute the dirstat numbers by counting the number of files changed.
1067 Each changed file counts equally in the dirstat analysis. This is
1068 the computationally cheapest
<code>--dirstat
</code> behavior, since it does
1069 not have to look at the file contents at all.
1072 <dt class=
"hdlist1">
1073 <code>cumulative
</code>
1077 Count changes in a child directory for the parent directory as well.
1078 Note that when using
<code>cumulative
</code>, the sum of the percentages
1079 reported may exceed
100%. The default (non-cumulative) behavior can
1080 be specified with the
<code>noncumulative
</code> parameter.
1083 <dt class=
"hdlist1">
1088 An integer parameter specifies a cut-off percent (
3% by default).
1089 Directories contributing less than this percentage of the changes
1090 are not shown in the output.
1095 <div class=
"paragraph"><p>Example: The following will count changed files, while ignoring
1096 directories with less than
10% of the total amount of changed files,
1097 and accumulating child directory counts in the parent directories:
1098 <code>--dirstat=files,
10,cumulative
</code>.
</p></div>
1100 <dt class=
"hdlist1">
1105 Synonym for --dirstat=cumulative
1108 <dt class=
"hdlist1">
1109 --dirstat-by-file[=
<param1,param2
>…]
1113 Synonym for --dirstat=files,param1,param2
…
1116 <dt class=
"hdlist1">
1121 Output a condensed summary of extended header information
1122 such as creations, renames and mode changes.
1125 <dt class=
"hdlist1">
1130 Synonym for
<code>-p --stat
</code>.
1133 <dt class=
"hdlist1">
1138 When
<code>--raw
</code>,
<code>--numstat
</code>,
<code>--name-only
</code> or
<code>--name-status
</code> has been
1139 given, do not munge pathnames and use NULs as output field terminators.
1141 <div class=
"paragraph"><p>Without this option, pathnames with
"unusual" characters are quoted as
1142 explained for the configuration variable
<code>core.quotePath
</code> (see
1143 <a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
1145 <dt class=
"hdlist1">
1150 Show only names of changed files. The file names are often encoded in UTF-
8.
1151 For more information see the discussion about encoding in the
<a href=
"git-log.html">git-log(
1)
</a>
1155 <dt class=
"hdlist1">
1160 Show only names and status of changed files. See the description
1161 of the
<code>--diff-filter
</code> option on what the status letters mean.
1162 Just like
<code>--name-only
</code> the file names are often encoded in UTF-
8.
1165 <dt class=
"hdlist1">
1166 --submodule[=
<format
>]
1170 Specify how differences in submodules are shown. When specifying
1171 <code>--submodule=short
</code> the
<em>short
</em> format is used. This format just
1172 shows the names of the commits at the beginning and end of the range.
1173 When
<code>--submodule
</code> or
<code>--submodule=log
</code> is specified, the
<em>log
</em>
1174 format is used. This format lists the commits in the range like
1175 <a href=
"git-submodule.html">git-submodule(
1)
</a> <code>summary
</code> does. When
<code>--submodule=diff
</code>
1176 is specified, the
<em>diff
</em> format is used. This format shows an
1177 inline diff of the changes in the submodule contents between the
1178 commit range. Defaults to
<code>diff.submodule
</code> or the
<em>short
</em> format
1179 if the config option is unset.
1182 <dt class=
"hdlist1">
1183 --color[=
<when
>]
1188 <code>--color
</code> (i.e. without
<em>=
<when
></em>) is the same as
<code>--color=always
</code>.
1189 <em><when
></em> can be one of
<code>always
</code>,
<code>never
</code>, or
<code>auto
</code>.
1192 <dt class=
"hdlist1">
1197 Turn off colored diff.
1198 It is the same as
<code>--color=never
</code>.
1201 <dt class=
"hdlist1">
1202 --color-moved[=
<mode
>]
1206 Moved lines of code are colored differently.
1207 The
<mode
> defaults to
<em>no
</em> if the option is not given
1208 and to
<em>zebra
</em> if the option with no mode is given.
1209 The mode must be one of:
1211 <div class=
"openblock">
1212 <div class=
"content">
1213 <div class=
"dlist"><dl>
1214 <dt class=
"hdlist1">
1219 Moved lines are not highlighted.
1222 <dt class=
"hdlist1">
1227 Is a synonym for
<code>zebra
</code>. This may change to a more sensible mode
1231 <dt class=
"hdlist1">
1236 Any line that is added in one location and was removed
1237 in another location will be colored with
<em>color.diff.newMoved
</em>.
1238 Similarly
<em>color.diff.oldMoved
</em> will be used for removed lines
1239 that are added somewhere else in the diff. This mode picks up any
1240 moved line, but it is not very useful in a review to determine
1241 if a block of code was moved without permutation.
1244 <dt class=
"hdlist1">
1249 Blocks of moved text of at least
20 alphanumeric characters
1250 are detected greedily. The detected blocks are
1251 painted using either the
<em>color.diff.{old,new}Moved
</em> color.
1252 Adjacent blocks cannot be told apart.
1255 <dt class=
"hdlist1">
1260 Blocks of moved text are detected as in
<em>blocks
</em> mode. The blocks
1261 are painted using either the
<em>color.diff.{old,new}Moved
</em> color or
1262 <em>color.diff.{old,new}MovedAlternative
</em>. The change between
1263 the two colors indicates that a new block was detected.
1266 <dt class=
"hdlist1">
1271 Similar to
<em>zebra
</em>, but additional dimming of uninteresting parts
1272 of moved code is performed. The bordering lines of two adjacent
1273 blocks are considered interesting, the rest is uninteresting.
1274 <code>dimmed_zebra
</code> is a deprecated synonym.
1280 <dt class=
"hdlist1">
1285 Turn off move detection. This can be used to override configuration
1286 settings. It is the same as
<code>--color-moved=no
</code>.
1289 <dt class=
"hdlist1">
1290 --color-moved-ws=
<modes
>
1294 This configures how whitespace is ignored when performing the
1295 move detection for
<code>--color-moved
</code>.
1296 These modes can be given as a comma separated list:
1298 <div class=
"openblock">
1299 <div class=
"content">
1300 <div class=
"dlist"><dl>
1301 <dt class=
"hdlist1">
1306 Do not ignore whitespace when performing move detection.
1309 <dt class=
"hdlist1">
1314 Ignore changes in whitespace at EOL.
1317 <dt class=
"hdlist1">
1322 Ignore changes in amount of whitespace. This ignores whitespace
1323 at line end, and considers all other sequences of one or
1324 more whitespace characters to be equivalent.
1327 <dt class=
"hdlist1">
1332 Ignore whitespace when comparing lines. This ignores differences
1333 even if one line has whitespace where the other line has none.
1336 <dt class=
"hdlist1">
1337 allow-indentation-change
1341 Initially ignore any whitespace in the move detection, then
1342 group the moved code blocks only into a block if the change in
1343 whitespace is the same per line. This is incompatible with the
1350 <dt class=
"hdlist1">
1355 Do not ignore whitespace when performing move detection. This can be
1356 used to override configuration settings. It is the same as
1357 <code>--color-moved-ws=no
</code>.
1360 <dt class=
"hdlist1">
1361 --word-diff[=
<mode
>]
1365 Show a word diff, using the
<mode
> to delimit changed words.
1366 By default, words are delimited by whitespace; see
1367 <code>--word-diff-regex
</code> below. The
<mode
> defaults to
<em>plain
</em>, and
1370 <div class=
"openblock">
1371 <div class=
"content">
1372 <div class=
"dlist"><dl>
1373 <dt class=
"hdlist1">
1378 Highlight changed words using only colors. Implies
<code>--color
</code>.
1381 <dt class=
"hdlist1">
1386 Show words as
<code>[-removed-]
</code> and
<code>{+added+}
</code>. Makes no
1387 attempts to escape the delimiters if they appear in the input,
1388 so the output may be ambiguous.
1391 <dt class=
"hdlist1">
1396 Use a special line-based format intended for script
1397 consumption. Added/removed/unchanged runs are printed in the
1398 usual unified diff format, starting with a
<code>+
</code>/
<code>-
</code>/` `
1399 character at the beginning of the line and extending to the
1400 end of the line. Newlines in the input are represented by a
1401 tilde
<code>~
</code> on a line of its own.
1404 <dt class=
"hdlist1">
1409 Disable word diff again.
1414 <div class=
"paragraph"><p>Note that despite the name of the first mode, color is used to
1415 highlight the changed parts in all modes if enabled.
</p></div>
1417 <dt class=
"hdlist1">
1418 --word-diff-regex=
<regex
>
1422 Use
<regex
> to decide what a word is, instead of considering
1423 runs of non-whitespace to be a word. Also implies
1424 <code>--word-diff
</code> unless it was already enabled.
1426 <div class=
"paragraph"><p>Every non-overlapping match of the
1427 <regex
> is considered a word. Anything between these matches is
1428 considered whitespace and ignored(!) for the purposes of finding
1429 differences. You may want to append
<code>|[^[:space:]]
</code> to your regular
1430 expression to make sure that it matches all non-whitespace characters.
1431 A match that contains a newline is silently truncated(!) at the
1433 <div class=
"paragraph"><p>For example,
<code>--word-diff-regex=.
</code> will treat each character as a word
1434 and, correspondingly, show differences character by character.
</p></div>
1435 <div class=
"paragraph"><p>The regex can also be set via a diff driver or configuration option, see
1436 <a href=
"gitattributes.html">gitattributes(
5)
</a> or
<a href=
"git-config.html">git-config(
1)
</a>. Giving it explicitly
1437 overrides any diff driver or configuration setting. Diff drivers
1438 override configuration settings.
</p></div>
1440 <dt class=
"hdlist1">
1441 --color-words[=
<regex
>]
1445 Equivalent to
<code>--word-diff=color
</code> plus (if a regex was
1446 specified)
<code>--word-diff-regex=
<regex
></code>.
1449 <dt class=
"hdlist1">
1454 Turn off rename detection, even when the configuration
1455 file gives the default to do so.
1458 <dt class=
"hdlist1">
1463 Whether to use empty blobs as rename source.
1466 <dt class=
"hdlist1">
1471 Warn if changes introduce conflict markers or whitespace errors.
1472 What are considered whitespace errors is controlled by
<code>core.whitespace
</code>
1473 configuration. By default, trailing whitespaces (including
1474 lines that consist solely of whitespaces) and a space character
1475 that is immediately followed by a tab character inside the
1476 initial indent of the line are considered whitespace errors.
1477 Exits with non-zero status if problems are found. Not compatible
1481 <dt class=
"hdlist1">
1482 --ws-error-highlight=
<kind
>
1486 Highlight whitespace errors in the
<code>context
</code>,
<code>old
</code> or
<code>new
</code>
1487 lines of the diff. Multiple values are separated by comma,
1488 <code>none
</code> resets previous values,
<code>default
</code> reset the list to
1489 <code>new
</code> and
<code>all
</code> is a shorthand for
<code>old,new,context
</code>. When
1490 this option is not given, and the configuration variable
1491 <code>diff.wsErrorHighlight
</code> is not set, only whitespace errors in
1492 <code>new
</code> lines are highlighted. The whitespace errors are colored
1493 with
<code>color.diff.whitespace
</code>.
1496 <dt class=
"hdlist1">
1501 Instead of the first handful of characters, show the full
1502 pre- and post-image blob object names on the
"index"
1503 line when generating patch format output.
1506 <dt class=
"hdlist1">
1511 In addition to
<code>--full-index
</code>, output a binary diff that
1512 can be applied with
<code>git-apply
</code>.
1513 Implies
<code>--patch
</code>.
1516 <dt class=
"hdlist1">
1517 --abbrev[=
<n
>]
1521 Instead of showing the full
40-byte hexadecimal object
1522 name in diff-raw format output and diff-tree header
1523 lines, show the shortest prefix that is at least
<em><n
></em>
1524 hexdigits long that uniquely refers the object.
1525 In diff-patch output format,
<code>--full-index
</code> takes higher
1526 precedence, i.e. if
<code>--full-index
</code> is specified, full blob
1527 names will be shown regardless of
<code>--abbrev
</code>.
1528 Non default number of digits can be specified with
<code>--abbrev=
<n
></code>.
1531 <dt class=
"hdlist1">
1532 -B[
<n
>][/
<m
>]
1534 <dt class=
"hdlist1">
1535 --break-rewrites[=[
<n
>][/
<m
>]]
1539 Break complete rewrite changes into pairs of delete and
1540 create. This serves two purposes:
1542 <div class=
"paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
1543 not as a series of deletion and insertion mixed together with a very
1544 few lines that happen to match textually as the context, but as a
1545 single deletion of everything old followed by a single insertion of
1546 everything new, and the number
<code>m
</code> controls this aspect of the -B
1547 option (defaults to
60%).
<code>-B/
70%
</code> specifies that less than
30% of the
1548 original should remain in the result for Git to consider it a total
1549 rewrite (i.e. otherwise the resulting patch will be a series of
1550 deletion and insertion mixed together with context lines).
</p></div>
1551 <div class=
"paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
1552 source of a rename (usually -M only considers a file that disappeared
1553 as the source of a rename), and the number
<code>n
</code> controls this aspect of
1554 the -B option (defaults to
50%).
<code>-B20%
</code> specifies that a change with
1555 addition and deletion compared to
20% or more of the file
’s size are
1556 eligible for being picked up as a possible source of a rename to
1557 another file.
</p></div>
1559 <dt class=
"hdlist1">
1562 <dt class=
"hdlist1">
1563 --find-renames[=
<n
>]
1568 If
<code>n
</code> is specified, it is a threshold on the similarity
1569 index (i.e. amount of addition/deletions compared to the
1570 file
’s size). For example,
<code>-M90%
</code> means Git should consider a
1571 delete/add pair to be a rename if more than
90% of the file
1572 hasn
’t changed. Without a
<code>%
</code> sign, the number is to be read as
1573 a fraction, with a decimal point before it. I.e.,
<code>-M5
</code> becomes
1574 0.5, and is thus the same as
<code>-M50%
</code>. Similarly,
<code>-M05
</code> is
1575 the same as
<code>-M5%
</code>. To limit detection to exact renames, use
1576 <code>-M100%
</code>. The default similarity index is
50%.
1579 <dt class=
"hdlist1">
1582 <dt class=
"hdlist1">
1583 --find-copies[=
<n
>]
1587 Detect copies as well as renames. See also
<code>--find-copies-harder
</code>.
1588 If
<code>n
</code> is specified, it has the same meaning as for
<code>-M
<n
></code>.
1591 <dt class=
"hdlist1">
1592 --find-copies-harder
1596 For performance reasons, by default,
<code>-C
</code> option finds copies only
1597 if the original file of the copy was modified in the same
1598 changeset. This flag makes the command
1599 inspect unmodified files as candidates for the source of
1600 copy. This is a very expensive operation for large
1601 projects, so use it with caution. Giving more than one
1602 <code>-C
</code> option has the same effect.
1605 <dt class=
"hdlist1">
1608 <dt class=
"hdlist1">
1609 --irreversible-delete
1613 Omit the preimage for deletes, i.e. print only the header but not
1614 the diff between the preimage and
<code>/dev/null
</code>. The resulting patch
1615 is not meant to be applied with
<code>patch
</code> or
<code>git apply
</code>; this is
1616 solely for people who want to just concentrate on reviewing the
1617 text after the change. In addition, the output obviously lacks
1618 enough information to apply such a patch in reverse, even manually,
1619 hence the name of the option.
1621 <div class=
"paragraph"><p>When used together with
<code>-B
</code>, omit also the preimage in the deletion part
1622 of a delete/create pair.
</p></div>
1624 <dt class=
"hdlist1">
1629 The
<code>-M
</code> and
<code>-C
</code> options involve some preliminary steps that
1630 can detect subsets of renames/copies cheaply, followed by an
1631 exhaustive fallback portion that compares all remaining
1632 unpaired destinations to all relevant sources. (For renames,
1633 only remaining unpaired sources are relevant; for copies, all
1634 original sources are relevant.) For N sources and
1635 destinations, this exhaustive check is O(N^
2). This option
1636 prevents the exhaustive portion of rename/copy detection from
1637 running if the number of source/destination files involved
1638 exceeds the specified number. Defaults to diff.renameLimit.
1639 Note that a value of
0 is treated as unlimited.
1642 <dt class=
"hdlist1">
1643 --diff-filter=[(A|C|D|M|R|T|U|X|B)
…[*]]
1647 Select only files that are Added (
<code>A
</code>), Copied (
<code>C
</code>),
1648 Deleted (
<code>D
</code>), Modified (
<code>M
</code>), Renamed (
<code>R
</code>), have their
1649 type (i.e. regular file, symlink, submodule,
…) changed (
<code>T
</code>),
1650 are Unmerged (
<code>U
</code>), are
1651 Unknown (
<code>X
</code>), or have had their pairing Broken (
<code>B
</code>).
1652 Any combination of the filter characters (including none) can be used.
1653 When
<code>*
</code> (All-or-none) is added to the combination, all
1654 paths are selected if there is any file that matches
1655 other criteria in the comparison; if there is no file
1656 that matches other criteria, nothing is selected.
1658 <div class=
"paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1659 <code>--diff-filter=ad
</code> excludes added and deleted paths.
</p></div>
1660 <div class=
"paragraph"><p>Note that not all diffs can feature all types. For instance, copied and
1661 renamed entries cannot appear if detection for those types is disabled.
</p></div>
1663 <dt class=
"hdlist1">
1668 Look for differences that change the number of occurrences of
1669 the specified string (i.e. addition/deletion) in a file.
1670 Intended for the scripter
’s use.
1672 <div class=
"paragraph"><p>It is useful when you
’re looking for an exact block of code (like a
1673 struct), and want to know the history of that block since it first
1674 came into being: use the feature iteratively to feed the interesting
1675 block in the preimage back into
<code>-S
</code>, and keep going until you get the
1676 very first version of the block.
</p></div>
1677 <div class=
"paragraph"><p>Binary files are searched as well.
</p></div>
1679 <dt class=
"hdlist1">
1684 Look for differences whose patch text contains added/removed
1685 lines that match
<regex
>.
1687 <div class=
"paragraph"><p>To illustrate the difference between
<code>-S
<regex
> --pickaxe-regex
</code> and
1688 <code>-G
<regex
></code>, consider a commit with the following diff in the same
1690 <div class=
"listingblock">
1691 <div class=
"content">
1692 <pre><code>+ return frotz(nitfol, two-
>ptr,
1,
0);
1694 - hit = frotz(nitfol, mf2.ptr,
1,
0);
</code></pre>
1696 <div class=
"paragraph"><p>While
<code>git log -G
"frotz\(nitfol"</code> will show this commit,
<code>git log
1697 -S
"frotz\(nitfol" --pickaxe-regex
</code> will not (because the number of
1698 occurrences of that string did not change).
</p></div>
1699 <div class=
"paragraph"><p>Unless
<code>--text
</code> is supplied patches of binary files without a textconv
1700 filter will be ignored.
</p></div>
1701 <div class=
"paragraph"><p>See the
<em>pickaxe
</em> entry in
<a href=
"gitdiffcore.html">gitdiffcore(
7)
</a> for more
1702 information.
</p></div>
1704 <dt class=
"hdlist1">
1705 --find-object=
<object-id
>
1709 Look for differences that change the number of occurrences of
1710 the specified object. Similar to
<code>-S
</code>, just the argument is different
1711 in that it doesn
’t search for a specific string but for a specific
1714 <div class=
"paragraph"><p>The object can be a blob or a submodule commit. It implies the
<code>-t
</code> option in
1715 <code>git-log
</code> to also find trees.
</p></div>
1717 <dt class=
"hdlist1">
1722 When
<code>-S
</code> or
<code>-G
</code> finds a change, show all the changes in that
1723 changeset, not just the files that contain the change
1727 <dt class=
"hdlist1">
1732 Treat the
<string
> given to
<code>-S
</code> as an extended POSIX regular
1733 expression to match.
1736 <dt class=
"hdlist1">
1741 Control the order in which files appear in the output.
1742 This overrides the
<code>diff.orderFile
</code> configuration variable
1743 (see
<a href=
"git-config.html">git-config(
1)
</a>). To cancel
<code>diff.orderFile
</code>,
1744 use
<code>-O/dev/null
</code>.
1746 <div class=
"paragraph"><p>The output order is determined by the order of glob patterns in
1748 All files with pathnames that match the first pattern are output
1749 first, all files with pathnames that match the second pattern (but not
1750 the first) are output next, and so on.
1751 All files with pathnames that do not match any pattern are output
1752 last, as if there was an implicit match-all pattern at the end of the
1754 If multiple pathnames have the same rank (they match the same pattern
1755 but no earlier patterns), their output order relative to each other is
1756 the normal order.
</p></div>
1757 <div class=
"paragraph"><p><orderfile
> is parsed as follows:
</p></div>
1758 <div class=
"openblock">
1759 <div class=
"content">
1760 <div class=
"ulist"><ul>
1763 Blank lines are ignored, so they can be used as separators for
1769 Lines starting with a hash (
"<code>#</code>") are ignored, so they can be used
1770 for comments. Add a backslash (
"<code>\</code>") to the beginning of the
1771 pattern if it starts with a hash.
1776 Each other line contains a single pattern.
1781 <div class=
"paragraph"><p>Patterns have the same syntax and semantics as patterns used for
1782 fnmatch(
3) without the FNM_PATHNAME flag, except a pathname also
1783 matches a pattern if removing any number of the final pathname
1784 components matches the pattern. For example, the pattern
"<code>foo*bar</code>"
1785 matches
"<code>fooasdfbar</code>" and
"<code>foo/bar/baz/asdf</code>" but not
"<code>foobarx</code>".
</p></div>
1787 <dt class=
"hdlist1">
1788 --skip-to=
<file
>
1790 <dt class=
"hdlist1">
1791 --rotate-to=
<file
>
1795 Discard the files before the named
<file
> from the output
1796 (i.e.
<em>skip to
</em>), or move them to the end of the output
1797 (i.e.
<em>rotate to
</em>). These options were invented primarily for the use
1798 of the
<code>git difftool
</code> command, and may not be very useful
1802 <dt class=
"hdlist1">
1807 Swap two inputs; that is, show differences from index or
1808 on-disk file to tree contents.
1811 <dt class=
"hdlist1">
1812 --relative[=
<path
>]
1814 <dt class=
"hdlist1">
1819 When run from a subdirectory of the project, it can be
1820 told to exclude changes outside the directory and show
1821 pathnames relative to it with this option. When you are
1822 not in a subdirectory (e.g. in a bare repository), you
1823 can name which subdirectory to make the output relative
1824 to by giving a
<path
> as an argument.
1825 <code>--no-relative
</code> can be used to countermand both
<code>diff.relative
</code> config
1826 option and previous
<code>--relative
</code>.
1829 <dt class=
"hdlist1">
1832 <dt class=
"hdlist1">
1837 Treat all files as text.
1840 <dt class=
"hdlist1">
1845 Ignore carriage-return at the end of line when doing a comparison.
1848 <dt class=
"hdlist1">
1849 --ignore-space-at-eol
1853 Ignore changes in whitespace at EOL.
1856 <dt class=
"hdlist1">
1859 <dt class=
"hdlist1">
1860 --ignore-space-change
1864 Ignore changes in amount of whitespace. This ignores whitespace
1865 at line end, and considers all other sequences of one or
1866 more whitespace characters to be equivalent.
1869 <dt class=
"hdlist1">
1872 <dt class=
"hdlist1">
1877 Ignore whitespace when comparing lines. This ignores
1878 differences even if one line has whitespace where the other
1882 <dt class=
"hdlist1">
1883 --ignore-blank-lines
1887 Ignore changes whose lines are all blank.
1890 <dt class=
"hdlist1">
1893 <dt class=
"hdlist1">
1894 --ignore-matching-lines=
<regex
>
1898 Ignore changes whose all lines match
<regex
>. This option may
1899 be specified more than once.
1902 <dt class=
"hdlist1">
1903 --inter-hunk-context=
<lines
>
1907 Show the context between diff hunks, up to the specified number
1908 of lines, thereby fusing hunks that are close to each other.
1909 Defaults to
<code>diff.interHunkContext
</code> or
0 if the config option
1913 <dt class=
"hdlist1">
1916 <dt class=
"hdlist1">
1921 Show whole function as context lines for each change.
1922 The function names are determined in the same way as
1923 <code>git diff
</code> works out patch hunk headers (see
<em>Defining a
1924 custom hunk-header
</em> in
<a href=
"gitattributes.html">gitattributes(
5)
</a>).
1927 <dt class=
"hdlist1">
1932 Make the program exit with codes similar to diff(
1).
1933 That is, it exits with
1 if there were differences and
1934 0 means no differences.
1937 <dt class=
"hdlist1">
1942 Disable all output of the program. Implies
<code>--exit-code
</code>.
1945 <dt class=
"hdlist1">
1950 Allow an external diff helper to be executed. If you set an
1951 external diff driver with
<a href=
"gitattributes.html">gitattributes(
5)
</a>, you need
1952 to use this option with
<a href=
"git-log.html">git-log(
1)
</a> and friends.
1955 <dt class=
"hdlist1">
1960 Disallow external diff drivers.
1963 <dt class=
"hdlist1">
1966 <dt class=
"hdlist1">
1971 Allow (or disallow) external text conversion filters to be run
1972 when comparing binary files. See
<a href=
"gitattributes.html">gitattributes(
5)
</a> for
1973 details. Because textconv filters are typically a one-way
1974 conversion, the resulting diff is suitable for human
1975 consumption, but cannot be applied. For this reason, textconv
1976 filters are enabled by default only for
<a href=
"git-diff.html">git-diff(
1)
</a> and
1977 <a href=
"git-log.html">git-log(
1)
</a>, but not for
<a href=
"git-format-patch.html">git-format-patch(
1)
</a> or
1978 diff plumbing commands.
1981 <dt class=
"hdlist1">
1982 --ignore-submodules[=
<when
>]
1986 Ignore changes to submodules in the diff generation.
<when
> can be
1987 either
"none",
"untracked",
"dirty" or
"all", which is the default.
1988 Using
"none" will consider the submodule modified when it either contains
1989 untracked or modified files or its HEAD differs from the commit recorded
1990 in the superproject and can be used to override any settings of the
1991 <em>ignore
</em> option in
<a href=
"git-config.html">git-config(
1)
</a> or
<a href=
"gitmodules.html">gitmodules(
5)
</a>. When
1992 "untracked" is used submodules are not considered dirty when they only
1993 contain untracked content (but they are still scanned for modified
1994 content). Using
"dirty" ignores all changes to the work tree of submodules,
1995 only changes to the commits stored in the superproject are shown (this was
1996 the behavior until
1.7.0). Using
"all" hides all changes to submodules.
1999 <dt class=
"hdlist1">
2000 --src-prefix=
<prefix
>
2004 Show the given source prefix instead of
"a/".
2007 <dt class=
"hdlist1">
2008 --dst-prefix=
<prefix
>
2012 Show the given destination prefix instead of
"b/".
2015 <dt class=
"hdlist1">
2020 Do not show any source or destination prefix.
2023 <dt class=
"hdlist1">
2028 Use the default source and destination prefixes (
"a/" and
"b/").
2029 This is usually the default already, but may be used to override
2030 config such as
<code>diff.noprefix
</code>.
2033 <dt class=
"hdlist1">
2034 --line-prefix=
<prefix
>
2038 Prepend an additional prefix to every line of output.
2041 <dt class=
"hdlist1">
2042 --ita-invisible-in-index
2046 By default entries added by
"git add -N" appear as an existing
2047 empty file in
"git diff" and a new file in
"git diff --cached".
2048 This option makes the entry appear as a new file in
"git diff"
2049 and non-existent in
"git diff --cached". This option could be
2050 reverted with
<code>--ita-visible-in-index
</code>. Both options are
2051 experimental and could be removed in future.
2055 <div class=
"paragraph"><p>For more detailed explanation on these common options, see also
2056 <a href=
"gitdiffcore.html">gitdiffcore(
7)
</a>.
</p></div>
2057 <div class=
"dlist"><dl>
2058 <dt class=
"hdlist1">
2063 The id of a tree object.
2066 <dt class=
"hdlist1">
2071 If provided, the results are limited to a subset of files
2072 matching one of the provided pathspecs.
2075 <dt class=
"hdlist1">
2080 Recurse into sub-trees.
2083 <dt class=
"hdlist1">
2088 Show tree entry itself as well as subtrees. Implies -r.
2091 <dt class=
"hdlist1">
2096 When
<code>--root
</code> is specified the initial commit will be shown as a big
2097 creation event. This is equivalent to a diff against the NULL tree.
2100 <dt class=
"hdlist1">
2105 Instead of comparing the
<tree-ish
>s directly, use the merge
2106 base between the two
<tree-ish
>s as the
"before" side. There
2107 must be two
<tree-ish
>s given and they must both be commits.
2110 <dt class=
"hdlist1">
2115 When
<code>--stdin
</code> is specified, the command does not take
2116 <tree-ish
> arguments from the command line. Instead, it
2117 reads lines containing either two
<tree
>, one
<commit
>, or a
2118 list of
<commit
> from its standard input. (Use a single space
2121 <div class=
"paragraph"><p>When two trees are given, it compares the first tree with the second.
2122 When a single commit is given, it compares the commit with its
2123 parents. The remaining commits, when given, are used as if they are
2124 parents of the first commit.
</p></div>
2125 <div class=
"paragraph"><p>When comparing two trees, the ID of both trees (separated by a space
2126 and terminated by a newline) is printed before the difference. When
2127 comparing commits, the ID of the first (or only) commit, followed by a
2128 newline, is printed.
</p></div>
2129 <div class=
"paragraph"><p>The following flags further affect the behavior when comparing
2130 commits (but not trees).
</p></div>
2132 <dt class=
"hdlist1">
2137 By default,
<em>git diff-tree --stdin
</em> does not show
2138 differences for merge commits. With this flag, it shows
2139 differences to that commit from all of its parents. See
2140 also
<code>-c
</code>.
2143 <dt class=
"hdlist1">
2148 By default,
<em>git diff-tree --stdin
</em> shows differences,
2149 either in machine-readable form (without
<code>-p
</code>) or in patch
2150 form (with
<code>-p
</code>). This output can be suppressed. It is
2151 only useful with the
<code>-v
</code> flag.
2154 <dt class=
"hdlist1">
2159 This flag causes
<em>git diff-tree --stdin
</em> to also show
2160 the commit message before the differences.
2163 <dt class=
"hdlist1">
2164 --pretty[=
<format
>]
2166 <dt class=
"hdlist1">
2167 --format=
<format
>
2171 Pretty-print the contents of the commit logs in a given format,
2172 where
<em><format
></em> can be one of
<em>oneline
</em>,
<em>short
</em>,
<em>medium
</em>,
2173 <em>full
</em>,
<em>fuller
</em>,
<em>reference
</em>,
<em>email
</em>,
<em>raw
</em>,
<em>format:
<string
></em>
2174 and
<em>tformat:
<string
></em>. When
<em><format
></em> is none of the above,
2175 and has
<em>%placeholder
</em> in it, it acts as if
2176 <em>--pretty=tformat:
<format
></em> were given.
2178 <div class=
"paragraph"><p>See the
"PRETTY FORMATS" section for some additional details for each
2179 format. When
<em>=
<format
></em> part is omitted, it defaults to
<em>medium
</em>.
</p></div>
2180 <div class=
"paragraph"><p>Note: you can specify the default pretty format in the repository
2181 configuration (see
<a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
2183 <dt class=
"hdlist1">
2188 Instead of showing the full
40-byte hexadecimal commit object
2189 name, show a prefix that names the object uniquely.
2190 "--abbrev=<n>" (which also modifies diff output, if it is displayed)
2191 option can be used to specify the minimum length of the prefix.
2193 <div class=
"paragraph"><p>This should make
"--pretty=oneline" a whole lot more readable for
2194 people using
80-column terminals.
</p></div>
2196 <dt class=
"hdlist1">
2201 Show the full
40-byte hexadecimal commit object name. This negates
2202 <code>--abbrev-commit
</code>, either explicit or implied by other options such
2203 as
"--oneline". It also overrides the
<code>log.abbrevCommit
</code> variable.
2206 <dt class=
"hdlist1">
2211 This is a shorthand for
"--pretty=oneline --abbrev-commit"
2215 <dt class=
"hdlist1">
2216 --encoding=
<encoding
>
2220 Commit objects record the character encoding used for the log message
2221 in their encoding header; this option can be used to tell the
2222 command to re-code the commit log message in the encoding
2223 preferred by the user. For non plumbing commands this
2224 defaults to UTF-
8. Note that if an object claims to be encoded
2225 in
<code>X
</code> and we are outputting in
<code>X
</code>, we will output the object
2226 verbatim; this means that invalid sequences in the original
2227 commit may be copied to the output. Likewise, if iconv(
3) fails
2228 to convert the commit, we will quietly output the original
2232 <dt class=
"hdlist1">
2233 --expand-tabs=
<n
>
2235 <dt class=
"hdlist1">
2238 <dt class=
"hdlist1">
2243 Perform a tab expansion (replace each tab with enough spaces
2244 to fill to the next display column that is a multiple of
<em><n
></em>)
2245 in the log message before showing it in the output.
2246 <code>--expand-tabs
</code> is a short-hand for
<code>--expand-tabs=
8</code>, and
2247 <code>--no-expand-tabs
</code> is a short-hand for
<code>--expand-tabs=
0</code>,
2248 which disables tab expansion.
2250 <div class=
"paragraph"><p>By default, tabs are expanded in pretty formats that indent the log
2251 message by
4 spaces (i.e.
<em>medium
</em>, which is the default,
<em>full
</em>,
2252 and
<em>fuller
</em>).
</p></div>
2254 <dt class=
"hdlist1">
2255 --notes[=
<ref
>]
2259 Show the notes (see
<a href=
"git-notes.html">git-notes(
1)
</a>) that annotate the
2260 commit, when showing the commit log message. This is the default
2261 for
<code>git log
</code>,
<code>git show
</code> and
<code>git whatchanged
</code> commands when
2262 there is no
<code>--pretty
</code>,
<code>--format
</code>, or
<code>--oneline
</code> option given
2263 on the command line.
2265 <div class=
"paragraph"><p>By default, the notes shown are from the notes refs listed in the
2266 <code>core.notesRef
</code> and
<code>notes.displayRef
</code> variables (or corresponding
2267 environment overrides). See
<a href=
"git-config.html">git-config(
1)
</a> for more details.
</p></div>
2268 <div class=
"paragraph"><p>With an optional
<em><ref
></em> argument, use the ref to find the notes
2269 to display. The ref can specify the full refname when it begins
2270 with
<code>refs/notes/
</code>; when it begins with
<code>notes/
</code>,
<code>refs/
</code> and otherwise
2271 <code>refs/notes/
</code> is prefixed to form the full name of the ref.
</p></div>
2272 <div class=
"paragraph"><p>Multiple --notes options can be combined to control which notes are
2273 being displayed. Examples:
"--notes=foo" will show only notes from
2274 "refs/notes/foo";
"--notes=foo --notes" will show both notes from
2275 "refs/notes/foo" and from the default notes ref(s).
</p></div>
2277 <dt class=
"hdlist1">
2282 Do not show notes. This negates the above
<code>--notes
</code> option, by
2283 resetting the list of notes refs from which notes are shown.
2284 Options are parsed in the order given on the command line, so e.g.
2285 "--notes --notes=foo --no-notes --notes=bar" will only show notes
2286 from
"refs/notes/bar".
2289 <dt class=
"hdlist1">
2290 --show-notes-by-default
2294 Show the default notes unless options for displaying specific
2298 <dt class=
"hdlist1">
2299 --show-notes[=
<ref
>]
2301 <dt class=
"hdlist1">
2302 --[no-]standard-notes
2306 These options are deprecated. Use the above --notes/--no-notes
2310 <dt class=
"hdlist1">
2315 Check the validity of a signed commit object by passing the signature
2316 to
<code>gpg --verify
</code> and show the output.
2319 <dt class=
"hdlist1">
2324 <em>git diff-tree
</em> outputs a line with the commit ID when
2325 applicable. This flag suppressed the commit ID output.
2328 <dt class=
"hdlist1">
2333 This flag changes the way a merge commit is displayed
2334 (which means it is useful only when the command is given
2335 one
<tree-ish
>, or
<code>--stdin
</code>). It shows the differences
2336 from each of the parents to the merge result simultaneously
2337 instead of showing pairwise diff between a parent and the
2338 result one at a time (which is what the
<code>-m
</code> option does).
2339 Furthermore, it lists only files which were modified
2343 <dt class=
"hdlist1">
2348 This flag changes the way a merge commit patch is displayed,
2349 in a similar way to the
<code>-c
</code> option. It implies the
<code>-c
</code>
2350 and
<code>-p
</code> options and further compresses the patch output
2351 by omitting uninteresting hunks whose contents in the parents
2352 have only two variants and the merge result picks one of them
2353 without modification. When all hunks are uninteresting, the commit
2354 itself and the commit log message are not shown, just like in any other
2358 <dt class=
"hdlist1">
2359 --combined-all-paths
2363 This flag causes combined diffs (used for merge commits) to
2364 list the name of the file from all parents. It thus only has
2365 effect when -c or --cc are specified, and is likely only
2366 useful if filename changes are detected (i.e. when either
2367 rename or copy detection have been requested).
2370 <dt class=
"hdlist1">
2375 Show the commit itself and the commit log message even
2376 if the diff itself is empty.
2383 <h2 id=
"_pretty_formats">PRETTY FORMATS
</h2>
2384 <div class=
"sectionbody">
2385 <div class=
"paragraph"><p>If the commit is a merge, and if the pretty-format
2386 is not
<em>oneline
</em>,
<em>email
</em> or
<em>raw
</em>, an additional line is
2387 inserted before the
<em>Author:
</em> line. This line begins with
2388 "Merge: " and the hashes of ancestral commits are printed,
2389 separated by spaces. Note that the listed commits may not
2390 necessarily be the list of the
<strong>direct
</strong> parent commits if you
2391 have limited your view of history: for example, if you are
2392 only interested in changes related to a certain directory or
2394 <div class=
"paragraph"><p>There are several built-in formats, and you can define
2395 additional formats by setting a pretty.
<name
>
2396 config option to either another format name, or a
2397 <em>format:
</em> string, as described below (see
2398 <a href=
"git-config.html">git-config(
1)
</a>). Here are the details of the
2399 built-in formats:
</p></div>
2400 <div class=
"ulist"><ul>
2405 <div class=
"literalblock">
2406 <div class=
"content">
2407 <pre><code><hash
> <title-line
></code></pre>
2409 <div class=
"paragraph"><p>This is designed to be as compact as possible.
</p></div>
2415 <div class=
"literalblock">
2416 <div class=
"content">
2417 <pre><code>commit
<hash
>
2418 Author:
<author
></code></pre>
2420 <div class=
"literalblock">
2421 <div class=
"content">
2422 <pre><code><title-line
></code></pre>
2429 <div class=
"literalblock">
2430 <div class=
"content">
2431 <pre><code>commit
<hash
>
2432 Author:
<author
>
2433 Date:
<author-date
></code></pre>
2435 <div class=
"literalblock">
2436 <div class=
"content">
2437 <pre><code><title-line
></code></pre>
2439 <div class=
"literalblock">
2440 <div class=
"content">
2441 <pre><code><full-commit-message
></code></pre>
2448 <div class=
"literalblock">
2449 <div class=
"content">
2450 <pre><code>commit
<hash
>
2451 Author:
<author
>
2452 Commit:
<committer
></code></pre>
2454 <div class=
"literalblock">
2455 <div class=
"content">
2456 <pre><code><title-line
></code></pre>
2458 <div class=
"literalblock">
2459 <div class=
"content">
2460 <pre><code><full-commit-message
></code></pre>
2467 <div class=
"literalblock">
2468 <div class=
"content">
2469 <pre><code>commit
<hash
>
2470 Author:
<author
>
2471 AuthorDate:
<author-date
>
2472 Commit:
<committer
>
2473 CommitDate:
<committer-date
></code></pre>
2475 <div class=
"literalblock">
2476 <div class=
"content">
2477 <pre><code><title-line
></code></pre>
2479 <div class=
"literalblock">
2480 <div class=
"content">
2481 <pre><code><full-commit-message
></code></pre>
2488 <div class=
"literalblock">
2489 <div class=
"content">
2490 <pre><code><abbrev-hash
> (
<title-line
>,
<short-author-date
>)
</code></pre>
2492 <div class=
"paragraph"><p>This format is used to refer to another commit in a commit message and
2493 is the same as
<code>--pretty='format:%C(auto)%h (%s, %ad)'
</code>. By default,
2494 the date is formatted with
<code>--date=short
</code> unless another
<code>--date
</code> option
2495 is explicitly specified. As with any
<code>format:
</code> with format
2496 placeholders, its output is not affected by other options like
2497 <code>--decorate
</code> and
<code>--walk-reflogs
</code>.
</p></div>
2503 <div class=
"literalblock">
2504 <div class=
"content">
2505 <pre><code>From
<hash
> <date
>
2506 From:
<author
>
2507 Date:
<author-date
>
2508 Subject: [PATCH]
<title-line
></code></pre>
2510 <div class=
"literalblock">
2511 <div class=
"content">
2512 <pre><code><full-commit-message
></code></pre>
2519 <div class=
"paragraph"><p>Like
<em>email
</em>, but lines in the commit message starting with
"From "
2520 (preceded by zero or more
">") are quoted with
">" so they aren
’t
2521 confused as starting a new commit.
</p></div>
2527 <div class=
"paragraph"><p>The
<em>raw
</em> format shows the entire commit exactly as
2528 stored in the commit object. Notably, the hashes are
2529 displayed in full, regardless of whether --abbrev or
2530 --no-abbrev are used, and
<em>parents
</em> information show the
2531 true parent commits, without taking grafts or history
2532 simplification into account. Note that this format affects the way
2533 commits are displayed, but not the way the diff is shown e.g. with
2534 <code>git log --raw
</code>. To get full object names in a raw diff format,
2535 use
<code>--no-abbrev
</code>.
</p></div>
2539 <em>format:
<format-string
></em>
2541 <div class=
"paragraph"><p>The
<em>format:
<format-string
></em> format allows you to specify which information
2542 you want to show. It works a little bit like printf format,
2543 with the notable exception that you get a newline with
<em>%n
</em>
2544 instead of
<em>\n
</em>.
</p></div>
2545 <div class=
"paragraph"><p>E.g,
<em>format:
"The author of %h was %an, %ar%nThe title was >>%s<<%n"</em>
2546 would show something like this:
</p></div>
2547 <div class=
"listingblock">
2548 <div class=
"content">
2549 <pre><code>The author of fe6e0ee was Junio C Hamano,
23 hours ago
2550 The title was
>>t4119: test autocomputing -p
<n
> for traditional diff input.
<<</code></pre>
2552 <div class=
"paragraph"><p>The placeholders are:
</p></div>
2553 <div class=
"ulist"><ul>
2556 Placeholders that expand to a single literal character:
2558 <div class=
"dlist"><dl>
2559 <dt class=
"hdlist1">
2567 <dt class=
"hdlist1">
2575 <dt class=
"hdlist1">
2580 <em>%x
</em> followed by two hexadecimal digits is replaced with a
2581 byte with the hexadecimal digits' value (we will call this
2582 "literal formatting code" in the rest of this document).
2589 Placeholders that affect formatting of later placeholders:
2591 <div class=
"dlist"><dl>
2592 <dt class=
"hdlist1">
2600 <dt class=
"hdlist1">
2605 switch color to green
2608 <dt class=
"hdlist1">
2613 switch color to blue
2616 <dt class=
"hdlist1">
2624 <dt class=
"hdlist1">
2625 <em>%C(
…)
</em>
2629 color specification, as described under Values in the
2630 "CONFIGURATION FILE" section of
<a href=
"git-config.html">git-config(
1)
</a>. By
2631 default, colors are shown only when enabled for log output
2632 (by
<code>color.diff
</code>,
<code>color.ui
</code>, or
<code>--color
</code>, and respecting
2633 the
<code>auto
</code> settings of the former if we are going to a
2634 terminal).
<code>%C(auto,...)
</code> is accepted as a historical
2635 synonym for the default (e.g.,
<code>%C(auto,red)
</code>). Specifying
2636 <code>%C(always,...)
</code> will show the colors even when color is
2637 not otherwise enabled (though consider just using
2638 <code>--color=always
</code> to enable color for the whole output,
2639 including this format and anything else git might color).
2640 <code>auto
</code> alone (i.e.
<code>%C(auto)
</code>) will turn on auto coloring
2641 on the next placeholders until the color is switched
2645 <dt class=
"hdlist1">
2650 left (
<code><</code>), right (
<code>></code>) or boundary (
<code>-
</code>) mark
2653 <dt class=
"hdlist1">
2654 <em>%w([
<w
>[,
<i1
>[,
<i2
>]]])
</em>
2658 switch line wrapping, like the -w option of
2659 <a href=
"git-shortlog.html">git-shortlog(
1)
</a>.
2662 <dt class=
"hdlist1">
2663 <em>%
<(
<N
> [,trunc|ltrunc|mtrunc])
</em>
2667 make the next placeholder take at
2668 least N column widths, padding spaces on
2669 the right if necessary. Optionally
2670 truncate (with ellipsis
<em>..
</em>) at the left (ltrunc)
<code>..ft
</code>,
2671 the middle (mtrunc)
<code>mi..le
</code>, or the end
2672 (trunc)
<code>rig..
</code>, if the output is longer than
2674 Note
1: that truncating
2675 only works correctly with N
>=
2.
2676 Note
2: spaces around the N and M (see below)
2677 values are optional.
2678 Note
3: Emojis and other wide characters
2679 will take two display columns, which may
2680 over-run column boundaries.
2681 Note
4: decomposed character combining marks
2682 may be misplaced at padding boundaries.
2685 <dt class=
"hdlist1">
2686 <em>%
<|(
<M
> )
</em>
2690 make the next placeholder take at least until Mth
2691 display column, padding spaces on the right if necessary.
2692 Use negative M values for column positions measured
2693 from the right hand edge of the terminal window.
2696 <dt class=
"hdlist1">
2697 <em>%
>(
<N
> )
</em>,
<em>%
>|(
<M
> )
</em>
2701 similar to
<em>%
<(
<N
> )
</em>,
<em>%
<|(
<M
> )
</em> respectively,
2702 but padding spaces on the left
2705 <dt class=
"hdlist1">
2706 <em>%
>>(
<N
> )
</em>,
<em>%
>>|(
<M
> )
</em>
2710 similar to
<em>%
>(
<N
> )
</em>,
<em>%
>|(
<M
> )
</em>
2711 respectively, except that if the next
2712 placeholder takes more spaces than given and
2713 there are spaces on its left, use those
2717 <dt class=
"hdlist1">
2718 <em>%
><(
<N
> )
</em>,
<em>%
><|(
<M
> )
</em>
2722 similar to
<em>%
<(
<N
> )
</em>,
<em>%
<|(
<M
> )
</em>
2723 respectively, but padding both sides
2724 (i.e. the text is centered)
2731 Placeholders that expand to information extracted from the commit:
2733 <div class=
"dlist"><dl>
2734 <dt class=
"hdlist1">
2742 <dt class=
"hdlist1">
2747 abbreviated commit hash
2750 <dt class=
"hdlist1">
2758 <dt class=
"hdlist1">
2763 abbreviated tree hash
2766 <dt class=
"hdlist1">
2774 <dt class=
"hdlist1">
2779 abbreviated parent hashes
2782 <dt class=
"hdlist1">
2790 <dt class=
"hdlist1">
2795 author name (respecting .mailmap, see
<a href=
"git-shortlog.html">git-shortlog(
1)
</a>
2796 or
<a href=
"git-blame.html">git-blame(
1)
</a>)
2799 <dt class=
"hdlist1">
2807 <dt class=
"hdlist1">
2812 author email (respecting .mailmap, see
<a href=
"git-shortlog.html">git-shortlog(
1)
</a>
2813 or
<a href=
"git-blame.html">git-blame(
1)
</a>)
2816 <dt class=
"hdlist1">
2821 author email local-part (the part before the
<em>@
</em> sign)
2824 <dt class=
"hdlist1">
2829 author local-part (see
<em>%al
</em>) respecting .mailmap, see
2830 <a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
2833 <dt class=
"hdlist1">
2838 author date (format respects --date= option)
2841 <dt class=
"hdlist1">
2846 author date, RFC2822 style
2849 <dt class=
"hdlist1">
2854 author date, relative
2857 <dt class=
"hdlist1">
2862 author date, UNIX timestamp
2865 <dt class=
"hdlist1">
2870 author date, ISO
8601-like format
2873 <dt class=
"hdlist1">
2878 author date, strict ISO
8601 format
2881 <dt class=
"hdlist1">
2886 author date, short format (
<code>YYYY-MM-DD
</code>)
2889 <dt class=
"hdlist1">
2894 author date, human style (like the
<code>--date=human
</code> option of
2895 <a href=
"git-rev-list.html">git-rev-list(
1)
</a>)
2898 <dt class=
"hdlist1">
2906 <dt class=
"hdlist1">
2911 committer name (respecting .mailmap, see
2912 <a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
2915 <dt class=
"hdlist1">
2923 <dt class=
"hdlist1">
2928 committer email (respecting .mailmap, see
2929 <a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
2932 <dt class=
"hdlist1">
2937 committer email local-part (the part before the
<em>@
</em> sign)
2940 <dt class=
"hdlist1">
2945 committer local-part (see
<em>%cl
</em>) respecting .mailmap, see
2946 <a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
2949 <dt class=
"hdlist1">
2954 committer date (format respects --date= option)
2957 <dt class=
"hdlist1">
2962 committer date, RFC2822 style
2965 <dt class=
"hdlist1">
2970 committer date, relative
2973 <dt class=
"hdlist1">
2978 committer date, UNIX timestamp
2981 <dt class=
"hdlist1">
2986 committer date, ISO
8601-like format
2989 <dt class=
"hdlist1">
2994 committer date, strict ISO
8601 format
2997 <dt class=
"hdlist1">
3002 committer date, short format (
<code>YYYY-MM-DD
</code>)
3005 <dt class=
"hdlist1">
3010 committer date, human style (like the
<code>--date=human
</code> option of
3011 <a href=
"git-rev-list.html">git-rev-list(
1)
</a>)
3014 <dt class=
"hdlist1">
3019 ref names, like the --decorate option of
<a href=
"git-log.html">git-log(
1)
</a>
3022 <dt class=
"hdlist1">
3027 ref names without the
" (",
")" wrapping.
3030 <dt class=
"hdlist1">
3031 <em>%(decorate[:
<options
>])
</em>
3035 ref names with custom decorations. The
<code>decorate
</code> string may be followed by a
3036 colon and zero or more comma-separated options. Option values may contain
3037 literal formatting codes. These must be used for commas (
<code>%x2C
</code>) and closing
3038 parentheses (
<code>%x29
</code>), due to their role in the option syntax.
3040 <div class=
"ulist"><ul>
3043 <em>prefix=
<value
></em>: Shown before the list of ref names. Defaults to
" <code>(</code>".
3048 <em>suffix=
<value
></em>: Shown after the list of ref names. Defaults to
"<code>)</code>".
3053 <em>separator=
<value
></em>: Shown between ref names. Defaults to
"<code>,</code> ".
3058 <em>pointer=
<value
></em>: Shown between HEAD and the branch it points to, if any.
3059 Defaults to
" <code>-></code> ".
3064 <em>tag=
<value
></em>: Shown before tag names. Defaults to
"<code>tag:</code> ".
3068 <div class=
"paragraph"><p>For example, to produce decorations with no wrapping
3069 or tag annotations, and spaces as separators:
</p></div>
3070 <div class=
"paragraph"><p><code>%(decorate:prefix=,suffix=,tag=,separator= )
</code></p></div>
3072 <dt class=
"hdlist1">
3073 <em>%(describe[:
<options
>])
</em>
3077 human-readable name, like
<a href=
"git-describe.html">git-describe(
1)
</a>; empty string for
3078 undescribable commits. The
<code>describe
</code> string may be followed by a colon and
3079 zero or more comma-separated options. Descriptions can be inconsistent when
3080 tags are added or removed at the same time.
3082 <div class=
"ulist"><ul>
3085 <em>tags[=
<bool-value
>]
</em>: Instead of only considering annotated tags,
3086 consider lightweight tags as well.
3091 <em>abbrev=
<number
></em>: Instead of using the default number of hexadecimal digits
3092 (which will vary according to the number of objects in the repository with a
3093 default of
7) of the abbreviated object name, use
<number
> digits, or as many
3094 digits as needed to form a unique object name.
3099 <em>match=
<pattern
></em>: Only consider tags matching the given
3100 <code>glob(
7)
</code> pattern, excluding the
"refs/tags/" prefix.
3105 <em>exclude=
<pattern
></em>: Do not consider tags matching the given
3106 <code>glob(
7)
</code> pattern, excluding the
"refs/tags/" prefix.
3111 <dt class=
"hdlist1">
3116 ref name given on the command line by which the commit was reached
3117 (like
<code>git log --source
</code>), only works with
<code>git log
</code>
3120 <dt class=
"hdlist1">
3128 <dt class=
"hdlist1">
3136 <dt class=
"hdlist1">
3141 sanitized subject line, suitable for a filename
3144 <dt class=
"hdlist1">
3152 <dt class=
"hdlist1">
3157 raw body (unwrapped subject and body)
3160 <dt class=
"hdlist1">
3168 <dt class=
"hdlist1">
3173 raw verification message from GPG for a signed commit
3176 <dt class=
"hdlist1">
3181 show
"G" for a good (valid) signature,
3182 "B" for a bad signature,
3183 "U" for a good signature with unknown validity,
3184 "X" for a good signature that has expired,
3185 "Y" for a good signature made by an expired key,
3186 "R" for a good signature made by a revoked key,
3187 "E" if the signature cannot be checked (e.g. missing key)
3188 and
"N" for no signature
3191 <dt class=
"hdlist1">
3196 show the name of the signer for a signed commit
3199 <dt class=
"hdlist1">
3204 show the key used to sign a signed commit
3207 <dt class=
"hdlist1">
3212 show the fingerprint of the key used to sign a signed commit
3215 <dt class=
"hdlist1">
3220 show the fingerprint of the primary key whose subkey was used
3221 to sign a signed commit
3224 <dt class=
"hdlist1">
3229 show the trust level for the key used to sign a signed commit
3232 <dt class=
"hdlist1">
3237 reflog selector, e.g.,
<code>refs/stash@{
1}
</code> or
<code>refs/stash@{
2
3238 minutes ago}
</code>; the format follows the rules described for the
3239 <code>-g
</code> option. The portion before the
<code>@
</code> is the refname as
3240 given on the command line (so
<code>git log -g refs/heads/master
</code>
3241 would yield
<code>refs/heads/master@{
0}
</code>).
3244 <dt class=
"hdlist1">
3249 shortened reflog selector; same as
<code>%gD
</code>, but the refname
3250 portion is shortened for human readability (so
3251 <code>refs/heads/master
</code> becomes just
<code>master
</code>).
3254 <dt class=
"hdlist1">
3259 reflog identity name
3262 <dt class=
"hdlist1">
3267 reflog identity name (respecting .mailmap, see
3268 <a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
3271 <dt class=
"hdlist1">
3276 reflog identity email
3279 <dt class=
"hdlist1">
3284 reflog identity email (respecting .mailmap, see
3285 <a href=
"git-shortlog.html">git-shortlog(
1)
</a> or
<a href=
"git-blame.html">git-blame(
1)
</a>)
3288 <dt class=
"hdlist1">
3296 <dt class=
"hdlist1">
3297 <em>%(trailers[:
<options
>])
</em>
3301 display the trailers of the body as interpreted by
3302 <a href=
"git-interpret-trailers.html">git-interpret-trailers(
1)
</a>. The
<code>trailers
</code> string may be followed by
3303 a colon and zero or more comma-separated options. If any option is provided
3304 multiple times, the last occurrence wins.
3306 <div class=
"ulist"><ul>
3309 <em>key=
<key
></em>: only show trailers with specified
<key
>. Matching is done
3310 case-insensitively and trailing colon is optional. If option is
3311 given multiple times trailer lines matching any of the keys are
3312 shown. This option automatically enables the
<code>only
</code> option so that
3313 non-trailer lines in the trailer block are hidden. If that is not
3314 desired it can be disabled with
<code>only=false
</code>. E.g.,
3315 <code>%(trailers:key=Reviewed-by)
</code> shows trailer lines with key
3316 <code>Reviewed-by
</code>.
3321 <em>only[=
<bool
>]
</em>: select whether non-trailer lines from the trailer
3322 block should be included.
3327 <em>separator=
<sep
></em>: specify a separator inserted between trailer
3328 lines. When this option is not given each trailer line is
3329 terminated with a line feed character. The string
<sep
> may contain
3330 the literal formatting codes described above. To use comma as
3331 separator one must use
<code>%x2C
</code> as it would otherwise be parsed as
3332 next option. E.g.,
<code>%(trailers:key=Ticket,separator=%x2C )
</code>
3333 shows all trailer lines whose key is
"Ticket" separated by a comma
3339 <em>unfold[=
<bool
>]
</em>: make it behave as if interpret-trailer
’s
<code>--unfold
</code>
3340 option was given. E.g.,
3341 <code>%(trailers:only,unfold=true)
</code> unfolds and shows all trailer lines.
3346 <em>keyonly[=
<bool
>]
</em>: only show the key part of the trailer.
3351 <em>valueonly[=
<bool
>]
</em>: only show the value part of the trailer.
3356 <em>key_value_separator=
<sep
></em>: specify a separator inserted between
3357 trailer lines. When this option is not given each trailer key-value
3358 pair is separated by
": ". Otherwise it shares the same semantics
3359 as
<em>separator=
<sep
></em> above.
3369 <div class=
"admonitionblock">
3372 <div class=
"title">Note
</div>
3374 <td class=
"content">Some placeholders may depend on other options given to the
3375 revision traversal engine. For example, the
<code>%g*
</code> reflog options will
3376 insert an empty string unless we are traversing reflog entries (e.g., by
3377 <code>git log -g
</code>). The
<code>%d
</code> and
<code>%D
</code> placeholders will use the
"short"
3378 decoration format if
<code>--decorate
</code> was not already provided on the command
3382 <div class=
"paragraph"><p>The boolean options accept an optional value
<code>[=
<bool-value
>]
</code>. The values
3383 <code>true
</code>,
<code>false
</code>,
<code>on
</code>,
<code>off
</code> etc. are all accepted. See the
"boolean"
3384 sub-section in
"EXAMPLES" in
<a href=
"git-config.html">git-config(
1)
</a>. If a boolean
3385 option is given with no value, it
’s enabled.
</p></div>
3386 <div class=
"paragraph"><p>If you add a
<code>+
</code> (plus sign) after
<em>%
</em> of a placeholder, a line-feed
3387 is inserted immediately before the expansion if and only if the
3388 placeholder expands to a non-empty string.
</p></div>
3389 <div class=
"paragraph"><p>If you add a
<code>-
</code> (minus sign) after
<em>%
</em> of a placeholder, all consecutive
3390 line-feeds immediately preceding the expansion are deleted if and only if the
3391 placeholder expands to an empty string.
</p></div>
3392 <div class=
"paragraph"><p>If you add a ` ` (space) after
<em>%
</em> of a placeholder, a space
3393 is inserted immediately before the expansion if and only if the
3394 placeholder expands to a non-empty string.
</p></div>
3395 <div class=
"ulist"><ul>
3400 <div class=
"paragraph"><p>The
<em>tformat:
</em> format works exactly like
<em>format:
</em>, except that it
3401 provides
"terminator" semantics instead of
"separator" semantics. In
3402 other words, each commit has the message terminator character (usually a
3403 newline) appended, rather than a separator placed between entries.
3404 This means that the final entry of a single-line format will be properly
3405 terminated with a new line, just as the
"oneline" format does.
3406 For example:
</p></div>
3407 <div class=
"listingblock">
3408 <div class=
"content">
3409 <pre><code>$ git log -
2 --pretty=format:%h
4da45bef \
3410 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
3412 7134973 -- NO NEWLINE
3414 $ git log -
2 --pretty=tformat:%h
4da45bef \
3415 | perl -pe '$_ .=
" -- NO NEWLINE\n" unless /\n/'
3417 7134973</code></pre>
3419 <div class=
"paragraph"><p>In addition, any unrecognized string that has a
<code>%
</code> in it is interpreted
3420 as if it has
<code>tformat:
</code> in front of it. For example, these two are
3421 equivalent:
</p></div>
3422 <div class=
"listingblock">
3423 <div class=
"content">
3424 <pre><code>$ git log -
2 --pretty=tformat:%h
4da45bef
3425 $ git log -
2 --pretty=%h
4da45bef
</code></pre>
3432 <h2 id=
"_raw_output_format">Raw output format
</h2>
3433 <div class=
"sectionbody">
3434 <div class=
"paragraph"><p>The raw output format from
"git-diff-index",
"git-diff-tree",
3435 "git-diff-files" and
"git diff --raw" are very similar.
</p></div>
3436 <div class=
"paragraph"><p>These commands all compare two sets of things; what is
3437 compared differs:
</p></div>
3438 <div class=
"dlist"><dl>
3439 <dt class=
"hdlist1">
3440 git-diff-index
<tree-ish
>
3444 compares the
<tree-ish
> and the files on the filesystem.
3447 <dt class=
"hdlist1">
3448 git-diff-index --cached
<tree-ish
>
3452 compares the
<tree-ish
> and the index.
3455 <dt class=
"hdlist1">
3456 git-diff-tree [-r]
<tree-ish-
1> <tree-ish-
2> [
<pattern
>…]
3460 compares the trees named by the two arguments.
3463 <dt class=
"hdlist1">
3464 git-diff-files [
<pattern
>…]
3468 compares the index and the files on the filesystem.
3472 <div class=
"paragraph"><p>The
"git-diff-tree" command begins its output by printing the hash of
3473 what is being compared. After that, all the commands print one output
3474 line per changed file.
</p></div>
3475 <div class=
"paragraph"><p>An output line is formatted this way:
</p></div>
3476 <div class=
"listingblock">
3477 <div class=
"content">
3478 <pre><code>in-place edit :
100644 100644 bcd1234
0123456 M file0
3479 copy-edit :
100644 100644 abcd123
1234567 C68 file1 file2
3480 rename-edit :
100644 100644 abcd123
1234567 R86 file1 file3
3481 create :
000000 100644 0000000 1234567 A file4
3482 delete :
100644 000000 1234567 0000000 D file5
3483 unmerged :
000000 000000 0000000 0000000 U file6
</code></pre>
3485 <div class=
"paragraph"><p>That is, from the left to the right:
</p></div>
3486 <div class=
"olist arabic"><ol class=
"arabic">
3494 mode for
"src";
000000 if creation or unmerged.
3504 mode for
"dst";
000000 if deletion or unmerged.
3514 sha1 for
"src";
0{
40} if creation or unmerged.
3524 sha1 for
"dst";
0{
40} if deletion, unmerged or
"work tree out of sync with the index".
3534 status, followed by optional
"score" number.
3539 a tab or a NUL when
<code>-z
</code> option is used.
3549 a tab or a NUL when
<code>-z
</code> option is used; only exists for C or R.
3554 path for
"dst"; only exists for C or R.
3559 an LF or a NUL when
<code>-z
</code> option is used, to terminate the record.
3563 <div class=
"paragraph"><p>Possible status letters are:
</p></div>
3564 <div class=
"ulist"><ul>
3567 A: addition of a file
3572 C: copy of a file into a new one
3577 D: deletion of a file
3582 M: modification of the contents or mode of a file
3587 R: renaming of a file
3592 T: change in the type of the file (regular file, symbolic link or submodule)
3597 U: file is unmerged (you must complete the merge before it can
3603 X:
"unknown" change type (most probably a bug, please report it)
3607 <div class=
"paragraph"><p>Status letters C and R are always followed by a score (denoting the
3608 percentage of similarity between the source and target of the move or
3609 copy). Status letter M may be followed by a score (denoting the
3610 percentage of dissimilarity) for file rewrites.
</p></div>
3611 <div class=
"paragraph"><p>The sha1 for
"dst" is shown as all
0’s if a file on the filesystem
3612 is out of sync with the index.
</p></div>
3613 <div class=
"paragraph"><p>Example:
</p></div>
3614 <div class=
"listingblock">
3615 <div class=
"content">
3616 <pre><code>:
100644 100644 5be4a4a
0000000 M file.c
</code></pre>
3618 <div class=
"paragraph"><p>Without the
<code>-z
</code> option, pathnames with
"unusual" characters are
3619 quoted as explained for the configuration variable
<code>core.quotePath
</code>
3620 (see
<a href=
"git-config.html">git-config(
1)
</a>). Using
<code>-z
</code> the filename is output
3621 verbatim and the line is terminated by a NUL byte.
</p></div>
3625 <h2 id=
"_diff_format_for_merges">diff format for merges
</h2>
3626 <div class=
"sectionbody">
3627 <div class=
"paragraph"><p>"git-diff-tree",
"git-diff-files" and
"git-diff --raw"
3628 can take
<code>-c
</code> or
<code>--cc
</code> option
3629 to generate diff output also for merge commits. The output differs
3630 from the format described above in the following way:
</p></div>
3631 <div class=
"olist arabic"><ol class=
"arabic">
3634 there is a colon for each parent
3639 there are more
"src" modes and
"src" sha1
3644 status is concatenated status characters for each parent
3649 no optional
"score" number
3654 tab-separated pathname(s) of the file
3658 <div class=
"paragraph"><p>For
<code>-c
</code> and
<code>--cc
</code>, only the destination or final path is shown even
3659 if the file was renamed on any side of history. With
3660 <code>--combined-all-paths
</code>, the name of the path in each parent is shown
3661 followed by the name of the path in the merge commit.
</p></div>
3662 <div class=
"paragraph"><p>Examples for
<code>-c
</code> and
<code>--cc
</code> without
<code>--combined-all-paths
</code>:
</p></div>
3663 <div class=
"listingblock">
3664 <div class=
"content">
3665 <pre><code>::
100644 100644 100644 fabadb8 cc95eb0
4866510 MM desc.c
3666 ::
100755 100755 100755 52b7a2d
6d1ac04 d2ac7d7 RM bar.sh
3667 ::
100644 100644 100644 e07d6c5
9042e82 ee91881 RR phooey.c
</code></pre>
3669 <div class=
"paragraph"><p>Examples when
<code>--combined-all-paths
</code> added to either
<code>-c
</code> or
<code>--cc
</code>:
</p></div>
3670 <div class=
"listingblock">
3671 <div class=
"content">
3672 <pre><code>::
100644 100644 100644 fabadb8 cc95eb0
4866510 MM desc.c desc.c desc.c
3673 ::
100755 100755 100755 52b7a2d
6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh
3674 ::
100644 100644 100644 e07d6c5
9042e82 ee91881 RR fooey.c fuey.c phooey.c
</code></pre>
3676 <div class=
"paragraph"><p>Note that
<em>combined diff
</em> lists only files which were modified from
3677 all parents.
</p></div>
3681 <h2 id=
"generate_patch_text_with_p">Generating patch text with -p
</h2>
3682 <div class=
"sectionbody">
3683 <div class=
"paragraph"><p>Running
3684 <a href=
"git-diff.html">git-diff(
1)
</a>,
3685 <a href=
"git-log.html">git-log(
1)
</a>,
3686 <a href=
"git-show.html">git-show(
1)
</a>,
3687 <a href=
"git-diff-index.html">git-diff-index(
1)
</a>,
3688 <a href=
"git-diff-tree.html">git-diff-tree(
1)
</a>, or
3689 <a href=
"git-diff-files.html">git-diff-files(
1)
</a>
3690 with the
<code>-p
</code> option produces patch text.
3691 You can customize the creation of patch text via the
3692 <code>GIT_EXTERNAL_DIFF
</code> and the
<code>GIT_DIFF_OPTS
</code> environment variables
3693 (see
<a href=
"git.html">git(
1)
</a>), and the
<code>diff
</code> attribute (see
<a href=
"gitattributes.html">gitattributes(
5)
</a>).
</p></div>
3694 <div class=
"paragraph"><p>What the -p option produces is slightly different from the traditional
3695 diff format:
</p></div>
3696 <div class=
"olist arabic"><ol class=
"arabic">
3699 It is preceded by a
"git diff" header that looks like this:
3701 <div class=
"literalblock">
3702 <div class=
"content">
3703 <pre><code>diff --git a/file1 b/file2
</code></pre>
3705 <div class=
"paragraph"><p>The
<code>a/
</code> and
<code>b/
</code> filenames are the same unless rename/copy is
3706 involved. Especially, even for a creation or a deletion,
3707 <code>/dev/null
</code> is
<em>not
</em> used in place of the
<code>a/
</code> or
<code>b/
</code> filenames.
</p></div>
3708 <div class=
"paragraph"><p>When a rename/copy is involved,
<code>file1
</code> and
<code>file2
</code> show the
3709 name of the source file of the rename/copy and the name of
3710 the file that the rename/copy produces, respectively.
</p></div>
3714 It is followed by one or more extended header lines:
3716 <div class=
"literalblock">
3717 <div class=
"content">
3718 <pre><code>old mode
<mode
>
3719 new mode
<mode
>
3720 deleted file mode
<mode
>
3721 new file mode
<mode
>
3722 copy from
<path
>
3723 copy to
<path
>
3724 rename from
<path
>
3725 rename to
<path
>
3726 similarity index
<number
>
3727 dissimilarity index
<number
>
3728 index
<hash
>..
<hash
> <mode
></code></pre>
3730 <div class=
"paragraph"><p>File modes are printed as
6-digit octal numbers including the file type
3731 and file permission bits.
</p></div>
3732 <div class=
"paragraph"><p>Path names in extended headers do not include the
<code>a/
</code> and
<code>b/
</code> prefixes.
</p></div>
3733 <div class=
"paragraph"><p>The similarity index is the percentage of unchanged lines, and
3734 the dissimilarity index is the percentage of changed lines. It
3735 is a rounded down integer, followed by a percent sign. The
3736 similarity index value of
100% is thus reserved for two equal
3737 files, while
100% dissimilarity means that no line from the old
3738 file made it into the new one.
</p></div>
3739 <div class=
"paragraph"><p>The index line includes the blob object names before and after the change.
3740 The
<mode
> is included if the file mode does not change; otherwise,
3741 separate lines indicate the old and the new mode.
</p></div>
3745 Pathnames with
"unusual" characters are quoted as explained for
3746 the configuration variable
<code>core.quotePath
</code> (see
3747 <a href=
"git-config.html">git-config(
1)
</a>).
3752 All the
<code>file1
</code> files in the output refer to files before the
3753 commit, and all the
<code>file2
</code> files refer to files after the commit.
3754 It is incorrect to apply each change to each file sequentially. For
3755 example, this patch will swap a and b:
3757 <div class=
"literalblock">
3758 <div class=
"content">
3759 <pre><code>diff --git a/a b/b
3764 rename to a
</code></pre>
3769 Hunk headers mention the name of the function to which the hunk
3770 applies. See
"Defining a custom hunk-header" in
3771 <a href=
"gitattributes.html">gitattributes(
5)
</a> for details of how to tailor this to
3779 <h2 id=
"_combined_diff_format">Combined diff format
</h2>
3780 <div class=
"sectionbody">
3781 <div class=
"paragraph"><p>Any diff-generating command can take the
<code>-c
</code> or
<code>--cc
</code> option to
3782 produce a
<em>combined diff
</em> when showing a merge. This is the default
3783 format when showing merges with
<a href=
"git-diff.html">git-diff(
1)
</a> or
3784 <a href=
"git-show.html">git-show(
1)
</a>. Note also that you can give suitable
3785 <code>--diff-merges
</code> option to any of these commands to force generation of
3786 diffs in a specific format.
</p></div>
3787 <div class=
"paragraph"><p>A
"combined diff" format looks like this:
</p></div>
3788 <div class=
"listingblock">
3789 <div class=
"content">
3790 <pre><code>diff --combined describe.c
3791 index fabadb8,cc95eb0.
.4866510
3794 @@@ -
98,
20 -
98,
12 +
98,
20 @@@
3795 return (a_date
> b_date) ? -
1 : (a_date == b_date) ?
0 :
1;
3798 - static void describe(char *arg)
3799 -static void describe(struct commit *cmit, int last_one)
3800 ++static void describe(char *arg, int last_one)
3802 + unsigned char sha1[
20];
3803 + struct commit *cmit;
3804 struct commit_list *list;
3805 static int initialized =
0;
3806 struct commit_name *n;
3808 + if (get_sha1(arg, sha1)
< 0)
3809 + usage(describe_usage);
3810 + cmit = lookup_commit_reference(sha1);
3812 + usage(describe_usage);
3816 for_each_ref(get_name);
</code></pre>
3818 <div class=
"olist arabic"><ol class=
"arabic">
3821 It is preceded by a
"git diff" header, that looks like
3822 this (when the
<code>-c
</code> option is used):
3824 <div class=
"literalblock">
3825 <div class=
"content">
3826 <pre><code>diff --combined file
</code></pre>
3828 <div class=
"paragraph"><p>or like this (when the
<code>--cc
</code> option is used):
</p></div>
3829 <div class=
"literalblock">
3830 <div class=
"content">
3831 <pre><code>diff --cc file
</code></pre>
3836 It is followed by one or more extended header lines
3837 (this example shows a merge with two parents):
3839 <div class=
"literalblock">
3840 <div class=
"content">
3841 <pre><code>index
<hash
>,
<hash
>..
<hash
>
3842 mode
<mode
>,
<mode
>..
<mode
>
3843 new file mode
<mode
>
3844 deleted file mode
<mode
>,
<mode
></code></pre>
3846 <div class=
"paragraph"><p>The
<code>mode
<mode
>,
<mode
>..
<mode
></code> line appears only if at least one of
3847 the
<mode
> is different from the rest. Extended headers with
3848 information about detected content movement (renames and
3849 copying detection) are designed to work with the diff of two
3850 <tree-ish
> and are not used by combined diff format.
</p></div>
3854 It is followed by a two-line from-file/to-file header:
3856 <div class=
"literalblock">
3857 <div class=
"content">
3858 <pre><code>--- a/file
3859 +++ b/file
</code></pre>
3861 <div class=
"paragraph"><p>Similar to the two-line header for the traditional
<em>unified
</em> diff
3862 format,
<code>/dev/null
</code> is used to signal created or deleted
3864 <div class=
"paragraph"><p>However, if the --combined-all-paths option is provided, instead of a
3865 two-line from-file/to-file, you get an N+
1 line from-file/to-file header,
3866 where N is the number of parents in the merge commit:
</p></div>
3867 <div class=
"literalblock">
3868 <div class=
"content">
3869 <pre><code>--- a/file
3872 +++ b/file
</code></pre>
3874 <div class=
"paragraph"><p>This extended format can be useful if rename or copy detection is
3875 active, to allow you to see the original name of the file in different
3880 Chunk header format is modified to prevent people from
3881 accidentally feeding it to
<code>patch -p1
</code>. Combined diff format
3882 was created for review of merge commit changes, and was not
3883 meant to be applied. The change is similar to the change in the
3884 extended
<em>index
</em> header:
3886 <div class=
"literalblock">
3887 <div class=
"content">
3888 <pre><code>@@@
<from-file-range
> <from-file-range
> <to-file-range
> @@@
</code></pre>
3890 <div class=
"paragraph"><p>There are (number of parents +
1)
<code>@
</code> characters in the chunk
3891 header for combined diff format.
</p></div>
3894 <div class=
"paragraph"><p>Unlike the traditional
<em>unified
</em> diff format, which shows two
3895 files A and B with a single column that has
<code>-
</code> (minus
 — appears in A but removed in B),
<code>+
</code> (plus
 — missing in A but
3896 added to B), or
<code>" "</code> (space
 — unchanged) prefix, this format
3897 compares two or more files file1, file2,
… with one file X, and
3898 shows how X differs from each of fileN. One column for each of
3899 fileN is prepended to the output line to note how X
’s line is
3900 different from it.
</p></div>
3901 <div class=
"paragraph"><p>A
<code>-
</code> character in the column N means that the line appears in
3902 fileN but it does not appear in the result. A
<code>+
</code> character
3903 in the column N means that the line appears in the result,
3904 and fileN does not have that line (in other words, the line was
3905 added, from the point of view of that parent).
</p></div>
3906 <div class=
"paragraph"><p>In the above example output, the function signature was changed
3907 from both files (hence two
<code>-
</code> removals from both file1 and
3908 file2, plus
<code>++
</code> to mean one line that was added does not appear
3909 in either file1 or file2). Also, eight other lines are the same
3910 from file1 but do not appear in file2 (hence prefixed with
<code>+
</code>).
</p></div>
3911 <div class=
"paragraph"><p>When shown by
<code>git diff-tree -c
</code>, it compares the parents of a
3912 merge commit with the merge result (i.e. file1..fileN are the
3913 parents). When shown by
<code>git diff-files -c
</code>, it compares the
3914 two unresolved merge parents with the working tree file
3915 (i.e. file1 is stage
2 aka
"our version", file2 is stage
3 aka
3916 "their version").
</p></div>
3920 <h2 id=
"_other_diff_formats">other diff formats
</h2>
3921 <div class=
"sectionbody">
3922 <div class=
"paragraph"><p>The
<code>--summary
</code> option describes newly added, deleted, renamed and
3923 copied files. The
<code>--stat
</code> option adds diffstat(
1) graph to the
3924 output. These options can be combined with other options, such as
3925 <code>-p
</code>, and are meant for human consumption.
</p></div>
3926 <div class=
"paragraph"><p>When showing a change that involves a rename or a copy,
<code>--stat
</code> output
3927 formats the pathnames compactly by combining common prefix and suffix of
3928 the pathnames. For example, a change that moves
<code>arch/i386/Makefile
</code> to
3929 <code>arch/x86/Makefile
</code> while modifying
4 lines will be shown like this:
</p></div>
3930 <div class=
"listingblock">
3931 <div class=
"content">
3932 <pre><code>arch/{i386 =
> x86}/Makefile |
4 +--
</code></pre>
3934 <div class=
"paragraph"><p>The
<code>--numstat
</code> option gives the diffstat(
1) information but is designed
3935 for easier machine consumption. An entry in
<code>--numstat
</code> output looks
3936 like this:
</p></div>
3937 <div class=
"listingblock">
3938 <div class=
"content">
3939 <pre><code>1 2 README
3940 3 1 arch/{i386 =
> x86}/Makefile
</code></pre>
3942 <div class=
"paragraph"><p>That is, from left to right:
</p></div>
3943 <div class=
"olist arabic"><ol class=
"arabic">
3946 the number of added lines;
3956 the number of deleted lines;
3966 pathname (possibly with rename/copy information);
3975 <div class=
"paragraph"><p>When
<code>-z
</code> output option is in effect, the output is formatted this way:
</p></div>
3976 <div class=
"listingblock">
3977 <div class=
"content">
3978 <pre><code>1 2 README NUL
3979 3 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL
</code></pre>
3981 <div class=
"paragraph"><p>That is:
</p></div>
3982 <div class=
"olist arabic"><ol class=
"arabic">
3985 the number of added lines;
3995 the number of deleted lines;
4005 a NUL (only exists if renamed/copied);
4010 pathname in preimage;
4015 a NUL (only exists if renamed/copied);
4020 pathname in postimage (only exists if renamed/copied);
4029 <div class=
"paragraph"><p>The extra
<code>NUL
</code> before the preimage path in renamed case is to allow
4030 scripts that read the output to tell if the current record being read is
4031 a single-path record or a rename/copy record without reading ahead.
4032 After reading added and deleted lines, reading up to
<code>NUL
</code> would yield
4033 the pathname, but if that is
<code>NUL
</code>, the record will show two paths.
</p></div>
4037 <h2 id=
"_git">GIT
</h2>
4038 <div class=
"sectionbody">
4039 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
4043 <div id=
"footnotes"><hr /></div>
4045 <div id=
"footer-text">
4047 2023-
10-
23 14:
43:
46 PDT