blob: fa2765926e586362423521f14340fbbd0d42b272 [file] [log] [blame]
Junio C Hamano96153bf2018-04-25 08:25:341<?xml version="1.0" encoding="UTF-8"?>
Junio C Hamano1a4e8412005-12-27 08:17:232<!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">
5<head>
Junio C Hamano9629d4f2012-12-19 00:28:276<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamano98c882d2020-08-13 22:06:577<meta name="generator" content="AsciiDoc 9.0.0rc2" />
Junio C Hamano68cf15a2010-11-06 01:01:598<title>git-diff-index(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:239<style type="text/css">
Junio C Hamano9629d4f2012-12-19 00:28:2710/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
11
12/* Default font. */
13body {
14 font-family: Georgia,serif;
15}
16
17/* Title font. */
18h1, h2, h3, h4, h5, h6,
19div.title, caption.title,
20thead, p.table.header,
21#toctitle,
22#author, #revnumber, #revdate, #revremark,
23#footer {
24 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2325}
26
27body {
28 margin: 1em 5% 1em 5%;
29}
30
Junio C Hamanoba4b9282008-07-06 05:20:3131a {
32 color: blue;
33 text-decoration: underline;
34}
35a:visited {
36 color: fuchsia;
37}
Junio C Hamano1a4e8412005-12-27 08:17:2338
39em {
40 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5941 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2342}
43
44strong {
45 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5946 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2347}
48
Junio C Hamano1a4e8412005-12-27 08:17:2349h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2351 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
54}
55
Junio C Hamanoba4b9282008-07-06 05:20:3156h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2357 border-bottom: 2px solid silver;
58}
59h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2360 padding-top: 0.5em;
61}
Junio C Hamanoba4b9282008-07-06 05:20:3162h3 {
63 float: left;
64}
65h3 + * {
66 clear: left;
67}
Junio C Hamano9629d4f2012-12-19 00:28:2768h5 {
69 font-size: 1.0em;
70}
Junio C Hamano1a4e8412005-12-27 08:17:2371
72div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2373 margin-left: 0;
74}
75
76hr {
77 border: 1px solid silver;
78}
79
80p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
83}
84
Junio C Hamano68cf15a2010-11-06 01:01:5985ul, ol, li > p {
86 margin-top: 0;
87}
Junio C Hamano9629d4f2012-12-19 00:28:2788ul > li { color: #aaa; }
89ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5990
Junio C Hamanoc14e6ad2014-10-31 20:25:5391.monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2395 padding: 0;
96 margin: 0;
97}
Junio C Hamanoc14e6ad2014-10-31 20:25:5398pre {
99 white-space: pre-wrap;
100}
Junio C Hamano1a4e8412005-12-27 08:17:23101
Junio C Hamano9629d4f2012-12-19 00:28:27102#author {
Junio C Hamano1a4e8412005-12-27 08:17:23103 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23104 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31105 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23106}
Junio C Hamano9629d4f2012-12-19 00:28:27107#email {
Junio C Hamano1a4e8412005-12-27 08:17:23108}
Junio C Hamano9629d4f2012-12-19 00:28:27109#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23110}
111
Junio C Hamano9629d4f2012-12-19 00:28:27112#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
117}
Junio C Hamano9629d4f2012-12-19 00:28:27118#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23119 float: left;
120 padding-bottom: 0.5em;
121}
Junio C Hamano9629d4f2012-12-19 00:28:27122#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23123 float: right;
124 padding-bottom: 0.5em;
125}
126
Junio C Hamano9629d4f2012-12-19 00:28:27127#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
130}
Junio C Hamano9629d4f2012-12-19 00:28:27131div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23132div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22134 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23135 margin-bottom: 1.5em;
136}
137div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23142}
143
144div.content { /* Block element content. */
145 padding: 0;
146}
147
148/* Block element titles. */
149div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59150 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
155}
156div.title + * {
157 margin-top: 0;
158}
159
160td div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content div.title:first-child {
164 margin-top: 0.0em;
165}
166div.content + div.title {
167 margin-top: 0.0em;
168}
169
170div.sidebarblock > div.content {
171 background: #ffffee;
Junio C Hamano9629d4f2012-12-19 00:28:27172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23174 padding: 0.5em;
175}
176
177div.listingblock > div.content {
Junio C Hamano9629d4f2012-12-19 00:28:27178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23181 padding: 0.5em;
182}
183
Junio C Hamano7bd050f2011-09-22 06:32:22184div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59187 margin-right: 10%;
Junio C Hamano9629d4f2012-12-19 00:28:27188 border-left: 5px solid #f0f0f0;
189 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23190}
Junio C Hamano7bd050f2011-09-22 06:32:22191
Junio C Hamano68cf15a2010-11-06 01:01:59192div.quoteblock > div.attribution {
193 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23194 text-align: right;
195}
Junio C Hamano68cf15a2010-11-06 01:01:59196
Junio C Hamano9629d4f2012-12-19 00:28:27197div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59200}
201div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
204}
205/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31206div.verseblock + div.attribution {
207 text-align: left;
208}
Junio C Hamano1a4e8412005-12-27 08:17:23209
210div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
217}
218div.admonitionblock td.content {
219 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22220 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23221}
222
223div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227
Junio C Hamano1a4e8412005-12-27 08:17:23228div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53229span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano68cf15a2010-11-06 01:01:59230a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23231
232dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
235}
236dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59239 font-style: normal;
240 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23241}
242dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59243 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23244}
245
246ul, ol {
247 list-style-position: outside;
248}
Junio C Hamano68cf15a2010-11-06 01:01:59249ol.arabic {
250 list-style-type: decimal;
251}
252ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23253 list-style-type: lower-alpha;
254}
Junio C Hamano68cf15a2010-11-06 01:01:59255ol.upperalpha {
256 list-style-type: upper-alpha;
257}
258ol.lowerroman {
259 list-style-type: lower-roman;
260}
261ol.upperroman {
262 list-style-type: upper-roman;
263}
264
265div.compact ul, div.compact ol,
266div.compact p, div.compact p,
267div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
270}
Junio C Hamano1a4e8412005-12-27 08:17:23271
Junio C Hamano1a4e8412005-12-27 08:17:23272tfoot {
273 font-weight: bold;
274}
Junio C Hamano68cf15a2010-11-06 01:01:59275td > div.verse {
276 white-space: pre;
277}
Junio C Hamano68cf15a2010-11-06 01:01:59278
279div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
282}
Junio C Hamano68cf15a2010-11-06 01:01:59283div.hdlist tr {
284 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31285}
Junio C Hamano68cf15a2010-11-06 01:01:59286dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
288}
289td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23290 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59291 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23292 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59293 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23294}
Junio C Hamano68cf15a2010-11-06 01:01:59295td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23296 vertical-align: top;
297}
Junio C Hamano68cf15a2010-11-06 01:01:59298div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
301}
302
303.comment {
304 background: yellow;
305}
Junio C Hamano1a4e8412005-12-27 08:17:23306
Junio C Hamano7bd050f2011-09-22 06:32:22307.footnote, .footnoteref {
308 font-size: 0.8em;
309}
310
311span.footnote, span.footnoteref {
312 vertical-align: super;
313}
314
315#footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
318}
319
320#footnotes div.footnote {
321 margin: 0 0 5px 0;
322}
323
324#footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
332}
333
Junio C Hamano9629d4f2012-12-19 00:28:27334div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
338}
339div.colist td img {
340 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23341}
Junio C Hamanoba4b9282008-07-06 05:20:31342
Junio C Hamano9629d4f2012-12-19 00:28:27343@media print {
344 #footer-badges { display: none; }
345}
346
347#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22348 margin-bottom: 2.5em;
349}
350
Junio C Hamano9629d4f2012-12-19 00:28:27351#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31352 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
357}
358
Junio C Hamanoc14e6ad2014-10-31 20:25:53359div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31360 margin-top: 0;
361 margin-bottom: 0;
362}
363div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
366}
367div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
370}
371div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
374}
Junio C Hamano9629d4f2012-12-19 00:28:27375
376span.aqua { color: aqua; }
377span.black { color: black; }
378span.blue { color: blue; }
379span.fuchsia { color: fuchsia; }
380span.gray { color: gray; }
381span.green { color: green; }
382span.lime { color: lime; }
383span.maroon { color: maroon; }
384span.navy { color: navy; }
385span.olive { color: olive; }
386span.purple { color: purple; }
387span.red { color: red; }
388span.silver { color: silver; }
389span.teal { color: teal; }
390span.white { color: white; }
391span.yellow { color: yellow; }
392
393span.aqua-background { background: aqua; }
394span.black-background { background: black; }
395span.blue-background { background: blue; }
396span.fuchsia-background { background: fuchsia; }
397span.gray-background { background: gray; }
398span.green-background { background: green; }
399span.lime-background { background: lime; }
400span.maroon-background { background: maroon; }
401span.navy-background { background: navy; }
402span.olive-background { background: olive; }
403span.purple-background { background: purple; }
404span.red-background { background: red; }
405span.silver-background { background: silver; }
406span.teal-background { background: teal; }
407span.white-background { background: white; }
408span.yellow-background { background: yellow; }
409
410span.big { font-size: 2em; }
411span.small { font-size: 0.6em; }
412
413span.underline { text-decoration: underline; }
414span.overline { text-decoration: overline; }
415span.line-through { text-decoration: line-through; }
416
Junio C Hamanoc14e6ad2014-10-31 20:25:53417div.unbreakable { page-break-inside: avoid; }
418
Junio C Hamano9629d4f2012-12-19 00:28:27419
420/*
421 * xhtml11 specific
422 *
423 * */
424
425div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
428}
429div.tableblock > table {
430 border: 3px solid #527bbd;
431}
432thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
435}
436p.table {
437 margin-top: 0;
438}
Junio C Hamano725b0da2020-01-22 22:02:40439/* Because the table frame attribute is overridden by CSS in most browsers. */
Junio C Hamano9629d4f2012-12-19 00:28:27440div.tableblock > table[frame="void"] {
441 border-style: none;
442}
443div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
446}
447div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
450}
451
452
453/*
454 * html5 specific
455 *
456 * */
457
458table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
461}
462thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
465}
466p.tableblock {
467 margin-top: 0;
468}
469table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
475}
476th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
481}
482
483table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
486}
487table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
490}
491table.tableblock.frame-none {
492 border-style: hidden;
493}
494
495th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
497}
498th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
500}
501th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
503}
504
505th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
507}
508th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
510}
511th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
513}
514
515
516/*
517 * manpage specific
518 *
519 * */
520
521body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
526}
Junio C Hamano9629d4f2012-12-19 00:28:27527body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59528 border-style: none;
529}
Junio C Hamano9629d4f2012-12-19 00:28:27530body.manpage div.sectionbody {
531 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59532}
533
534@media print {
Junio C Hamano9629d4f2012-12-19 00:28:27535 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59536}
Junio C Hamanoc14e6ad2014-10-31 20:25:53537
538
Junio C Hamano1a4e8412005-12-27 08:17:23539</style>
Junio C Hamano7bd050f2011-09-22 06:32:22540<script type="text/javascript">
541/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22542var asciidoc = { // Namespace.
543
544/////////////////////////////////////////////////////////////////////
545// Table Of Contents generator
546/////////////////////////////////////////////////////////////////////
547
548/* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
550 *
551 * Table Of Content generator
552 * Version: 0.4
553 *
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.
556 */
557
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
560
561// toclevels = 1..4.
562toc: function (toclevels) {
563
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
571 }
572 return text;
573 }
574
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
579 }
580
581 function tocEntries(el, toclevels) {
582 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
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);
593 }
594 iterate(i);
595 }
596 }
597 }
598 iterate(el);
599 return result;
600 }
601
602 var toc = document.getElementById("toc");
Junio C Hamano9629d4f2012-12-19 00:28:27603 if (!toc) {
604 return;
605 }
606
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53612 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9629d4f2012-12-19 00:28:27613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
616 }
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
619 }
620
621 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22622 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");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
634 }
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
637},
638
639
640/////////////////////////////////////////////////////////////////////
641// Footnotes generator
642/////////////////////////////////////////////////////////////////////
643
644/* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
646 */
647
648footnotes: function () {
Junio C Hamano9629d4f2012-12-19 00:28:27649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22651 var noteholder = document.getElementById("footnotes");
Junio C Hamano9629d4f2012-12-19 00:28:27652 if (!noteholder) {
653 return;
654 }
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9629d4f2012-12-19 00:28:27659 entriesToRemove.push(entry);
660 }
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
663 }
664
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
Junio C Hamano9629d4f2012-12-19 00:28:27673 var note = spans[i].getAttribute("data-note");
674 if (!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];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
682 }
Junio C Hamano7bd050f2011-09-22 06:32:22683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
689 }
690 }
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
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.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
703 }
704 }
705 }
Junio C Hamano9629d4f2012-12-19 00:28:27706},
707
708install: function(toclevels) {
709 var timerId;
710
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
715 }
716 }
717
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
721 }
722
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22728}
729
730}
Junio C Hamano9629d4f2012-12-19 00:28:27731asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22732/*]]>*/
733</script>
Junio C Hamano1a4e8412005-12-27 08:17:23734</head>
Junio C Hamano9629d4f2012-12-19 00:28:27735<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23736<div id="header">
737<h1>
738git-diff-index(1) Manual Page
739</h1>
740<h2>NAME</h2>
741<div class="sectionbody">
742<p>git-diff-index -
Junio C Hamano7e590a12013-06-02 23:46:52743 Compare a tree to the working tree or index
Junio C Hamano1a4e8412005-12-27 08:17:23744</p>
745</div>
746</div>
Junio C Hamano7bd050f2011-09-22 06:32:22747<div id="content">
Junio C Hamano9629d4f2012-12-19 00:28:27748<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59749<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23750<div class="sectionbody">
Junio C Hamano15567bc2011-07-23 00:51:59751<div class="verseblock">
Junio C Hamanodf3d3cd2020-11-02 22:05:05752<pre class="content"><em>git diff-index</em> [-m] [--cached] [--merge-base] [&lt;common diff options&gt;] &lt;tree-ish&gt; [&lt;path&gt;&#8230;]</pre>
Junio C Hamano9629d4f2012-12-19 00:28:27753<div class="attribution">
Junio C Hamano15567bc2011-07-23 00:51:59754</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23755</div>
Junio C Hamano9629d4f2012-12-19 00:28:27756</div>
757<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31758<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23759<div class="sectionbody">
Junio C Hamano7e590a12013-06-02 23:46:52760<div class="paragraph"><p>Compares the content and mode of the blobs found in a tree object
761with the corresponding tracked files in the working tree, or with the
762corresponding paths in the index. When &lt;path&gt; arguments are present,
763compares only paths matching those patterns. Otherwise all tracked
764files are compared.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23765</div>
Junio C Hamano9629d4f2012-12-19 00:28:27766</div>
767<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31768<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23769<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59770<div class="dlist"><dl>
771<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23772-p
773</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59774<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22775-u
776</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59777<dt class="hdlist1">
Junio C Hamanoe97d5772010-05-19 08:13:58778--patch
779</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23780<dd>
781<p>
Junio C Hamanoff979792007-11-16 10:11:30782 Generate patch (see section on generating patches).
Junio C Hamano1a4e8412005-12-27 08:17:23783</p>
784</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59785<dt class="hdlist1">
Junio C Hamano58f587a2013-07-22 19:20:59786-s
787</dt>
788<dt class="hdlist1">
789--no-patch
790</dt>
791<dd>
792<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53793 Suppress diff output. Useful for commands like <code>git show</code> that
794 show the patch by default, or to cancel the effect of <code>--patch</code>.
Junio C Hamano58f587a2013-07-22 19:20:59795</p>
796</dd>
797<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34798-U&lt;n&gt;
799</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59800<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34801--unified=&lt;n&gt;
802</dt>
803<dd>
804<p>
805 Generate diffs with &lt;n&gt; lines of context instead of
Junio C Hamano11f15372019-03-07 03:17:00806 the usual three. Implies <code>--patch</code>.
Junio C Hamanoc14e6ad2014-10-31 20:25:53807 Implies <code>-p</code>.
Junio C Hamano69361562007-07-26 02:14:34808</p>
809</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59810<dt class="hdlist1">
Junio C Hamano11f15372019-03-07 03:17:00811--output=&lt;file&gt;
812</dt>
813<dd>
814<p>
815 Output to a specific file instead of stdout.
816</p>
817</dd>
818<dt class="hdlist1">
819--output-indicator-new=&lt;char&gt;
820</dt>
821<dt class="hdlist1">
822--output-indicator-old=&lt;char&gt;
823</dt>
824<dt class="hdlist1">
825--output-indicator-context=&lt;char&gt;
826</dt>
827<dd>
828<p>
829 Specify the character used to indicate new, old or context
830 lines in the generated patch. Normally they are <em>+</em>, <em>-</em> and
831 ' ' respectively.
832</p>
833</dd>
834<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34835--raw
836</dt>
837<dd>
838<p>
Junio C Hamano85f1fde2015-06-01 20:37:32839 Generate the diff in raw format.
Junio C Hamano1dbca522015-05-22 20:48:55840 This is the default.
Junio C Hamano9ae1a062006-07-10 08:12:34841</p>
842</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59843<dt class="hdlist1">
Junio C Hamano54559c82006-04-13 07:45:12844--patch-with-raw
845</dt>
846<dd>
847<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53848 Synonym for <code>-p --raw</code>.
Junio C Hamano54559c82006-04-13 07:45:12849</p>
850</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59851<dt class="hdlist1">
Junio C Hamanoad70bf02016-09-26 23:44:27852--indent-heuristic
853</dt>
Junio C Hamanoa65b6762017-11-06 04:45:42854<dd>
855<p>
Junio C Hamano14e66832018-06-18 18:32:19856 Enable the heuristic that shifts diff hunk boundaries to make patches
Junio C Hamanoa65b6762017-11-06 04:45:42857 easier to read. This is the default.
858</p>
859</dd>
Junio C Hamanoad70bf02016-09-26 23:44:27860<dt class="hdlist1">
861--no-indent-heuristic
862</dt>
Junio C Hamano5f888332016-06-13 19:28:31863<dd>
864<p>
Junio C Hamanoa65b6762017-11-06 04:45:42865 Disable the indent heuristic.
Junio C Hamano5f888332016-06-13 19:28:31866</p>
867</dd>
868<dt class="hdlist1">
Junio C Hamano5a73f302011-10-14 05:58:34869--minimal
870</dt>
871<dd>
872<p>
873 Spend extra time to make sure the smallest possible
874 diff is produced.
875</p>
876</dd>
877<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02878--patience
879</dt>
880<dd>
881<p>
882 Generate a diff using the "patience diff" algorithm.
883</p>
884</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59885<dt class="hdlist1">
Junio C Hamanoaea9e6b2012-03-07 00:17:11886--histogram
887</dt>
888<dd>
889<p>
890 Generate a diff using the "histogram diff" algorithm.
891</p>
892</dd>
893<dt class="hdlist1">
Junio C Hamano047135e2017-12-19 21:57:54894--anchored=&lt;text&gt;
895</dt>
896<dd>
897<p>
898 Generate a diff using the "anchored diff" algorithm.
899</p>
900<div class="paragraph"><p>This option may be specified more than once.</p></div>
901<div class="paragraph"><p>If a line exists in both the source and destination, exists only once,
902and starts with this text, this algorithm attempts to prevent it from
903appearing as a deletion or addition in the output. It uses the "patience
904diff" algorithm internally.</p></div>
905</dd>
906<dt class="hdlist1">
Junio C Hamano80ad00d2013-02-18 00:19:03907--diff-algorithm={patience|minimal|histogram|myers}
908</dt>
909<dd>
910<p>
911 Choose a diff algorithm. The variants are as follows:
912</p>
913<div class="openblock">
914<div class="content">
915<div class="dlist"><dl>
916<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53917<code>default</code>, <code>myers</code>
Junio C Hamano80ad00d2013-02-18 00:19:03918</dt>
919<dd>
920<p>
921 The basic greedy diff algorithm. Currently, this is the default.
922</p>
923</dd>
924<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53925<code>minimal</code>
Junio C Hamano80ad00d2013-02-18 00:19:03926</dt>
927<dd>
928<p>
929 Spend extra time to make sure the smallest possible diff is
930 produced.
931</p>
932</dd>
933<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53934<code>patience</code>
Junio C Hamano80ad00d2013-02-18 00:19:03935</dt>
936<dd>
937<p>
938 Use "patience diff" algorithm when generating patches.
939</p>
940</dd>
941<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53942<code>histogram</code>
Junio C Hamano80ad00d2013-02-18 00:19:03943</dt>
944<dd>
945<p>
946 This algorithm extends the patience algorithm to "support
947 low-occurrence common elements".
948</p>
949</dd>
950</dl></div>
951</div></div>
Junio C Hamano14e66832018-06-18 18:32:19952<div class="paragraph"><p>For instance, if you configured the <code>diff.algorithm</code> variable to a
Junio C Hamano80ad00d2013-02-18 00:19:03953non-default value and want to use the default one, then you
Junio C Hamanoc14e6ad2014-10-31 20:25:53954have to use <code>--diff-algorithm=default</code> option.</p></div>
Junio C Hamano80ad00d2013-02-18 00:19:03955</dd>
956<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32957--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamanoba7c8d82006-04-15 06:17:42958</dt>
959<dd>
960<p>
Junio C Hamanoaea9e6b2012-03-07 00:17:11961 Generate a diffstat. By default, as much space as necessary
962 will be used for the filename part, and the rest for the graph
963 part. Maximum width defaults to terminal width, or 80 columns
Junio C Hamano7f2b3cb2012-06-22 22:42:39964 if not connected to a terminal, and can be overridden by
Junio C Hamanoc14e6ad2014-10-31 20:25:53965 <code>&lt;width&gt;</code>. The width of the filename part can be limited by
966 giving another width <code>&lt;name-width&gt;</code> after a comma. The width
Junio C Hamanoaea9e6b2012-03-07 00:17:11967 of the graph part can be limited by using
Junio C Hamanoc14e6ad2014-10-31 20:25:53968 <code>--stat-graph-width=&lt;width&gt;</code> (affects all commands generating
969 a stat graph) or by setting <code>diff.statGraphWidth=&lt;width&gt;</code>
970 (does not affect <code>git format-patch</code>).
971 By giving a third parameter <code>&lt;count&gt;</code>, you can limit the
972 output to the first <code>&lt;count&gt;</code> lines, followed by <code>...</code> if
Junio C Hamanoaea9e6b2012-03-07 00:17:11973 there are more.
Junio C Hamanoba7c8d82006-04-15 06:17:42974</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53975<div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=&lt;width&gt;</code>,
976<code>--stat-name-width=&lt;name-width&gt;</code> and <code>--stat-count=&lt;count&gt;</code>.</p></div>
Junio C Hamanoba7c8d82006-04-15 06:17:42977</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59978<dt class="hdlist1">
Junio C Hamano45badf02018-03-14 21:56:41979--compact-summary
980</dt>
981<dd>
982<p>
983 Output a condensed summary of extended header information such
984 as file creations or deletions ("new" or "gone", optionally "+l"
985 if it&#8217;s a symlink) and mode changes ("+x" or "-x" for adding
986 or removing executable bit respectively) in diffstat. The
Junio C Hamanofa2915c2018-06-19 19:50:18987 information is put between the filename part and the graph
Junio C Hamano45badf02018-03-14 21:56:41988 part. Implies <code>--stat</code>.
989</p>
990</dd>
991<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48992--numstat
993</dt>
994<dd>
995<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53996 Similar to <code>--stat</code>, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:48997 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43998 abbreviation, to make it more machine friendly. For
Junio C Hamanoc14e6ad2014-10-31 20:25:53999 binary files, outputs two <code>-</code> instead of saying
1000 <code>0 0</code>.
Junio C Hamanofbe00522006-10-19 05:58:481001</p>
1002</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591003<dt class="hdlist1">
Junio C Hamano7d23f5e2006-12-16 07:44:041004--shortstat
1005</dt>
1006<dd>
1007<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531008 Output only the last line of the <code>--stat</code> format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:041009 number of modified files, as well as number of added and deleted
1010 lines.
1011</p>
1012</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591013<dt class="hdlist1">
Junio C Hamano11f15372019-03-07 03:17:001014-X[&lt;param1,param2,&#8230;&gt;]
1015</dt>
1016<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:321017--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:031018</dt>
1019<dd>
1020<p>
Junio C Hamano1c222c52011-05-13 19:55:321021 Output the distribution of relative amount of changes for each
Junio C Hamanoc14e6ad2014-10-31 20:25:531022 sub-directory. The behavior of <code>--dirstat</code> can be customized by
Junio C Hamano1c222c52011-05-13 19:55:321023 passing it a comma separated list of parameters.
Junio C Hamanoc14e6ad2014-10-31 20:25:531024 The defaults are controlled by the <code>diff.dirstat</code> configuration
Junio C Hamanoa28a9202012-06-21 07:08:231025 variable (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1c222c52011-05-13 19:55:321026 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:031027</p>
Junio C Hamano9629d4f2012-12-19 00:28:271028<div class="openblock">
1029<div class="content">
Junio C Hamano1c222c52011-05-13 19:55:321030<div class="dlist"><dl>
1031<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531032<code>changes</code>
Junio C Hamano1c222c52011-05-13 19:55:321033</dt>
1034<dd>
1035<p>
1036 Compute the dirstat numbers by counting the lines that have been
1037 removed from the source, or added to the destination. This ignores
1038 the amount of pure code movements within a file. In other words,
1039 rearranging lines in a file is not counted as much as other changes.
1040 This is the default behavior when no parameter is given.
1041</p>
Junio C Hamano6a45be92008-04-22 08:19:031042</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591043<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531044<code>lines</code>
Junio C Hamanoa476efa2008-10-10 15:31:421045</dt>
1046<dd>
1047<p>
Junio C Hamano1c222c52011-05-13 19:55:321048 Compute the dirstat numbers by doing the regular line-based diff
1049 analysis, and summing the removed/added line counts. (For binary
1050 files, count 64-byte chunks instead, since binary files have no
Junio C Hamanoc14e6ad2014-10-31 20:25:531051 natural concept of lines). This is a more expensive <code>--dirstat</code>
1052 behavior than the <code>changes</code> behavior, but it does count rearranged
Junio C Hamano1c222c52011-05-13 19:55:321053 lines within a file as much as other changes. The resulting output
Junio C Hamanoc14e6ad2014-10-31 20:25:531054 is consistent with what you get from the other <code>--*stat</code> options.
Junio C Hamanoa476efa2008-10-10 15:31:421055</p>
1056</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591057<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531058<code>files</code>
Junio C Hamano1c222c52011-05-13 19:55:321059</dt>
1060<dd>
1061<p>
1062 Compute the dirstat numbers by counting the number of files changed.
1063 Each changed file counts equally in the dirstat analysis. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531064 the computationally cheapest <code>--dirstat</code> behavior, since it does
Junio C Hamano1c222c52011-05-13 19:55:321065 not have to look at the file contents at all.
1066</p>
1067</dd>
1068<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531069<code>cumulative</code>
Junio C Hamano1c222c52011-05-13 19:55:321070</dt>
1071<dd>
1072<p>
1073 Count changes in a child directory for the parent directory as well.
Junio C Hamanoc14e6ad2014-10-31 20:25:531074 Note that when using <code>cumulative</code>, the sum of the percentages
Junio C Hamano1c222c52011-05-13 19:55:321075 reported may exceed 100%. The default (non-cumulative) behavior can
Junio C Hamanoc14e6ad2014-10-31 20:25:531076 be specified with the <code>noncumulative</code> parameter.
Junio C Hamano1c222c52011-05-13 19:55:321077</p>
1078</dd>
1079<dt class="hdlist1">
1080&lt;limit&gt;
1081</dt>
1082<dd>
1083<p>
1084 An integer parameter specifies a cut-off percent (3% by default).
1085 Directories contributing less than this percentage of the changes
1086 are not shown in the output.
1087</p>
1088</dd>
1089</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271090</div></div>
Junio C Hamano1c222c52011-05-13 19:55:321091<div class="paragraph"><p>Example: The following will count changed files, while ignoring
1092directories with less than 10% of the total amount of changed files,
1093and accumulating child directory counts in the parent directories:
Junio C Hamanoc14e6ad2014-10-31 20:25:531094<code>--dirstat=files,10,cumulative</code>.</p></div>
Junio C Hamano1c222c52011-05-13 19:55:321095</dd>
1096<dt class="hdlist1">
Junio C Hamano11f15372019-03-07 03:17:001097--cumulative
1098</dt>
1099<dd>
1100<p>
1101 Synonym for --dirstat=cumulative
1102</p>
1103</dd>
1104<dt class="hdlist1">
1105--dirstat-by-file[=&lt;param1,param2&gt;&#8230;]
1106</dt>
1107<dd>
1108<p>
1109 Synonym for --dirstat=files,param1,param2&#8230;
1110</p>
1111</dd>
1112<dt class="hdlist1">
Junio C Hamano6959c6c2006-05-17 10:34:111113--summary
1114</dt>
1115<dd>
1116<p>
1117 Output a condensed summary of extended header information
1118 such as creations, renames and mode changes.
1119</p>
1120</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591121<dt class="hdlist1">
Junio C Hamanod1308c92006-04-16 11:01:091122--patch-with-stat
1123</dt>
1124<dd>
1125<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531126 Synonym for <code>-p --stat</code>.
Junio C Hamanod1308c92006-04-16 11:01:091127</p>
1128</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591129<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231130-z
1131</dt>
1132<dd>
1133<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531134 When <code>--raw</code>, <code>--numstat</code>, <code>--name-only</code> or <code>--name-status</code> has been
Junio C Hamano0c053e82010-04-19 06:46:341135 given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano1a4e8412005-12-27 08:17:231136</p>
Junio C Hamano0f6f3bf2017-03-13 07:01:531137<div class="paragraph"><p>Without this option, pathnames with "unusual" characters are quoted as
1138explained for the configuration variable <code>core.quotePath</code> (see
1139<a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231140</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591141<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231142--name-only
1143</dt>
1144<dd>
1145<p>
1146 Show only names of changed files.
1147</p>
1148</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591149<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231150--name-status
1151</dt>
1152<dd>
1153<p>
Junio C Hamanoa9aee782008-04-23 16:09:201154 Show only names and status of changed files. See the description
Junio C Hamanoc14e6ad2014-10-31 20:25:531155 of the <code>--diff-filter</code> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:231156</p>
1157</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591158<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:551159--submodule[=&lt;format&gt;]
1160</dt>
1161<dd>
1162<p>
Junio C Hamanocd451662016-09-13 00:54:091163 Specify how differences in submodules are shown. When specifying
1164 <code>--submodule=short</code> the <em>short</em> format is used. This format just
1165 shows the names of the commits at the beginning and end of the range.
1166 When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em>
1167 format is used. This format lists the commits in the range like
1168 <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
1169 is specified, the <em>diff</em> format is used. This format shows an
1170 inline diff of the changes in the submodule contents between the
1171 commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format
1172 if the config option is unset.
Junio C Hamanoc21ab052009-10-31 04:03:551173</p>
1174</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591175<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:121176--color[=&lt;when&gt;]
Junio C Hamano9ae1a062006-07-10 08:12:341177</dt>
1178<dd>
1179<p>
1180 Show colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531181 <code>--color</code> (i.e. without <em>=&lt;when&gt;</em>) is the same as <code>--color=always</code>.
1182 <em>&lt;when&gt;</em> can be one of <code>always</code>, <code>never</code>, or <code>auto</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341183</p>
1184</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591185<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341186--no-color
1187</dt>
1188<dd>
1189<p>
Junio C Hamano5f2627d2011-05-06 20:23:481190 Turn off colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531191 It is the same as <code>--color=never</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341192</p>
1193</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591194<dt class="hdlist1">
Junio C Hamanofb1fdf12017-08-27 06:14:591195--color-moved[=&lt;mode&gt;]
1196</dt>
1197<dd>
1198<p>
1199 Moved lines of code are colored differently.
1200 The &lt;mode&gt; defaults to <em>no</em> if the option is not given
1201 and to <em>zebra</em> if the option with no mode is given.
1202 The mode must be one of:
1203</p>
1204<div class="openblock">
1205<div class="content">
1206<div class="dlist"><dl>
1207<dt class="hdlist1">
1208no
1209</dt>
1210<dd>
1211<p>
1212 Moved lines are not highlighted.
1213</p>
1214</dd>
1215<dt class="hdlist1">
1216default
1217</dt>
1218<dd>
1219<p>
1220 Is a synonym for <code>zebra</code>. This may change to a more sensible mode
1221 in the future.
1222</p>
1223</dd>
1224<dt class="hdlist1">
1225plain
1226</dt>
1227<dd>
1228<p>
1229 Any line that is added in one location and was removed
1230 in another location will be colored with <em>color.diff.newMoved</em>.
1231 Similarly <em>color.diff.oldMoved</em> will be used for removed lines
1232 that are added somewhere else in the diff. This mode picks up any
1233 moved line, but it is not very useful in a review to determine
1234 if a block of code was moved without permutation.
1235</p>
1236</dd>
1237<dt class="hdlist1">
Junio C Hamanof09b7cd2018-08-02 23:01:451238blocks
Junio C Hamanofb1fdf12017-08-27 06:14:591239</dt>
1240<dd>
1241<p>
1242 Blocks of moved text of at least 20 alphanumeric characters
1243 are detected greedily. The detected blocks are
Junio C Hamanof09b7cd2018-08-02 23:01:451244 painted using either the <em>color.diff.{old,new}Moved</em> color.
1245 Adjacent blocks cannot be told apart.
1246</p>
1247</dd>
1248<dt class="hdlist1">
1249zebra
1250</dt>
1251<dd>
1252<p>
1253 Blocks of moved text are detected as in <em>blocks</em> mode. The blocks
1254 are painted using either the <em>color.diff.{old,new}Moved</em> color or
Junio C Hamanofb1fdf12017-08-27 06:14:591255 <em>color.diff.{old,new}MovedAlternative</em>. The change between
1256 the two colors indicates that a new block was detected.
1257</p>
1258</dd>
1259<dt class="hdlist1">
Junio C Hamanobfd91f42018-08-17 22:21:161260dimmed-zebra
Junio C Hamanofb1fdf12017-08-27 06:14:591261</dt>
1262<dd>
1263<p>
1264 Similar to <em>zebra</em>, but additional dimming of uninteresting parts
1265 of moved code is performed. The bordering lines of two adjacent
1266 blocks are considered interesting, the rest is uninteresting.
Junio C Hamanobfd91f42018-08-17 22:21:161267 <code>dimmed_zebra</code> is a deprecated synonym.
Junio C Hamanofb1fdf12017-08-27 06:14:591268</p>
1269</dd>
1270</dl></div>
1271</div></div>
1272</dd>
1273<dt class="hdlist1">
Junio C Hamanoa90214f2019-01-28 22:05:251274--no-color-moved
1275</dt>
1276<dd>
1277<p>
1278 Turn off move detection. This can be used to override configuration
1279 settings. It is the same as <code>--color-moved=no</code>.
1280</p>
1281</dd>
1282<dt class="hdlist1">
Junio C Hamanof09b7cd2018-08-02 23:01:451283--color-moved-ws=&lt;modes&gt;
1284</dt>
1285<dd>
1286<p>
Junio C Hamanoa90214f2019-01-28 22:05:251287 This configures how whitespace is ignored when performing the
Junio C Hamanof09b7cd2018-08-02 23:01:451288 move detection for <code>--color-moved</code>.
1289 These modes can be given as a comma separated list:
1290</p>
1291<div class="openblock">
1292<div class="content">
1293<div class="dlist"><dl>
1294<dt class="hdlist1">
Junio C Hamanoa90214f2019-01-28 22:05:251295no
1296</dt>
1297<dd>
1298<p>
1299 Do not ignore whitespace when performing move detection.
1300</p>
1301</dd>
1302<dt class="hdlist1">
Junio C Hamanof09b7cd2018-08-02 23:01:451303ignore-space-at-eol
1304</dt>
1305<dd>
1306<p>
1307 Ignore changes in whitespace at EOL.
1308</p>
1309</dd>
1310<dt class="hdlist1">
1311ignore-space-change
1312</dt>
1313<dd>
1314<p>
1315 Ignore changes in amount of whitespace. This ignores whitespace
1316 at line end, and considers all other sequences of one or
1317 more whitespace characters to be equivalent.
1318</p>
1319</dd>
1320<dt class="hdlist1">
1321ignore-all-space
1322</dt>
1323<dd>
1324<p>
1325 Ignore whitespace when comparing lines. This ignores differences
1326 even if one line has whitespace where the other line has none.
1327</p>
1328</dd>
1329<dt class="hdlist1">
1330allow-indentation-change
1331</dt>
1332<dd>
1333<p>
Junio C Hamanoa90214f2019-01-28 22:05:251334 Initially ignore any whitespace in the move detection, then
Junio C Hamanof09b7cd2018-08-02 23:01:451335 group the moved code blocks only into a block if the change in
1336 whitespace is the same per line. This is incompatible with the
1337 other modes.
1338</p>
1339</dd>
1340</dl></div>
1341</div></div>
1342</dd>
1343<dt class="hdlist1">
Junio C Hamanoa90214f2019-01-28 22:05:251344--no-color-moved-ws
1345</dt>
1346<dd>
1347<p>
1348 Do not ignore whitespace when performing move detection. This can be
1349 used to override configuration settings. It is the same as
1350 <code>--color-moved-ws=no</code>.
1351</p>
1352</dd>
1353<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531354--word-diff[=&lt;mode&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:411355</dt>
1356<dd>
1357<p>
Junio C Hamanocc7636a2010-05-21 14:57:531358 Show a word diff, using the &lt;mode&gt; to delimit changed words.
1359 By default, words are delimited by whitespace; see
Junio C Hamanoc14e6ad2014-10-31 20:25:531360 <code>--word-diff-regex</code> below. The &lt;mode&gt; defaults to <em>plain</em>, and
Junio C Hamanocc7636a2010-05-21 14:57:531361 must be one of:
Junio C Hamano85e45fa2006-08-13 07:47:411362</p>
Junio C Hamano9629d4f2012-12-19 00:28:271363<div class="openblock">
1364<div class="content">
Junio C Hamano68cf15a2010-11-06 01:01:591365<div class="dlist"><dl>
1366<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531367color
1368</dt>
1369<dd>
1370<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531371 Highlight changed words using only colors. Implies <code>--color</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531372</p>
1373</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591374<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531375plain
1376</dt>
1377<dd>
1378<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531379 Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no
Junio C Hamanocc7636a2010-05-21 14:57:531380 attempts to escape the delimiters if they appear in the input,
1381 so the output may be ambiguous.
1382</p>
1383</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591384<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531385porcelain
1386</dt>
1387<dd>
1388<p>
1389 Use a special line-based format intended for script
1390 consumption. Added/removed/unchanged runs are printed in the
Junio C Hamanoc14e6ad2014-10-31 20:25:531391 usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
Junio C Hamanocc7636a2010-05-21 14:57:531392 character at the beginning of the line and extending to the
1393 end of the line. Newlines in the input are represented by a
Junio C Hamanoc14e6ad2014-10-31 20:25:531394 tilde <code>~</code> on a line of its own.
Junio C Hamanocc7636a2010-05-21 14:57:531395</p>
1396</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591397<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531398none
1399</dt>
1400<dd>
1401<p>
1402 Disable word diff again.
1403</p>
1404</dd>
1405</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271406</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591407<div class="paragraph"><p>Note that despite the name of the first mode, color is used to
Junio C Hamanocc7636a2010-05-21 14:57:531408highlight the changed parts in all modes if enabled.</p></div>
1409</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591410<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531411--word-diff-regex=&lt;regex&gt;
1412</dt>
1413<dd>
1414<p>
1415 Use &lt;regex&gt; to decide what a word is, instead of considering
1416 runs of non-whitespace to be a word. Also implies
Junio C Hamanoc14e6ad2014-10-31 20:25:531417 <code>--word-diff</code> unless it was already enabled.
Junio C Hamanocc7636a2010-05-21 14:57:531418</p>
Junio C Hamano68cf15a2010-11-06 01:01:591419<div class="paragraph"><p>Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:021420&lt;regex&gt; is considered a word. Anything between these matches is
1421considered whitespace and ignored(!) for the purposes of finding
Junio C Hamanoc14e6ad2014-10-31 20:25:531422differences. You may want to append <code>|[^[:space:]]</code> to your regular
Junio C Hamano20d47e32009-01-26 06:36:021423expression to make sure that it matches all non-whitespace characters.
1424A match that contains a newline is silently truncated(!) at the
1425newline.</p></div>
Junio C Hamano713eded2015-12-03 00:24:021426<div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
1427and, correspondingly, show differences character by character.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591428<div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
Junio C Hamano198b1f12016-05-17 22:27:241429<a href="gitattributes.html">gitattributes(5)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
Junio C Hamano20d47e32009-01-26 06:36:021430overrides any diff driver or configuration setting. Diff drivers
1431override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:411432</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591433<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531434--color-words[=&lt;regex&gt;]
1435</dt>
1436<dd>
1437<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531438 Equivalent to <code>--word-diff=color</code> plus (if a regex was
1439 specified) <code>--word-diff-regex=&lt;regex&gt;</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531440</p>
1441</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591442<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341443--no-renames
1444</dt>
1445<dd>
1446<p>
1447 Turn off rename detection, even when the configuration
1448 file gives the default to do so.
1449</p>
1450</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591451<dt class="hdlist1">
Junio C Hamano11f15372019-03-07 03:17:001452--[no-]rename-empty
1453</dt>
1454<dd>
1455<p>
1456 Whether to use empty blobs as rename source.
1457</p>
1458</dd>
1459<dt class="hdlist1">
Junio C Hamanoa890c4f2007-01-28 10:29:211460--check
1461</dt>
1462<dd>
1463<p>
Junio C Hamano84ea1e42016-04-08 21:53:481464 Warn if changes introduce conflict markers or whitespace errors.
1465 What are considered whitespace errors is controlled by <code>core.whitespace</code>
Junio C Hamano6005bfa2011-06-23 00:51:221466 configuration. By default, trailing whitespaces (including
Junio C Hamano14e66832018-06-18 18:32:191467 lines that consist solely of whitespaces) and a space character
Junio C Hamano6005bfa2011-06-23 00:51:221468 that is immediately followed by a tab character inside the
1469 initial indent of the line are considered whitespace errors.
1470 Exits with non-zero status if problems are found. Not compatible
1471 with --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:211472</p>
1473</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591474<dt class="hdlist1">
Junio C Hamano8c5d5942015-06-11 19:37:481475--ws-error-highlight=&lt;kind&gt;
1476</dt>
1477<dd>
1478<p>
Junio C Hamano4b2a6c12017-08-22 18:32:371479 Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code>
1480 lines of the diff. Multiple values are separated by comma,
1481 <code>none</code> resets previous values, <code>default</code> reset the list to
1482 <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When
1483 this option is not given, and the configuration variable
1484 <code>diff.wsErrorHighlight</code> is not set, only whitespace errors in
1485 <code>new</code> lines are highlighted. The whitespace errors are colored
Junio C Hamano14e66832018-06-18 18:32:191486 with <code>color.diff.whitespace</code>.
Junio C Hamano8c5d5942015-06-11 19:37:481487</p>
1488</dd>
1489<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231490--full-index
1491</dt>
1492<dd>
1493<p>
Junio C Hamano5cf43ca2008-08-20 09:14:141494 Instead of the first handful of characters, show the full
1495 pre- and post-image blob object names on the "index"
1496 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:231497</p>
1498</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591499<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341500--binary
1501</dt>
1502<dd>
1503<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531504 In addition to <code>--full-index</code>, output a binary diff that
Junio C Hamano6b7d2152019-04-16 12:51:151505 can be applied with <code>git-apply</code>. Implies <code>--patch</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341506</p>
1507</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591508<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231509--abbrev[=&lt;n&gt;]
1510</dt>
1511<dd>
1512<p>
1513 Instead of showing the full 40-byte hexadecimal object
1514 name in diff-raw format output and diff-tree header
Junio C Hamanocf8aeaf2020-08-31 23:16:351515 lines, show only a partial prefix.
1516 In diff-patch output format, <code>--full-index</code> takes higher
1517 precedence, i.e. if <code>--full-index</code> is specified, full blob
1518 names will be shown regardless of <code>--abbrev</code>.
1519 Non default number of digits can be specified with <code>--abbrev=&lt;n&gt;</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231520</p>
1521</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591522<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141523-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231524</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591525<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541526--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1527</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231528<dd>
1529<p>
Junio C Hamanoe85e36f2010-08-10 05:30:141530 Break complete rewrite changes into pairs of delete and
1531 create. This serves two purposes:
Junio C Hamano1a4e8412005-12-27 08:17:231532</p>
Junio C Hamano68cf15a2010-11-06 01:01:591533<div class="paragraph"><p>It affects the way a change that amounts to a total rewrite of a file
Junio C Hamanoe85e36f2010-08-10 05:30:141534not as a series of deletion and insertion mixed together with a very
1535few lines that happen to match textually as the context, but as a
1536single deletion of everything old followed by a single insertion of
Junio C Hamanoc14e6ad2014-10-31 20:25:531537everything new, and the number <code>m</code> controls this aspect of the -B
1538option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the
Junio C Hamano076ffcc2013-02-06 05:13:211539original should remain in the result for Git to consider it a total
Junio C Hamanoe85e36f2010-08-10 05:30:141540rewrite (i.e. otherwise the resulting patch will be a series of
1541deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591542<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:141543source of a rename (usually -M only considers a file that disappeared
Junio C Hamanoc14e6ad2014-10-31 20:25:531544as the source of a rename), and the number <code>n</code> controls this aspect of
1545the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:591546addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:141547eligible for being picked up as a possible source of a rename to
1548another file.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231549</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591550<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141551-M[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231552</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591553<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261554--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541555</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231556<dd>
1557<p>
1558 Detect renames.
Junio C Hamanoc14e6ad2014-10-31 20:25:531559 If <code>n</code> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:141560 index (i.e. amount of addition/deletions compared to the
Junio C Hamanoc14e6ad2014-10-31 20:25:531561 file&#8217;s size). For example, <code>-M90%</code> means Git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:141562 delete/add pair to be a rename if more than 90% of the file
Junio C Hamanoc14e6ad2014-10-31 20:25:531563 hasn&#8217;t changed. Without a <code>%</code> sign, the number is to be read as
1564 a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
1565 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is
1566 the same as <code>-M5%</code>. To limit detection to exact renames, use
1567 <code>-M100%</code>. The default similarity index is 50%.
Junio C Hamano1a4e8412005-12-27 08:17:231568</p>
1569</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591570<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141571-C[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231572</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591573<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261574--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541575</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231576<dd>
1577<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531578 Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1579 If <code>n</code> is specified, it has the same meaning as for <code>-M&lt;n&gt;</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231580</p>
1581</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591582<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231583--find-copies-harder
1584</dt>
1585<dd>
1586<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531587 For performance reasons, by default, <code>-C</code> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:231588 if the original file of the copy was modified in the same
1589 changeset. This flag makes the command
1590 inspect unmodified files as candidates for the source of
1591 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:141592 projects, so use it with caution. Giving more than one
Junio C Hamanoc14e6ad2014-10-31 20:25:531593 <code>-C</code> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:231594</p>
1595</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591596<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:021597-D
1598</dt>
1599<dt class="hdlist1">
1600--irreversible-delete
1601</dt>
1602<dd>
1603<p>
1604 Omit the preimage for deletes, i.e. print only the header but not
Junio C Hamanoc14e6ad2014-10-31 20:25:531605 the diff between the preimage and <code>/dev/null</code>. The resulting patch
1606 is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is
Junio C Hamanob02377c2011-04-28 22:26:021607 solely for people who want to just concentrate on reviewing the
Junio C Hamanod16fd1b2017-08-04 16:41:511608 text after the change. In addition, the output obviously lacks
Junio C Hamanob02377c2011-04-28 22:26:021609 enough information to apply such a patch in reverse, even manually,
1610 hence the name of the option.
1611</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531612<div class="paragraph"><p>When used together with <code>-B</code>, omit also the preimage in the deletion part
Junio C Hamanob02377c2011-04-28 22:26:021613of a delete/create pair.</p></div>
1614</dd>
1615<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231616-l&lt;num&gt;
1617</dt>
1618<dd>
1619<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531620 The <code>-M</code> and <code>-C</code> options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:231621 is the number of potential rename/copy targets. This
1622 option prevents rename/copy detection from running if
1623 the number of rename/copy targets exceeds the specified
1624 number.
1625</p>
1626</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591627<dt class="hdlist1">
Junio C Hamano982eb112010-11-18 00:53:091628--diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1629</dt>
1630<dd>
1631<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531632 Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1633 Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1634 type (i.e. regular file, symlink, submodule, &#8230;) changed (<code>T</code>),
1635 are Unmerged (<code>U</code>), are
1636 Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
Junio C Hamano982eb112010-11-18 00:53:091637 Any combination of the filter characters (including none) can be used.
Junio C Hamanoc14e6ad2014-10-31 20:25:531638 When <code>*</code> (All-or-none) is added to the combination, all
Junio C Hamano982eb112010-11-18 00:53:091639 paths are selected if there is any file that matches
1640 other criteria in the comparison; if there is no file
1641 that matches other criteria, nothing is selected.
1642</p>
Junio C Hamanoeed15af2016-07-25 22:49:421643<div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1644<code>--diff-filter=ad</code> excludes added and deleted paths.</p></div>
Junio C Hamano3a34f152018-01-09 23:09:381645<div class="paragraph"><p>Note that not all diffs can feature all types. For instance, diffs
1646from the index to the working tree can never have Added entries
1647(because the set of paths included in the diff is limited by what is in
1648the index). Similarly, copied and renamed entries cannot appear if
1649detection for those types is disabled.</p></div>
Junio C Hamano982eb112010-11-18 00:53:091650</dd>
1651<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231652-S&lt;string&gt;
1653</dt>
1654<dd>
1655<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521656 Look for differences that change the number of occurrences of
1657 the specified string (i.e. addition/deletion) in a file.
1658 Intended for the scripter&#8217;s use.
Junio C Hamano1a4e8412005-12-27 08:17:231659</p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521660<div class="paragraph"><p>It is useful when you&#8217;re looking for an exact block of code (like a
1661struct), and want to know the history of that block since it first
1662came into being: use the feature iteratively to feed the interesting
Junio C Hamanoc14e6ad2014-10-31 20:25:531663block in the preimage back into <code>-S</code>, and keep going until you get the
Junio C Hamanof1f5a7b2013-06-11 22:23:521664very first version of the block.</p></div>
Junio C Hamanoace33e42019-01-18 23:16:051665<div class="paragraph"><p>Binary files are searched as well.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231666</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591667<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:341668-G&lt;regex&gt;
1669</dt>
1670<dd>
1671<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521672 Look for differences whose patch text contains added/removed
1673 lines that match &lt;regex&gt;.
Junio C Hamano3b4609d2010-09-30 00:04:341674</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531675<div class="paragraph"><p>To illustrate the difference between <code>-S&lt;regex&gt; --pickaxe-regex</code> and
1676<code>-G&lt;regex&gt;</code>, consider a commit with the following diff in the same
Junio C Hamanof1f5a7b2013-06-11 22:23:521677file:</p></div>
1678<div class="listingblock">
1679<div class="content">
Junio C Hamanob7e497f2020-02-12 21:41:371680<pre><code>+ return frotz(nitfol, two-&gt;ptr, 1, 0);
Junio C Hamanof1f5a7b2013-06-11 22:23:521681...
Junio C Hamanob7e497f2020-02-12 21:41:371682- hit = frotz(nitfol, mf2.ptr, 1, 0);</code></pre>
Junio C Hamanof1f5a7b2013-06-11 22:23:521683</div></div>
Junio C Hamanob7e497f2020-02-12 21:41:371684<div class="paragraph"><p>While <code>git log -G"frotz\(nitfol"</code> will show this commit, <code>git log
1685-S"frotz\(nitfol" --pickaxe-regex</code> will not (because the number of
Junio C Hamanof1f5a7b2013-06-11 22:23:521686occurrences of that string did not change).</p></div>
Junio C Hamanoace33e42019-01-18 23:16:051687<div class="paragraph"><p>Unless <code>--text</code> is supplied patches of binary files without a textconv
1688filter will be ignored.</p></div>
Junio C Hamanof1f5a7b2013-06-11 22:23:521689<div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1690information.</p></div>
Junio C Hamano3b4609d2010-09-30 00:04:341691</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591692<dt class="hdlist1">
Junio C Hamano7b9cce92018-01-23 22:34:271693--find-object=&lt;object-id&gt;
1694</dt>
1695<dd>
1696<p>
1697 Look for differences that change the number of occurrences of
1698 the specified object. Similar to <code>-S</code>, just the argument is different
1699 in that it doesn&#8217;t search for a specific string but for a specific
1700 object id.
1701</p>
1702<div class="paragraph"><p>The object can be a blob or a submodule commit. It implies the <code>-t</code> option in
1703<code>git-log</code> to also find trees.</p></div>
1704</dd>
1705<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231706--pickaxe-all
1707</dt>
1708<dd>
1709<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531710 When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:231711 changeset, not just the files that contain the change
1712 in &lt;string&gt;.
1713</p>
1714</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591715<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:281716--pickaxe-regex
1717</dt>
1718<dd>
1719<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531720 Treat the &lt;string&gt; given to <code>-S</code> as an extended POSIX regular
Junio C Hamanof1f5a7b2013-06-11 22:23:521721 expression to match.
Junio C Hamanobfe9e752006-04-05 21:43:281722</p>
1723</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591724<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231725-O&lt;orderfile&gt;
1726</dt>
1727<dd>
1728<p>
Junio C Hamanobcd98f42017-01-24 00:12:161729 Control the order in which files appear in the output.
Junio C Hamano322c6242015-03-23 21:32:461730 This overrides the <code>diff.orderFile</code> configuration variable
1731 (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
Junio C Hamanoc14e6ad2014-10-31 20:25:531732 use <code>-O/dev/null</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231733</p>
Junio C Hamanobcd98f42017-01-24 00:12:161734<div class="paragraph"><p>The output order is determined by the order of glob patterns in
1735&lt;orderfile&gt;.
1736All files with pathnames that match the first pattern are output
1737first, all files with pathnames that match the second pattern (but not
1738the first) are output next, and so on.
1739All files with pathnames that do not match any pattern are output
1740last, as if there was an implicit match-all pattern at the end of the
1741file.
1742If multiple pathnames have the same rank (they match the same pattern
1743but no earlier patterns), their output order relative to each other is
1744the normal order.</p></div>
1745<div class="paragraph"><p>&lt;orderfile&gt; is parsed as follows:</p></div>
1746<div class="openblock">
1747<div class="content">
1748<div class="ulist"><ul>
1749<li>
1750<p>
1751Blank lines are ignored, so they can be used as separators for
1752 readability.
1753</p>
1754</li>
1755<li>
1756<p>
1757Lines starting with a hash ("<code>#</code>") are ignored, so they can be used
1758 for comments. Add a backslash ("<code>\</code>") to the beginning of the
1759 pattern if it starts with a hash.
1760</p>
1761</li>
1762<li>
1763<p>
1764Each other line contains a single pattern.
1765</p>
1766</li>
1767</ul></div>
1768</div></div>
1769<div class="paragraph"><p>Patterns have the same syntax and semantics as patterns used for
Junio C Hamano96153bf2018-04-25 08:25:341770fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
Junio C Hamanobcd98f42017-01-24 00:12:161771matches a pattern if removing any number of the final pathname
1772components matches the pattern. For example, the pattern "<code>foo*bar</code>"
1773matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231774</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591775<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231776-R
1777</dt>
1778<dd>
1779<p>
1780 Swap two inputs; that is, show differences from index or
1781 on-disk file to tree contents.
1782</p>
1783</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591784<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441785--relative[=&lt;path&gt;]
1786</dt>
Junio C Hamano3ef9e672020-06-02 21:51:311787<dt class="hdlist1">
1788--no-relative
1789</dt>
Junio C Hamano24bc09a2008-02-28 00:27:441790<dd>
1791<p>
1792 When run from a subdirectory of the project, it can be
1793 told to exclude changes outside the directory and show
1794 pathnames relative to it with this option. When you are
1795 not in a subdirectory (e.g. in a bare repository), you
1796 can name which subdirectory to make the output relative
1797 to by giving a &lt;path&gt; as an argument.
Junio C Hamano3ef9e672020-06-02 21:51:311798 <code>--no-relative</code> can be used to countermand both <code>diff.relative</code> config
1799 option and previous <code>--relative</code>.
Junio C Hamano24bc09a2008-02-28 00:27:441800</p>
1801</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591802<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221803-a
1804</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591805<dt class="hdlist1">
Junio C Hamanoc26f5482006-07-09 09:38:141806--text
1807</dt>
1808<dd>
1809<p>
1810 Treat all files as text.
1811</p>
1812</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591813<dt class="hdlist1">
Junio C Hamano4886c772017-11-27 03:33:281814--ignore-cr-at-eol
1815</dt>
1816<dd>
1817<p>
Junio C Hamano96153bf2018-04-25 08:25:341818 Ignore carriage-return at the end of line when doing a comparison.
Junio C Hamano4886c772017-11-27 03:33:281819</p>
1820</dd>
1821<dt class="hdlist1">
Junio C Hamanofd468962007-02-14 23:45:041822--ignore-space-at-eol
1823</dt>
1824<dd>
1825<p>
Junio C Hamano3a702342007-12-12 21:34:021826 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:041827</p>
1828</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591829<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221830-b
1831</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591832<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071833--ignore-space-change
1834</dt>
1835<dd>
1836<p>
Junio C Hamano3a702342007-12-12 21:34:021837 Ignore changes in amount of whitespace. This ignores whitespace
1838 at line end, and considers all other sequences of one or
1839 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:071840</p>
1841</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591842<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221843-w
Junio C Hamanod9c2d2f2006-12-06 08:59:071844</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591845<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071846--ignore-all-space
1847</dt>
1848<dd>
1849<p>
Junio C Hamano3a702342007-12-12 21:34:021850 Ignore whitespace when comparing lines. This ignores
1851 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:071852 line has none.
1853</p>
1854</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591855<dt class="hdlist1">
Junio C Hamanoa1952302013-07-01 21:31:181856--ignore-blank-lines
1857</dt>
1858<dd>
1859<p>
1860 Ignore changes whose lines are all blank.
1861</p>
1862</dd>
1863<dt class="hdlist1">
Junio C Hamanodf3d3cd2020-11-02 22:05:051864-I&lt;regex&gt;
1865</dt>
1866<dt class="hdlist1">
1867--ignore-matching-lines=&lt;regex&gt;
1868</dt>
1869<dd>
1870<p>
1871 Ignore changes whose all lines match &lt;regex&gt;. This option may
1872 be specified more than once.
1873</p>
1874</dd>
1875<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161876--inter-hunk-context=&lt;lines&gt;
1877</dt>
1878<dd>
1879<p>
1880 Show the context between diff hunks, up to the specified number
1881 of lines, thereby fusing hunks that are close to each other.
Junio C Hamanobcd98f42017-01-24 00:12:161882 Defaults to <code>diff.interHunkContext</code> or 0 if the config option
1883 is unset.
Junio C Hamano1d40ee82009-01-07 10:14:161884</p>
1885</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591886<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091887-W
1888</dt>
1889<dt class="hdlist1">
1890--function-context
1891</dt>
1892<dd>
1893<p>
1894 Show whole surrounding functions of changes.
1895</p>
1896</dd>
1897<dt class="hdlist1">
Junio C Hamano48fd2f62007-03-19 02:02:301898--exit-code
1899</dt>
1900<dd>
1901<p>
1902 Make the program exit with codes similar to diff(1).
1903 That is, it exits with 1 if there were differences and
1904 0 means no differences.
1905</p>
1906</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591907<dt class="hdlist1">
Junio C Hamano35e57552007-03-25 07:54:351908--quiet
1909</dt>
1910<dd>
1911<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531912 Disable all output of the program. Implies <code>--exit-code</code>.
Junio C Hamano35e57552007-03-25 07:54:351913</p>
1914</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591915<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401916--ext-diff
1917</dt>
1918<dd>
1919<p>
1920 Allow an external diff helper to be executed. If you set an
Junio C Hamanoa28a9202012-06-21 07:08:231921 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1922 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401923</p>
1924</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591925<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401926--no-ext-diff
1927</dt>
1928<dd>
1929<p>
1930 Disallow external diff drivers.
1931</p>
1932</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591933<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311934--textconv
1935</dt>
1936<dt class="hdlist1">
1937--no-textconv
1938</dt>
1939<dd>
1940<p>
1941 Allow (or disallow) external text conversion filters to be run
Junio C Hamanoa28a9202012-06-21 07:08:231942 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
Junio C Hamanoc652aed2011-07-07 01:14:311943 details. Because textconv filters are typically a one-way
1944 conversion, the resulting diff is suitable for human
1945 consumption, but cannot be applied. For this reason, textconv
Junio C Hamanoa28a9202012-06-21 07:08:231946 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1947 <a href="git-log.html">git-log(1)</a>, but not for <a href="git-format-patch.html">git-format-patch(1)</a> or
Junio C Hamanoc652aed2011-07-07 01:14:311948 diff plumbing commands.
1949</p>
1950</dd>
1951<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511952--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141953</dt>
1954<dd>
1955<p>
Junio C Hamano7d449522010-07-01 00:08:511956 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamanoc7102962013-05-29 23:57:171957 either "none", "untracked", "dirty" or "all", which is the default.
Junio C Hamano619596a2010-08-18 22:15:351958 Using "none" will consider the submodule modified when it either contains
1959 untracked or modified files or its HEAD differs from the commit recorded
1960 in the superproject and can be used to override any settings of the
Junio C Hamanoa28a9202012-06-21 07:08:231961 <em>ignore</em> option in <a href="git-config.html">git-config(1)</a> or <a href="gitmodules.html">gitmodules(5)</a>. When
Junio C Hamano7d449522010-07-01 00:08:511962 "untracked" is used submodules are not considered dirty when they only
1963 contain untracked content (but they are still scanned for modified
1964 content). Using "dirty" ignores all changes to the work tree of submodules,
1965 only changes to the commits stored in the superproject are shown (this was
1966 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141967</p>
1968</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591969<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331970--src-prefix=&lt;prefix&gt;
1971</dt>
1972<dd>
1973<p>
1974 Show the given source prefix instead of "a/".
1975</p>
1976</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591977<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331978--dst-prefix=&lt;prefix&gt;
1979</dt>
1980<dd>
1981<p>
1982 Show the given destination prefix instead of "b/".
1983</p>
1984</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591985<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331986--no-prefix
1987</dt>
1988<dd>
1989<p>
1990 Do not show any source or destination prefix.
1991</p>
1992</dd>
Junio C Hamanocd451662016-09-13 00:54:091993<dt class="hdlist1">
1994--line-prefix=&lt;prefix&gt;
1995</dt>
1996<dd>
1997<p>
1998 Prepend an additional prefix to every line of output.
1999</p>
2000</dd>
Junio C Hamanof7017f12016-10-27 23:31:342001<dt class="hdlist1">
2002--ita-invisible-in-index
2003</dt>
2004<dd>
2005<p>
2006 By default entries added by "git add -N" appear as an existing
2007 empty file in "git diff" and a new file in "git diff --cached".
2008 This option makes the entry appear as a new file in "git diff"
2009 and non-existent in "git diff --cached". This option could be
2010 reverted with <code>--ita-visible-in-index</code>. Both options are
2011 experimental and could be removed in future.
2012</p>
2013</dd>
Junio C Hamanoba4b9282008-07-06 05:20:312014</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:592015<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoa28a9202012-06-21 07:08:232016<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592017<div class="dlist"><dl>
2018<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232019&lt;tree-ish&gt;
2020</dt>
2021<dd>
2022<p>
2023 The id of a tree object to diff against.
2024</p>
2025</dd>
Junio C Hamano68cf15a2010-11-06 01:01:592026<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232027--cached
2028</dt>
2029<dd>
2030<p>
Junio C Hamanodf3d3cd2020-11-02 22:05:052031 Do not consider the on-disk file at all.
2032</p>
2033</dd>
2034<dt class="hdlist1">
2035--merge-base
2036</dt>
2037<dd>
2038<p>
2039 Instead of comparing &lt;tree-ish&gt; directly, use the merge base
2040 between &lt;tree-ish&gt; and HEAD instead. &lt;tree-ish&gt; must be a
2041 commit.
Junio C Hamano1a4e8412005-12-27 08:17:232042</p>
2043</dd>
Junio C Hamano68cf15a2010-11-06 01:01:592044<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232045-m
2046</dt>
2047<dd>
2048<p>
2049 By default, files recorded in the index but not checked
2050 out are reported as deleted. This flag makes
Junio C Hamano1aa40d22010-01-21 17:46:432051 <em>git diff-index</em> say that all non-checked-out files are up
Junio C Hamano1a4e8412005-12-27 08:17:232052 to date.
2053</p>
2054</dd>
Junio C Hamanoba4b9282008-07-06 05:20:312055</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:232056</div>
Junio C Hamano9629d4f2012-12-19 00:28:272057</div>
2058<div class="sect1">
Junio C Hamano543f8d62009-07-29 08:35:212059<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232060<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592061<div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:312062"git-diff-files" and "git diff --raw" are very similar.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592063<div class="paragraph"><p>These commands all compare two sets of things; what is
Junio C Hamanoba4b9282008-07-06 05:20:312064compared differs:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592065<div class="dlist"><dl>
2066<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232067git-diff-index &lt;tree-ish&gt;
2068</dt>
2069<dd>
2070<p>
2071 compares the &lt;tree-ish&gt; and the files on the filesystem.
2072</p>
2073</dd>
Junio C Hamano68cf15a2010-11-06 01:01:592074<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232075git-diff-index --cached &lt;tree-ish&gt;
2076</dt>
2077<dd>
2078<p>
2079 compares the &lt;tree-ish&gt; and the index.
2080</p>
2081</dd>
Junio C Hamano68cf15a2010-11-06 01:01:592082<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232083git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
2084</dt>
2085<dd>
2086<p>
2087 compares the trees named by the two arguments.
2088</p>
2089</dd>
Junio C Hamano68cf15a2010-11-06 01:01:592090<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:232091git-diff-files [&lt;pattern&gt;&#8230;]
2092</dt>
2093<dd>
2094<p>
2095 compares the index and the files on the filesystem.
2096</p>
2097</dd>
Junio C Hamanoba4b9282008-07-06 05:20:312098</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:592099<div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
Junio C Hamano543f8d62009-07-29 08:35:212100what is being compared. After that, all the commands print one output
2101line per changed file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592102<div class="paragraph"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232103<div class="listingblock">
2104<div class="content">
Junio C Hamanof2b280b2018-12-01 14:45:012105<pre><code>in-place edit :100644 100644 bcd1234 0123456 M file0
2106copy-edit :100644 100644 abcd123 1234567 C68 file1 file2
2107rename-edit :100644 100644 abcd123 1234567 R86 file1 file3
2108create :000000 100644 0000000 1234567 A file4
2109delete :100644 000000 1234567 0000000 D file5
2110unmerged :000000 000000 0000000 0000000 U file6</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232111</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592112<div class="paragraph"><p>That is, from the left to the right:</p></div>
2113<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:232114<li>
2115<p>
2116a colon.
2117</p>
2118</li>
2119<li>
2120<p>
2121mode for "src"; 000000 if creation or unmerged.
2122</p>
2123</li>
2124<li>
2125<p>
2126a space.
2127</p>
2128</li>
2129<li>
2130<p>
2131mode for "dst"; 000000 if deletion or unmerged.
2132</p>
2133</li>
2134<li>
2135<p>
2136a space.
2137</p>
2138</li>
2139<li>
2140<p>
2141sha1 for "src"; 0{40} if creation or unmerged.
2142</p>
2143</li>
2144<li>
2145<p>
2146a space.
2147</p>
2148</li>
2149<li>
2150<p>
2151sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
2152</p>
2153</li>
2154<li>
2155<p>
2156a space.
2157</p>
2158</li>
2159<li>
2160<p>
2161status, followed by optional "score" number.
2162</p>
2163</li>
2164<li>
2165<p>
Junio C Hamano92d80372016-07-13 22:00:052166a tab or a NUL when <code>-z</code> option is used.
Junio C Hamano1a4e8412005-12-27 08:17:232167</p>
2168</li>
2169<li>
2170<p>
2171path for "src"
2172</p>
2173</li>
2174<li>
2175<p>
Junio C Hamano92d80372016-07-13 22:00:052176a tab or a NUL when <code>-z</code> option is used; only exists for C or R.
Junio C Hamano1a4e8412005-12-27 08:17:232177</p>
2178</li>
2179<li>
2180<p>
2181path for "dst"; only exists for C or R.
2182</p>
2183</li>
2184<li>
2185<p>
Junio C Hamano92d80372016-07-13 22:00:052186an LF or a NUL when <code>-z</code> option is used, to terminate the record.
Junio C Hamano1a4e8412005-12-27 08:17:232187</p>
2188</li>
Junio C Hamanoba4b9282008-07-06 05:20:312189</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592190<div class="paragraph"><p>Possible status letters are:</p></div>
2191<div class="ulist"><ul>
Junio C Hamanoaa17c7c2008-11-03 04:36:582192<li>
2193<p>
2194A: addition of a file
2195</p>
2196</li>
2197<li>
2198<p>
2199C: copy of a file into a new one
2200</p>
2201</li>
2202<li>
2203<p>
2204D: deletion of a file
2205</p>
2206</li>
2207<li>
2208<p>
2209M: modification of the contents or mode of a file
2210</p>
2211</li>
2212<li>
2213<p>
2214R: renaming of a file
2215</p>
2216</li>
2217<li>
2218<p>
2219T: change in the type of the file
2220</p>
2221</li>
2222<li>
2223<p>
2224U: file is unmerged (you must complete the merge before it can
Junio C Hamano2f5a9892019-12-25 21:12:552225 be committed)
Junio C Hamanoaa17c7c2008-11-03 04:36:582226</p>
2227</li>
2228<li>
2229<p>
2230X: "unknown" change type (most probably a bug, please report it)
2231</p>
2232</li>
2233</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:592234<div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:582235percentage of similarity between the source and target of the move or
Junio C Hamano6bb32e62015-02-17 22:11:262236copy). Status letter M may be followed by a score (denoting the
2237percentage of dissimilarity) for file rewrites.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592238<div class="paragraph"><p>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem
Junio C Hamanoba4b9282008-07-06 05:20:312239and it is out of sync with the index.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592240<div class="paragraph"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232241<div class="listingblock">
2242<div class="content">
Junio C Hamanof2b280b2018-12-01 14:45:012243<pre><code>:100644 100644 5be4a4a 0000000 M file.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232244</div></div>
Junio C Hamano0f6f3bf2017-03-13 07:01:532245<div class="paragraph"><p>Without the <code>-z</code> option, pathnames with "unusual" characters are
2246quoted as explained for the configuration variable <code>core.quotePath</code>
2247(see <a href="git-config.html">git-config(1)</a>). Using <code>-z</code> the filename is output
2248verbatim and the line is terminated by a NUL byte.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232249</div>
Junio C Hamano9629d4f2012-12-19 00:28:272250</div>
2251<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312252<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:122253<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592254<div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano92d80372016-07-13 22:00:052255can take <code>-c</code> or <code>--cc</code> option
Junio C Hamano67fad6d2007-05-06 08:53:122256to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:312257from the format described above in the following way:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592258<div class="olist arabic"><ol class="arabic">
Junio C Hamano67fad6d2007-05-06 08:53:122259<li>
2260<p>
2261there is a colon for each parent
2262</p>
2263</li>
2264<li>
2265<p>
2266there are more "src" modes and "src" sha1
2267</p>
2268</li>
2269<li>
2270<p>
2271status is concatenated status characters for each parent
2272</p>
2273</li>
2274<li>
2275<p>
2276no optional "score" number
2277</p>
2278</li>
2279<li>
2280<p>
Junio C Hamano11f15372019-03-07 03:17:002281tab-separated pathname(s) of the file
Junio C Hamano67fad6d2007-05-06 08:53:122282</p>
2283</li>
Junio C Hamanoba4b9282008-07-06 05:20:312284</ol></div>
Junio C Hamano11f15372019-03-07 03:17:002285<div class="paragraph"><p>For <code>-c</code> and <code>--cc</code>, only the destination or final path is shown even
2286if the file was renamed on any side of history. With
2287<code>--combined-all-paths</code>, the name of the path in each parent is shown
2288followed by the name of the path in the merge commit.</p></div>
2289<div class="paragraph"><p>Examples for <code>-c</code> and <code>--cc</code> without <code>--combined-all-paths</code>:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:122290<div class="listingblock">
2291<div class="content">
Junio C Hamano11f15372019-03-07 03:17:002292<pre><code>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c
2293::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh
2294::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c</code></pre>
2295</div></div>
2296<div class="paragraph"><p>Examples when <code>--combined-all-paths</code> added to either <code>-c</code> or <code>--cc</code>:</p></div>
2297<div class="listingblock">
2298<div class="content">
2299<pre><code>::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c desc.c desc.c
2300::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh
2301::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey.c fuey.c phooey.c</code></pre>
Junio C Hamano67fad6d2007-05-06 08:53:122302</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592303<div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
Junio C Hamanoba4b9282008-07-06 05:20:312304all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:122305</div>
Junio C Hamano9629d4f2012-12-19 00:28:272306</div>
2307<div class="sect1">
Junio C Hamano48cd3f12019-10-09 05:55:302308<h2 id="_generating_patch_text_with_p">Generating patch text with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232309<div class="sectionbody">
Junio C Hamano48cd3f12019-10-09 05:55:302310<div class="paragraph"><p>Running
2311<a href="git-diff.html">git-diff(1)</a>,
2312<a href="git-log.html">git-log(1)</a>,
2313<a href="git-show.html">git-show(1)</a>,
2314<a href="git-diff-index.html">git-diff-index(1)</a>,
2315<a href="git-diff-tree.html">git-diff-tree(1)</a>, or
2316<a href="git-diff-files.html">git-diff-files(1)</a>
2317with the <code>-p</code> option produces patch text.
2318You can customize the creation of patch text via the
Junio C Hamano558abd22020-09-03 20:22:342319<code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables
2320(see <a href="git.html">git(1)</a>).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592321<div class="paragraph"><p>What the -p option produces is slightly different from the traditional
Junio C Hamano7f9fa862010-10-19 23:51:142322diff format:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592323<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:232324<li>
2325<p>
Junio C Hamano7f9fa862010-10-19 23:51:142326It is preceded with a "git diff" header that looks like this:
Junio C Hamano1a4e8412005-12-27 08:17:232327</p>
2328<div class="literalblock">
2329<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532330<pre><code>diff --git a/file1 b/file2</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232331</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532332<div class="paragraph"><p>The <code>a/</code> and <code>b/</code> filenames are the same unless rename/copy is
Junio C Hamano1a4e8412005-12-27 08:17:232333involved. Especially, even for a creation or a deletion,
Junio C Hamanoc14e6ad2014-10-31 20:25:532334<code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div>
2335<div class="paragraph"><p>When rename/copy is involved, <code>file1</code> and <code>file2</code> show the
Junio C Hamano1a4e8412005-12-27 08:17:232336name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:312337the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232338</li>
2339<li>
2340<p>
2341It is followed by one or more extended header lines:
2342</p>
2343<div class="literalblock">
2344<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532345<pre><code>old mode &lt;mode&gt;
Junio C Hamano1a4e8412005-12-27 08:17:232346new mode &lt;mode&gt;
2347deleted file mode &lt;mode&gt;
2348new file mode &lt;mode&gt;
2349copy from &lt;path&gt;
2350copy to &lt;path&gt;
2351rename from &lt;path&gt;
2352rename to &lt;path&gt;
2353similarity index &lt;number&gt;
2354dissimilarity index &lt;number&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532355index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232356</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592357<div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
Junio C Hamano7f9fa862010-10-19 23:51:142358and file permission bits.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532359<div class="paragraph"><p>Path names in extended headers do not include the <code>a/</code> and <code>b/</code> prefixes.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592360<div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano7f9fa862010-10-19 23:51:142361the dissimilarity index is the percentage of changed lines. It
2362is a rounded down integer, followed by a percent sign. The
2363similarity index value of 100% is thus reserved for two equal
2364files, while 100% dissimilarity means that no line from the old
2365file made it into the new one.</p></div>
Junio C Hamano48cd3f12019-10-09 05:55:302366<div class="paragraph"><p>The index line includes the blob object names before and after the change.
Junio C Hamano7f9fa862010-10-19 23:51:142367The &lt;mode&gt; is included if the file mode does not change; otherwise,
2368separate lines indicate the old and the new mode.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232369</li>
2370<li>
2371<p>
Junio C Hamano0f6f3bf2017-03-13 07:01:532372Pathnames with "unusual" characters are quoted as explained for
2373 the configuration variable <code>core.quotePath</code> (see
2374 <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1a4e8412005-12-27 08:17:232375</p>
2376</li>
Junio C Hamano7f9fa862010-10-19 23:51:142377<li>
2378<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:532379All the <code>file1</code> files in the output refer to files before the
2380 commit, and all the <code>file2</code> files refer to files after the commit.
Junio C Hamano7f9fa862010-10-19 23:51:142381 It is incorrect to apply each change to each file sequentially. For
2382 example, this patch will swap a and b:
2383</p>
2384<div class="literalblock">
2385<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532386<pre><code>diff --git a/a b/b
Junio C Hamano7f9fa862010-10-19 23:51:142387rename from a
2388rename to b
2389diff --git a/b b/a
2390rename from b
Junio C Hamanoc14e6ad2014-10-31 20:25:532391rename to a</code></pre>
Junio C Hamano7f9fa862010-10-19 23:51:142392</div></div>
2393</li>
Junio C Hamanoba4b9282008-07-06 05:20:312394</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:232395</div>
Junio C Hamano9629d4f2012-12-19 00:28:272396</div>
2397<div class="sect1">
Junio C Hamano48cd3f12019-10-09 05:55:302398<h2 id="_combined_diff_format">Combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:192399<div class="sectionbody">
Junio C Hamano1dbca522015-05-22 20:48:552400<div class="paragraph"><p>Any diff-generating command can take the <code>-c</code> or <code>--cc</code> option to
Junio C Hamanoc5be4cc2011-03-09 07:20:432401produce a <em>combined diff</em> when showing a merge. This is the default
Junio C Hamanoa28a9202012-06-21 07:08:232402format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
Junio C Hamano1dbca522015-05-22 20:48:552403<a href="git-show.html">git-show(1)</a>. Note also that you can give the <code>-m</code> option to any
Junio C Hamanoc5be4cc2011-03-09 07:20:432404of these commands to force generation of diffs with individual parents
2405of a merge.</p></div>
Junio C Hamano48cd3f12019-10-09 05:55:302406<div class="paragraph"><p>A "combined diff" format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192407<div class="listingblock">
2408<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532409<pre><code>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:292410index fabadb8,cc95eb0..4866510
2411--- a/describe.c
2412+++ b/describe.c
2413@@@ -98,20 -98,12 +98,20 @@@
2414 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:192415 }
2416
2417- static void describe(char *arg)
2418 -static void describe(struct commit *cmit, int last_one)
2419++static void describe(char *arg, int last_one)
2420 {
Junio C Hamano29f14312006-10-26 08:47:292421 + unsigned char sha1[20];
2422 + struct commit *cmit;
2423 struct commit_list *list;
2424 static int initialized = 0;
2425 struct commit_name *n;
2426
2427 + if (get_sha1(arg, sha1) &lt; 0)
2428 + usage(describe_usage);
2429 + cmit = lookup_commit_reference(sha1);
2430 + if (!cmit)
2431 + usage(describe_usage);
2432 +
2433 if (!initialized) {
2434 initialized = 1;
Junio C Hamanoc14e6ad2014-10-31 20:25:532435 for_each_ref(get_name);</code></pre>
Junio C Hamanofb56a962006-01-28 10:38:192436</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592437<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:292438<li>
2439<p>
2440It is preceded with a "git diff" header, that looks like
Junio C Hamano48cd3f12019-10-09 05:55:302441 this (when the <code>-c</code> option is used):
Junio C Hamano29f14312006-10-26 08:47:292442</p>
2443<div class="literalblock">
2444<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532445<pre><code>diff --combined file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292446</div></div>
Junio C Hamano48cd3f12019-10-09 05:55:302447<div class="paragraph"><p>or like this (when the <code>--cc</code> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:292448<div class="literalblock">
2449<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532450<pre><code>diff --cc file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292451</div></div>
2452</li>
2453<li>
2454<p>
2455It is followed by one or more extended header lines
2456 (this example shows a merge with two parents):
2457</p>
2458<div class="literalblock">
2459<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532460<pre><code>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
Junio C Hamano29f14312006-10-26 08:47:292461mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2462new file mode &lt;mode&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532463deleted file mode &lt;mode&gt;,&lt;mode&gt;</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292464</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532465<div class="paragraph"><p>The <code>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</code> line appears only if at least one of
Junio C Hamanoee1e4282007-02-04 08:32:042466the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:292467information about detected contents movement (renames and
2468copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:312469&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292470</li>
2471<li>
2472<p>
2473It is followed by two-line from-file/to-file header
2474</p>
2475<div class="literalblock">
2476<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532477<pre><code>--- a/file
2478+++ b/file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292479</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592480<div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamanoc14e6ad2014-10-31 20:25:532481format, <code>/dev/null</code> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:312482files.</p></div>
Junio C Hamano11f15372019-03-07 03:17:002483<div class="paragraph"><p>However, if the --combined-all-paths option is provided, instead of a
2484two-line from-file/to-file you get a N+1 line from-file/to-file header,
2485where N is the number of parents in the merge commit</p></div>
2486<div class="literalblock">
2487<div class="content">
2488<pre><code>--- a/file
2489--- a/file
2490--- a/file
2491+++ b/file</code></pre>
2492</div></div>
2493<div class="paragraph"><p>This extended format can be useful if rename or copy detection is
2494active, to allow you to see the original name of the file in different
2495parents.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292496</li>
2497<li>
2498<p>
2499Chunk header format is modified to prevent people from
Junio C Hamanoc14e6ad2014-10-31 20:25:532500 accidentally feeding it to <code>patch -p1</code>. Combined diff format
Junio C Hamano29f14312006-10-26 08:47:292501 was created for review of merge commit changes, and was not
Junio C Hamano48cd3f12019-10-09 05:55:302502 meant to be applied. The change is similar to the change in the
Junio C Hamano29f14312006-10-26 08:47:292503 extended <em>index</em> header:
2504</p>
2505<div class="literalblock">
2506<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532507<pre><code>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292508</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532509<div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk
Junio C Hamanoba4b9282008-07-06 05:20:312510header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292511</li>
Junio C Hamanoba4b9282008-07-06 05:20:312512</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592513<div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
Junio C Hamanoc14e6ad2014-10-31 20:25:532514files A and B with a single column that has <code>-</code> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <code>+</code> (plus&#8201;&#8212;&#8201;missing in A but
2515added to B), or <code>" "</code> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:192516compares two or more files file1, file2,&#8230; with one file X, and
2517shows how X differs from each of fileN. One column for each of
Junio C Hamano68cf15a2010-11-06 01:01:592518fileN is prepended to the output line to note how X&#8217;s line is
Junio C Hamanoba4b9282008-07-06 05:20:312519different from it.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532520<div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in
2521fileN but it does not appear in the result. A <code>+</code> character
Junio C Hamano54bf1e22008-12-20 06:30:112522in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:292523and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:312524added, from the point of view of that parent).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592525<div class="paragraph"><p>In the above example output, the function signature was changed
Junio C Hamanoc14e6ad2014-10-31 20:25:532526from both files (hence two <code>-</code> removals from both file1 and
2527file2, plus <code>++</code> to mean one line that was added does not appear
Junio C Hamanod75148a2014-04-08 19:48:382528in either file1 or file2). Also eight other lines are the same
Junio C Hamanoc14e6ad2014-10-31 20:25:532529from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div>
2530<div class="paragraph"><p>When shown by <code>git diff-tree -c</code>, it compares the parents of a
Junio C Hamanofb56a962006-01-28 10:38:192531merge commit with the merge result (i.e. file1..fileN are the
Junio C Hamanoc14e6ad2014-10-31 20:25:532532parents). When shown by <code>git diff-files -c</code>, it compares the
Junio C Hamanofb56a962006-01-28 10:38:192533two unresolved merge parents with the working tree file
2534(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:312535"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192536</div>
Junio C Hamano9629d4f2012-12-19 00:28:272537</div>
2538<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312539<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:022540<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:532541<div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and
2542copied files. The <code>--stat</code> option adds diffstat(1) graph to the
Junio C Hamano3a702342007-12-12 21:34:022543output. These options can be combined with other options, such as
Junio C Hamanoc14e6ad2014-10-31 20:25:532544<code>-p</code>, and are meant for human consumption.</p></div>
2545<div class="paragraph"><p>When showing a change that involves a rename or a copy, <code>--stat</code> output
Junio C Hamano3a702342007-12-12 21:34:022546formats the pathnames compactly by combining common prefix and suffix of
Junio C Hamanoc14e6ad2014-10-31 20:25:532547the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to
2548<code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022549<div class="listingblock">
2550<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532551<pre><code>arch/{i386 =&gt; x86}/Makefile | 4 +--</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022552</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532553<div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed
2554for easier machine consumption. An entry in <code>--numstat</code> output looks
Junio C Hamanoba4b9282008-07-06 05:20:312555like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022556<div class="listingblock">
2557<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532558<pre><code>1 2 README
25593 1 arch/{i386 =&gt; x86}/Makefile</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022560</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592561<div class="paragraph"><p>That is, from left to right:</p></div>
2562<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022563<li>
2564<p>
2565the number of added lines;
2566</p>
2567</li>
2568<li>
2569<p>
2570a tab;
2571</p>
2572</li>
2573<li>
2574<p>
2575the number of deleted lines;
2576</p>
2577</li>
2578<li>
2579<p>
2580a tab;
2581</p>
2582</li>
2583<li>
2584<p>
2585pathname (possibly with rename/copy information);
2586</p>
2587</li>
2588<li>
2589<p>
2590a newline.
2591</p>
2592</li>
Junio C Hamanoba4b9282008-07-06 05:20:312593</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532594<div class="paragraph"><p>When <code>-z</code> output option is in effect, the output is formatted this way:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022595<div class="listingblock">
2596<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532597<pre><code>1 2 README NUL
25983 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022599</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592600<div class="paragraph"><p>That is:</p></div>
2601<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022602<li>
2603<p>
2604the number of added lines;
2605</p>
2606</li>
2607<li>
2608<p>
2609a tab;
2610</p>
2611</li>
2612<li>
2613<p>
2614the number of deleted lines;
2615</p>
2616</li>
2617<li>
2618<p>
2619a tab;
2620</p>
2621</li>
2622<li>
2623<p>
2624a NUL (only exists if renamed/copied);
2625</p>
2626</li>
2627<li>
2628<p>
2629pathname in preimage;
2630</p>
2631</li>
2632<li>
2633<p>
2634a NUL (only exists if renamed/copied);
2635</p>
2636</li>
2637<li>
2638<p>
2639pathname in postimage (only exists if renamed/copied);
2640</p>
2641</li>
2642<li>
2643<p>
2644a NUL.
2645</p>
2646</li>
Junio C Hamanoba4b9282008-07-06 05:20:312647</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532648<div class="paragraph"><p>The extra <code>NUL</code> before the preimage path in renamed case is to allow
Junio C Hamano3a702342007-12-12 21:34:022649scripts that read the output to tell if the current record being read is
2650a single-path record or a rename/copy record without reading ahead.
Junio C Hamanoc14e6ad2014-10-31 20:25:532651After reading added and deleted lines, reading up to <code>NUL</code> would yield
2652the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:022653</div>
Junio C Hamano9629d4f2012-12-19 00:28:272654</div>
2655<div class="sect1">
Junio C Hamanob9d9d902018-05-23 07:07:422656<h2 id="_operating_modes">OPERATING MODES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232657<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592658<div class="paragraph"><p>You can choose whether you want to trust the index file entirely
Junio C Hamano92d80372016-07-13 22:00:052659(using the <code>--cached</code> flag) or ask the diff logic to show any files
Junio C Hamano68cf15a2010-11-06 01:01:592660that don&#8217;t match the stat state as being "tentatively changed". Both
Junio C Hamanoba4b9282008-07-06 05:20:312661of these operations are very useful indeed.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232662</div>
Junio C Hamano9629d4f2012-12-19 00:28:272663</div>
2664<div class="sect1">
Junio C Hamanob9d9d902018-05-23 07:07:422665<h2 id="_cached_mode">CACHED MODE</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232666<div class="sectionbody">
Junio C Hamano92d80372016-07-13 22:00:052667<div class="paragraph"><p>If <code>--cached</code> is specified, it allows you to ask:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232668<div class="literalblock">
2669<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532670<pre><code>show me the differences between HEAD and the current index
2671contents (the ones I'd write using 'git write-tree')</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232672</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592673<div class="paragraph"><p>For example, let&#8217;s say that you have worked on your working directory, updated
Junio C Hamano235a91e2006-01-07 01:13:582674some files in the index and are ready to commit. You want to see exactly
Junio C Hamanodcc22ee2006-11-03 02:40:132675<strong>what</strong> you are going to commit, without having to write a new tree
Junio C Hamanoba4b9282008-07-06 05:20:312676object and compare it that way, and to do that, you just do</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232677<div class="literalblock">
2678<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532679<pre><code>git diff-index --cached HEAD</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232680</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532681<div class="paragraph"><p>Example: let&#8217;s say I had renamed <code>commit.c</code> to <code>git-commit.c</code>, and I had
2682done an <code>update-index</code> to make that effective in the index file.
2683<code>git diff-files</code> wouldn&#8217;t show anything at all, since the index file
Junio C Hamano1aa40d22010-01-21 17:46:432684matches my working directory. But doing a <em>git diff-index</em> does:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232685<div class="literalblock">
2686<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532687<pre><code>torvalds@ppc970:~/git&gt; git diff-index --cached HEAD
Junio C Hamano1a4e8412005-12-27 08:17:232688-100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c
Junio C Hamanoc14e6ad2014-10-31 20:25:532689+100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232690</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592691<div class="paragraph"><p>You can see easily that the above is a rename.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532692<div class="paragraph"><p>In fact, <code>git diff-index --cached</code> <strong>should</strong> always be entirely equivalent to
Junio C Hamano1aa40d22010-01-21 17:46:432693actually doing a <em>git write-tree</em> and comparing that. Except this one is much
Junio C Hamanoba4b9282008-07-06 05:20:312694nicer for the case where you just want to check where you are.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532695<div class="paragraph"><p>So doing a <code>git diff-index --cached</code> is basically very useful when you are
Junio C Hamano1a4e8412005-12-27 08:17:232696asking yourself "what have I already marked for being committed, and
Junio C Hamano68cf15a2010-11-06 01:01:592697what&#8217;s the difference to a previous tree".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232698</div>
Junio C Hamano9629d4f2012-12-19 00:28:272699</div>
2700<div class="sect1">
Junio C Hamanob9d9d902018-05-23 07:07:422701<h2 id="_non_cached_mode">NON-CACHED MODE</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232702<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592703<div class="paragraph"><p>The "non-cached" mode takes a different approach, and is potentially
2704the more useful of the two in that what it does can&#8217;t be emulated with
2705a <em>git write-tree</em> + <em>git diff-tree</em>. Thus that&#8217;s the default mode.
Junio C Hamanoba4b9282008-07-06 05:20:312706The non-cached version asks the question:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232707<div class="literalblock">
2708<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532709<pre><code>show me the differences between HEAD and the currently checked out
Junio C Hamano88bf5712017-09-10 08:39:232710tree - index contents _and_ files that aren't up to date</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232711</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592712<div class="paragraph"><p>which is obviously a very useful question too, since that tells you what
Junio C Hamano1aa40d22010-01-21 17:46:432713you <strong>could</strong> commit. Again, the output matches the <em>git diff-tree -r</em>
Junio C Hamanoba4b9282008-07-06 05:20:312714output to a tee, but with a twist.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592715<div class="paragraph"><p>The twist is that if some file doesn&#8217;t match the index, we don&#8217;t have
Junio C Hamano1a4e8412005-12-27 08:17:232716a backing store thing for it, and we use the magic "all-zero" sha1 to
Junio C Hamanoc14e6ad2014-10-31 20:25:532717show that. So let&#8217;s say that you have edited <code>kernel/sched.c</code>, but
Junio C Hamano1aa40d22010-01-21 17:46:432718have not actually done a <em>git update-index</em> on it yet - there is no
Junio C Hamanoba4b9282008-07-06 05:20:312719"object" associated with the new state, and you get:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232720<div class="literalblock">
2721<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532722<pre><code>torvalds@ppc970:~/v2.6/linux&gt; git diff-index --abbrev HEAD
2723:100644 100664 7476bb... 000000... kernel/sched.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232724</div></div>
Junio C Hamano88bf5712017-09-10 08:39:232725<div class="paragraph"><p>i.e., it shows that the tree has changed, and that <code>kernel/sched.c</code> is
2726not up to date and may contain new stuff. The all-zero sha1 means that to
Junio C Hamano1a4e8412005-12-27 08:17:232727get the real diff, you need to look at the object in the working directory
Junio C Hamanoba4b9282008-07-06 05:20:312728directly rather than do an object-to-object diff.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232729<div class="admonitionblock">
2730<table><tr>
2731<td class="icon">
2732<div class="title">Note</div>
2733</td>
Junio C Hamano1aa40d22010-01-21 17:46:432734<td class="content">As with other commands of this type, <em>git diff-index</em> does not
Junio C Hamano1a4e8412005-12-27 08:17:232735actually look at the contents of the file at all. So maybe
Junio C Hamanoc14e6ad2014-10-31 20:25:532736<code>kernel/sched.c</code> hasn&#8217;t actually changed, and it&#8217;s just that you
Junio C Hamano68cf15a2010-11-06 01:01:592737touched it. In either case, it&#8217;s a note that you need to
Junio C Hamano1aa40d22010-01-21 17:46:432738<em>git update-index</em> it to make the index be in sync.</td>
Junio C Hamano1a4e8412005-12-27 08:17:232739</tr></table>
2740</div>
2741<div class="admonitionblock">
2742<table><tr>
2743<td class="icon">
2744<div class="title">Note</div>
2745</td>
2746<td class="content">You can have a mixture of files show up as "has been updated"
2747and "is still dirty in the working directory" together. You can always
2748tell which file is in which state, since the "has been updated" ones
2749show a valid sha1, and the "not in sync with the index" ones will
2750always have the special all-zero sha1.</td>
2751</tr></table>
2752</div>
2753</div>
Junio C Hamano9629d4f2012-12-19 00:28:272754</div>
2755<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312756<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232757<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:232758<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232759</div>
Junio C Hamano7bd050f2011-09-22 06:32:222760</div>
Junio C Hamano9629d4f2012-12-19 00:28:272761</div>
Junio C Hamano7bd050f2011-09-22 06:32:222762<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:232763<div id="footer">
2764<div id="footer-text">
Junio C Hamano2ef0ba32018-01-26 23:13:532765Last updated
Junio C Hamanodf3d3cd2020-11-02 22:05:052766 2020-11-02 14:02:22 PST
Junio C Hamano1a4e8412005-12-27 08:17:232767</div>
2768</div>
2769</body>
2770</html>