blob: 9a3477dce1391bec1e73e4ff0a0ee3c6d195f1da [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9629d4f2012-12-19 00:28:275<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoc14e6ad2014-10-31 20:25:536<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-diff-index(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
Junio C Hamano9629d4f2012-12-19 00:28:279/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2324}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamanoba4b9282008-07-06 05:20:3130a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano1a4e8412005-12-27 08:17:2337
38em {
39 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5940 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2341}
42
43strong {
44 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5945 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2346}
47
Junio C Hamano1a4e8412005-12-27 08:17:2348h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2350 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamanoba4b9282008-07-06 05:20:3155h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2356 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2359 padding-top: 0.5em;
60}
Junio C Hamanoba4b9282008-07-06 05:20:3161h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9629d4f2012-12-19 00:28:2767h5 {
68 font-size: 1.0em;
69}
Junio C Hamano1a4e8412005-12-27 08:17:2370
71div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2372 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano68cf15a2010-11-06 01:01:5984ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9629d4f2012-12-19 00:28:2787ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5989
Junio C Hamanoc14e6ad2014-10-31 20:25:5390.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2394 padding: 0;
95 margin: 0;
96}
Junio C Hamanoc14e6ad2014-10-31 20:25:5397pre {
98 white-space: pre-wrap;
99}
Junio C Hamano1a4e8412005-12-27 08:17:23100
Junio C Hamano9629d4f2012-12-19 00:28:27101#author {
Junio C Hamano1a4e8412005-12-27 08:17:23102 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23103 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31104 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23105}
Junio C Hamano9629d4f2012-12-19 00:28:27106#email {
Junio C Hamano1a4e8412005-12-27 08:17:23107}
Junio C Hamano9629d4f2012-12-19 00:28:27108#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23109}
110
Junio C Hamano9629d4f2012-12-19 00:28:27111#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9629d4f2012-12-19 00:28:27117#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9629d4f2012-12-19 00:28:27121#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9629d4f2012-12-19 00:28:27126#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9629d4f2012-12-19 00:28:27130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22133 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59149 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9629d4f2012-12-19 00:28:27171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9629d4f2012-12-19 00:28:27177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23180 padding: 0.5em;
181}
182
Junio C Hamano7bd050f2011-09-22 06:32:22183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59186 margin-right: 10%;
Junio C Hamano9629d4f2012-12-19 00:28:27187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23189}
Junio C Hamano7bd050f2011-09-22 06:32:22190
Junio C Hamano68cf15a2010-11-06 01:01:59191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23193 text-align: right;
194}
Junio C Hamano68cf15a2010-11-06 01:01:59195
Junio C Hamano9629d4f2012-12-19 00:28:27196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31205div.verseblock + div.attribution {
206 text-align: left;
207}
Junio C Hamano1a4e8412005-12-27 08:17:23208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22219 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221
222div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23225}
226
Junio C Hamano1a4e8412005-12-27 08:17:23227div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano68cf15a2010-11-06 01:01:59229a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59238 font-style: normal;
239 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23240}
241dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59242 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23243}
244
245ul, ol {
246 list-style-position: outside;
247}
Junio C Hamano68cf15a2010-11-06 01:01:59248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23252 list-style-type: lower-alpha;
253}
Junio C Hamano68cf15a2010-11-06 01:01:59254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
Junio C Hamano1a4e8412005-12-27 08:17:23270
Junio C Hamano1a4e8412005-12-27 08:17:23271tfoot {
272 font-weight: bold;
273}
Junio C Hamano68cf15a2010-11-06 01:01:59274td > div.verse {
275 white-space: pre;
276}
Junio C Hamano68cf15a2010-11-06 01:01:59277
278div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
Junio C Hamano68cf15a2010-11-06 01:01:59282div.hdlist tr {
283 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31284}
Junio C Hamano68cf15a2010-11-06 01:01:59285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23289 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59290 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23291 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59292 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23293}
Junio C Hamano68cf15a2010-11-06 01:01:59294td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23295 vertical-align: top;
296}
Junio C Hamano68cf15a2010-11-06 01:01:59297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
Junio C Hamano1a4e8412005-12-27 08:17:23305
Junio C Hamano7bd050f2011-09-22 06:32:22306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9629d4f2012-12-19 00:28:27333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23340}
Junio C Hamanoba4b9282008-07-06 05:20:31341
Junio C Hamano9629d4f2012-12-19 00:28:27342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9629d4f2012-12-19 00:28:27350#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31351 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamanoc14e6ad2014-10-31 20:25:53358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamano9629d4f2012-12-19 00:28:27374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamanoc14e6ad2014-10-31 20:25:53416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9629d4f2012-12-19 00:28:27418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
Junio C Hamano9629d4f2012-12-19 00:28:27526body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59527 border-style: none;
528}
Junio C Hamano9629d4f2012-12-19 00:28:27529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59531}
532
533@media print {
Junio C Hamano9629d4f2012-12-19 00:28:27534 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59535}
Junio C Hamanoc14e6ad2014-10-31 20:25:53536
537
Junio C Hamano1a4e8412005-12-27 08:17:23538</style>
Junio C Hamano7bd050f2011-09-22 06:32:22539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9629d4f2012-12-19 00:28:27602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9629d4f2012-12-19 00:28:27612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9629d4f2012-12-19 00:28:27648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9629d4f2012-12-19 00:28:27651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9629d4f2012-12-19 00:28:27658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9629d4f2012-12-19 00:28:27672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamano7bd050f2011-09-22 06:32:22682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9629d4f2012-12-19 00:28:27705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22727}
728
729}
Junio C Hamano9629d4f2012-12-19 00:28:27730asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22731/*]]>*/
732</script>
Junio C Hamano1a4e8412005-12-27 08:17:23733</head>
Junio C Hamano9629d4f2012-12-19 00:28:27734<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23735<div id="header">
736<h1>
737git-diff-index(1) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>git-diff-index -
Junio C Hamano7e590a12013-06-02 23:46:52742 Compare a tree to the working tree or index
Junio C Hamano1a4e8412005-12-27 08:17:23743</p>
744</div>
745</div>
Junio C Hamano7bd050f2011-09-22 06:32:22746<div id="content">
Junio C Hamano9629d4f2012-12-19 00:28:27747<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59748<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23749<div class="sectionbody">
Junio C Hamano15567bc2011-07-23 00:51:59750<div class="verseblock">
Junio C Hamano9629d4f2012-12-19 00:28:27751<pre class="content"><em>git diff-index</em> [-m] [--cached] [&lt;common diff options&gt;] &lt;tree-ish&gt; [&lt;path&gt;&#8230;]</pre>
752<div class="attribution">
Junio C Hamano15567bc2011-07-23 00:51:59753</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23754</div>
Junio C Hamano9629d4f2012-12-19 00:28:27755</div>
756<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31757<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23758<div class="sectionbody">
Junio C Hamano7e590a12013-06-02 23:46:52759<div class="paragraph"><p>Compares the content and mode of the blobs found in a tree object
760with the corresponding tracked files in the working tree, or with the
761corresponding paths in the index. When &lt;path&gt; arguments are present,
762compares only paths matching those patterns. Otherwise all tracked
763files are compared.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23764</div>
Junio C Hamano9629d4f2012-12-19 00:28:27765</div>
766<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31767<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23768<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59769<div class="dlist"><dl>
770<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23771-p
772</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59773<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22774-u
775</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59776<dt class="hdlist1">
Junio C Hamanoe97d5772010-05-19 08:13:58777--patch
778</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23779<dd>
780<p>
Junio C Hamanoff979792007-11-16 10:11:30781 Generate patch (see section on generating patches).
Junio C Hamano1a4e8412005-12-27 08:17:23782</p>
783</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59784<dt class="hdlist1">
Junio C Hamano58f587a2013-07-22 19:20:59785-s
786</dt>
787<dt class="hdlist1">
788--no-patch
789</dt>
790<dd>
791<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53792 Suppress diff output. Useful for commands like <code>git show</code> that
793 show the patch by default, or to cancel the effect of <code>--patch</code>.
Junio C Hamano58f587a2013-07-22 19:20:59794</p>
795</dd>
796<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34797-U&lt;n&gt;
798</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59799<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34800--unified=&lt;n&gt;
801</dt>
802<dd>
803<p>
804 Generate diffs with &lt;n&gt; lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:37805 the usual three.
Junio C Hamanoc14e6ad2014-10-31 20:25:53806 Implies <code>-p</code>.
Junio C Hamano69361562007-07-26 02:14:34807</p>
808</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59809<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34810--raw
811</dt>
812<dd>
813<p>
Junio C Hamano85f1fde2015-06-01 20:37:32814 Generate the diff in raw format.
Junio C Hamano1dbca522015-05-22 20:48:55815 This is the default.
Junio C Hamano9ae1a062006-07-10 08:12:34816</p>
817</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59818<dt class="hdlist1">
Junio C Hamano54559c82006-04-13 07:45:12819--patch-with-raw
820</dt>
821<dd>
822<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53823 Synonym for <code>-p --raw</code>.
Junio C Hamano54559c82006-04-13 07:45:12824</p>
825</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59826<dt class="hdlist1">
Junio C Hamanoad70bf02016-09-26 23:44:27827--indent-heuristic
828</dt>
829<dt class="hdlist1">
830--no-indent-heuristic
831</dt>
Junio C Hamano5f888332016-06-13 19:28:31832<dd>
833<p>
Junio C Hamanoad70bf02016-09-26 23:44:27834 These are to help debugging and tuning experimental heuristics
835 (which are off by default) that shift diff hunk boundaries to
836 make patches easier to read.
Junio C Hamano5f888332016-06-13 19:28:31837</p>
838</dd>
839<dt class="hdlist1">
Junio C Hamano5a73f302011-10-14 05:58:34840--minimal
841</dt>
842<dd>
843<p>
844 Spend extra time to make sure the smallest possible
845 diff is produced.
846</p>
847</dd>
848<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02849--patience
850</dt>
851<dd>
852<p>
853 Generate a diff using the "patience diff" algorithm.
854</p>
855</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59856<dt class="hdlist1">
Junio C Hamanoaea9e6b2012-03-07 00:17:11857--histogram
858</dt>
859<dd>
860<p>
861 Generate a diff using the "histogram diff" algorithm.
862</p>
863</dd>
864<dt class="hdlist1">
Junio C Hamano80ad00d2013-02-18 00:19:03865--diff-algorithm={patience|minimal|histogram|myers}
866</dt>
867<dd>
868<p>
869 Choose a diff algorithm. The variants are as follows:
870</p>
871<div class="openblock">
872<div class="content">
873<div class="dlist"><dl>
874<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53875<code>default</code>, <code>myers</code>
Junio C Hamano80ad00d2013-02-18 00:19:03876</dt>
877<dd>
878<p>
879 The basic greedy diff algorithm. Currently, this is the default.
880</p>
881</dd>
882<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53883<code>minimal</code>
Junio C Hamano80ad00d2013-02-18 00:19:03884</dt>
885<dd>
886<p>
887 Spend extra time to make sure the smallest possible diff is
888 produced.
889</p>
890</dd>
891<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53892<code>patience</code>
Junio C Hamano80ad00d2013-02-18 00:19:03893</dt>
894<dd>
895<p>
896 Use "patience diff" algorithm when generating patches.
897</p>
898</dd>
899<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53900<code>histogram</code>
Junio C Hamano80ad00d2013-02-18 00:19:03901</dt>
902<dd>
903<p>
904 This algorithm extends the patience algorithm to "support
905 low-occurrence common elements".
906</p>
907</dd>
908</dl></div>
909</div></div>
910<div class="paragraph"><p>For instance, if you configured diff.algorithm variable to a
911non-default value and want to use the default one, then you
Junio C Hamanoc14e6ad2014-10-31 20:25:53912have to use <code>--diff-algorithm=default</code> option.</p></div>
Junio C Hamano80ad00d2013-02-18 00:19:03913</dd>
914<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32915--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamanoba7c8d82006-04-15 06:17:42916</dt>
917<dd>
918<p>
Junio C Hamanoaea9e6b2012-03-07 00:17:11919 Generate a diffstat. By default, as much space as necessary
920 will be used for the filename part, and the rest for the graph
921 part. Maximum width defaults to terminal width, or 80 columns
Junio C Hamano7f2b3cb2012-06-22 22:42:39922 if not connected to a terminal, and can be overridden by
Junio C Hamanoc14e6ad2014-10-31 20:25:53923 <code>&lt;width&gt;</code>. The width of the filename part can be limited by
924 giving another width <code>&lt;name-width&gt;</code> after a comma. The width
Junio C Hamanoaea9e6b2012-03-07 00:17:11925 of the graph part can be limited by using
Junio C Hamanoc14e6ad2014-10-31 20:25:53926 <code>--stat-graph-width=&lt;width&gt;</code> (affects all commands generating
927 a stat graph) or by setting <code>diff.statGraphWidth=&lt;width&gt;</code>
928 (does not affect <code>git format-patch</code>).
929 By giving a third parameter <code>&lt;count&gt;</code>, you can limit the
930 output to the first <code>&lt;count&gt;</code> lines, followed by <code>...</code> if
Junio C Hamanoaea9e6b2012-03-07 00:17:11931 there are more.
Junio C Hamanoba7c8d82006-04-15 06:17:42932</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53933<div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=&lt;width&gt;</code>,
934<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:42935</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59936<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48937--numstat
938</dt>
939<dd>
940<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53941 Similar to <code>--stat</code>, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:48942 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43943 abbreviation, to make it more machine friendly. For
Junio C Hamanoc14e6ad2014-10-31 20:25:53944 binary files, outputs two <code>-</code> instead of saying
945 <code>0 0</code>.
Junio C Hamanofbe00522006-10-19 05:58:48946</p>
947</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59948<dt class="hdlist1">
Junio C Hamano7d23f5e2006-12-16 07:44:04949--shortstat
950</dt>
951<dd>
952<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53953 Output only the last line of the <code>--stat</code> format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:04954 number of modified files, as well as number of added and deleted
955 lines.
956</p>
957</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59958<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32959--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03960</dt>
961<dd>
962<p>
Junio C Hamano1c222c52011-05-13 19:55:32963 Output the distribution of relative amount of changes for each
Junio C Hamanoc14e6ad2014-10-31 20:25:53964 sub-directory. The behavior of <code>--dirstat</code> can be customized by
Junio C Hamano1c222c52011-05-13 19:55:32965 passing it a comma separated list of parameters.
Junio C Hamanoc14e6ad2014-10-31 20:25:53966 The defaults are controlled by the <code>diff.dirstat</code> configuration
Junio C Hamanoa28a9202012-06-21 07:08:23967 variable (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1c222c52011-05-13 19:55:32968 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:03969</p>
Junio C Hamano9629d4f2012-12-19 00:28:27970<div class="openblock">
971<div class="content">
Junio C Hamano1c222c52011-05-13 19:55:32972<div class="dlist"><dl>
973<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53974<code>changes</code>
Junio C Hamano1c222c52011-05-13 19:55:32975</dt>
976<dd>
977<p>
978 Compute the dirstat numbers by counting the lines that have been
979 removed from the source, or added to the destination. This ignores
980 the amount of pure code movements within a file. In other words,
981 rearranging lines in a file is not counted as much as other changes.
982 This is the default behavior when no parameter is given.
983</p>
Junio C Hamano6a45be92008-04-22 08:19:03984</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59985<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53986<code>lines</code>
Junio C Hamanoa476efa2008-10-10 15:31:42987</dt>
988<dd>
989<p>
Junio C Hamano1c222c52011-05-13 19:55:32990 Compute the dirstat numbers by doing the regular line-based diff
991 analysis, and summing the removed/added line counts. (For binary
992 files, count 64-byte chunks instead, since binary files have no
Junio C Hamanoc14e6ad2014-10-31 20:25:53993 natural concept of lines). This is a more expensive <code>--dirstat</code>
994 behavior than the <code>changes</code> behavior, but it does count rearranged
Junio C Hamano1c222c52011-05-13 19:55:32995 lines within a file as much as other changes. The resulting output
Junio C Hamanoc14e6ad2014-10-31 20:25:53996 is consistent with what you get from the other <code>--*stat</code> options.
Junio C Hamanoa476efa2008-10-10 15:31:42997</p>
998</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59999<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531000<code>files</code>
Junio C Hamano1c222c52011-05-13 19:55:321001</dt>
1002<dd>
1003<p>
1004 Compute the dirstat numbers by counting the number of files changed.
1005 Each changed file counts equally in the dirstat analysis. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531006 the computationally cheapest <code>--dirstat</code> behavior, since it does
Junio C Hamano1c222c52011-05-13 19:55:321007 not have to look at the file contents at all.
1008</p>
1009</dd>
1010<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531011<code>cumulative</code>
Junio C Hamano1c222c52011-05-13 19:55:321012</dt>
1013<dd>
1014<p>
1015 Count changes in a child directory for the parent directory as well.
Junio C Hamanoc14e6ad2014-10-31 20:25:531016 Note that when using <code>cumulative</code>, the sum of the percentages
Junio C Hamano1c222c52011-05-13 19:55:321017 reported may exceed 100%. The default (non-cumulative) behavior can
Junio C Hamanoc14e6ad2014-10-31 20:25:531018 be specified with the <code>noncumulative</code> parameter.
Junio C Hamano1c222c52011-05-13 19:55:321019</p>
1020</dd>
1021<dt class="hdlist1">
1022&lt;limit&gt;
1023</dt>
1024<dd>
1025<p>
1026 An integer parameter specifies a cut-off percent (3% by default).
1027 Directories contributing less than this percentage of the changes
1028 are not shown in the output.
1029</p>
1030</dd>
1031</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271032</div></div>
Junio C Hamano1c222c52011-05-13 19:55:321033<div class="paragraph"><p>Example: The following will count changed files, while ignoring
1034directories with less than 10% of the total amount of changed files,
1035and accumulating child directory counts in the parent directories:
Junio C Hamanoc14e6ad2014-10-31 20:25:531036<code>--dirstat=files,10,cumulative</code>.</p></div>
Junio C Hamano1c222c52011-05-13 19:55:321037</dd>
1038<dt class="hdlist1">
Junio C Hamano6959c6c2006-05-17 10:34:111039--summary
1040</dt>
1041<dd>
1042<p>
1043 Output a condensed summary of extended header information
1044 such as creations, renames and mode changes.
1045</p>
1046</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591047<dt class="hdlist1">
Junio C Hamanod1308c92006-04-16 11:01:091048--patch-with-stat
1049</dt>
1050<dd>
1051<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531052 Synonym for <code>-p --stat</code>.
Junio C Hamanod1308c92006-04-16 11:01:091053</p>
1054</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591055<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231056-z
1057</dt>
1058<dd>
1059<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531060 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:341061 given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano1a4e8412005-12-27 08:17:231062</p>
Junio C Hamano0f6f3bf2017-03-13 07:01:531063<div class="paragraph"><p>Without this option, pathnames with "unusual" characters are quoted as
1064explained for the configuration variable <code>core.quotePath</code> (see
1065<a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231066</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591067<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231068--name-only
1069</dt>
1070<dd>
1071<p>
1072 Show only names of changed files.
1073</p>
1074</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591075<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231076--name-status
1077</dt>
1078<dd>
1079<p>
Junio C Hamanoa9aee782008-04-23 16:09:201080 Show only names and status of changed files. See the description
Junio C Hamanoc14e6ad2014-10-31 20:25:531081 of the <code>--diff-filter</code> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:231082</p>
1083</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591084<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:551085--submodule[=&lt;format&gt;]
1086</dt>
1087<dd>
1088<p>
Junio C Hamanocd451662016-09-13 00:54:091089 Specify how differences in submodules are shown. When specifying
1090 <code>--submodule=short</code> the <em>short</em> format is used. This format just
1091 shows the names of the commits at the beginning and end of the range.
1092 When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em>
1093 format is used. This format lists the commits in the range like
1094 <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
1095 is specified, the <em>diff</em> format is used. This format shows an
1096 inline diff of the changes in the submodule contents between the
1097 commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format
1098 if the config option is unset.
Junio C Hamanoc21ab052009-10-31 04:03:551099</p>
1100</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591101<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:121102--color[=&lt;when&gt;]
Junio C Hamano9ae1a062006-07-10 08:12:341103</dt>
1104<dd>
1105<p>
1106 Show colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531107 <code>--color</code> (i.e. without <em>=&lt;when&gt;</em>) is the same as <code>--color=always</code>.
1108 <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:341109</p>
1110</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591111<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341112--no-color
1113</dt>
1114<dd>
1115<p>
Junio C Hamano5f2627d2011-05-06 20:23:481116 Turn off colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531117 It is the same as <code>--color=never</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341118</p>
1119</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591120<dt class="hdlist1">
Junio C Hamanofb1fdf12017-08-27 06:14:591121--color-moved[=&lt;mode&gt;]
1122</dt>
1123<dd>
1124<p>
1125 Moved lines of code are colored differently.
1126 The &lt;mode&gt; defaults to <em>no</em> if the option is not given
1127 and to <em>zebra</em> if the option with no mode is given.
1128 The mode must be one of:
1129</p>
1130<div class="openblock">
1131<div class="content">
1132<div class="dlist"><dl>
1133<dt class="hdlist1">
1134no
1135</dt>
1136<dd>
1137<p>
1138 Moved lines are not highlighted.
1139</p>
1140</dd>
1141<dt class="hdlist1">
1142default
1143</dt>
1144<dd>
1145<p>
1146 Is a synonym for <code>zebra</code>. This may change to a more sensible mode
1147 in the future.
1148</p>
1149</dd>
1150<dt class="hdlist1">
1151plain
1152</dt>
1153<dd>
1154<p>
1155 Any line that is added in one location and was removed
1156 in another location will be colored with <em>color.diff.newMoved</em>.
1157 Similarly <em>color.diff.oldMoved</em> will be used for removed lines
1158 that are added somewhere else in the diff. This mode picks up any
1159 moved line, but it is not very useful in a review to determine
1160 if a block of code was moved without permutation.
1161</p>
1162</dd>
1163<dt class="hdlist1">
1164zebra
1165</dt>
1166<dd>
1167<p>
1168 Blocks of moved text of at least 20 alphanumeric characters
1169 are detected greedily. The detected blocks are
1170 painted using either the <em>color.diff.{old,new}Moved</em> color or
1171 <em>color.diff.{old,new}MovedAlternative</em>. The change between
1172 the two colors indicates that a new block was detected.
1173</p>
1174</dd>
1175<dt class="hdlist1">
1176dimmed_zebra
1177</dt>
1178<dd>
1179<p>
1180 Similar to <em>zebra</em>, but additional dimming of uninteresting parts
1181 of moved code is performed. The bordering lines of two adjacent
1182 blocks are considered interesting, the rest is uninteresting.
1183</p>
1184</dd>
1185</dl></div>
1186</div></div>
1187</dd>
1188<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531189--word-diff[=&lt;mode&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:411190</dt>
1191<dd>
1192<p>
Junio C Hamanocc7636a2010-05-21 14:57:531193 Show a word diff, using the &lt;mode&gt; to delimit changed words.
1194 By default, words are delimited by whitespace; see
Junio C Hamanoc14e6ad2014-10-31 20:25:531195 <code>--word-diff-regex</code> below. The &lt;mode&gt; defaults to <em>plain</em>, and
Junio C Hamanocc7636a2010-05-21 14:57:531196 must be one of:
Junio C Hamano85e45fa2006-08-13 07:47:411197</p>
Junio C Hamano9629d4f2012-12-19 00:28:271198<div class="openblock">
1199<div class="content">
Junio C Hamano68cf15a2010-11-06 01:01:591200<div class="dlist"><dl>
1201<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531202color
1203</dt>
1204<dd>
1205<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531206 Highlight changed words using only colors. Implies <code>--color</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531207</p>
1208</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591209<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531210plain
1211</dt>
1212<dd>
1213<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531214 Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no
Junio C Hamanocc7636a2010-05-21 14:57:531215 attempts to escape the delimiters if they appear in the input,
1216 so the output may be ambiguous.
1217</p>
1218</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591219<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531220porcelain
1221</dt>
1222<dd>
1223<p>
1224 Use a special line-based format intended for script
1225 consumption. Added/removed/unchanged runs are printed in the
Junio C Hamanoc14e6ad2014-10-31 20:25:531226 usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
Junio C Hamanocc7636a2010-05-21 14:57:531227 character at the beginning of the line and extending to the
1228 end of the line. Newlines in the input are represented by a
Junio C Hamanoc14e6ad2014-10-31 20:25:531229 tilde <code>~</code> on a line of its own.
Junio C Hamanocc7636a2010-05-21 14:57:531230</p>
1231</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591232<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531233none
1234</dt>
1235<dd>
1236<p>
1237 Disable word diff again.
1238</p>
1239</dd>
1240</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271241</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591242<div class="paragraph"><p>Note that despite the name of the first mode, color is used to
Junio C Hamanocc7636a2010-05-21 14:57:531243highlight the changed parts in all modes if enabled.</p></div>
1244</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591245<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531246--word-diff-regex=&lt;regex&gt;
1247</dt>
1248<dd>
1249<p>
1250 Use &lt;regex&gt; to decide what a word is, instead of considering
1251 runs of non-whitespace to be a word. Also implies
Junio C Hamanoc14e6ad2014-10-31 20:25:531252 <code>--word-diff</code> unless it was already enabled.
Junio C Hamanocc7636a2010-05-21 14:57:531253</p>
Junio C Hamano68cf15a2010-11-06 01:01:591254<div class="paragraph"><p>Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:021255&lt;regex&gt; is considered a word. Anything between these matches is
1256considered whitespace and ignored(!) for the purposes of finding
Junio C Hamanoc14e6ad2014-10-31 20:25:531257differences. You may want to append <code>|[^[:space:]]</code> to your regular
Junio C Hamano20d47e32009-01-26 06:36:021258expression to make sure that it matches all non-whitespace characters.
1259A match that contains a newline is silently truncated(!) at the
1260newline.</p></div>
Junio C Hamano713eded2015-12-03 00:24:021261<div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
1262and, correspondingly, show differences character by character.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591263<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:241264<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:021265overrides any diff driver or configuration setting. Diff drivers
1266override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:411267</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591268<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531269--color-words[=&lt;regex&gt;]
1270</dt>
1271<dd>
1272<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531273 Equivalent to <code>--word-diff=color</code> plus (if a regex was
1274 specified) <code>--word-diff-regex=&lt;regex&gt;</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531275</p>
1276</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591277<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341278--no-renames
1279</dt>
1280<dd>
1281<p>
1282 Turn off rename detection, even when the configuration
1283 file gives the default to do so.
1284</p>
1285</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591286<dt class="hdlist1">
Junio C Hamanoa890c4f2007-01-28 10:29:211287--check
1288</dt>
1289<dd>
1290<p>
Junio C Hamano84ea1e42016-04-08 21:53:481291 Warn if changes introduce conflict markers or whitespace errors.
1292 What are considered whitespace errors is controlled by <code>core.whitespace</code>
Junio C Hamano6005bfa2011-06-23 00:51:221293 configuration. By default, trailing whitespaces (including
1294 lines that solely consist of whitespaces) and a space character
1295 that is immediately followed by a tab character inside the
1296 initial indent of the line are considered whitespace errors.
1297 Exits with non-zero status if problems are found. Not compatible
1298 with --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:211299</p>
1300</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591301<dt class="hdlist1">
Junio C Hamano8c5d5942015-06-11 19:37:481302--ws-error-highlight=&lt;kind&gt;
1303</dt>
1304<dd>
1305<p>
Junio C Hamano4b2a6c12017-08-22 18:32:371306 Highlight whitespace errors in the <code>context</code>, <code>old</code> or <code>new</code>
1307 lines of the diff. Multiple values are separated by comma,
1308 <code>none</code> resets previous values, <code>default</code> reset the list to
1309 <code>new</code> and <code>all</code> is a shorthand for <code>old,new,context</code>. When
1310 this option is not given, and the configuration variable
1311 <code>diff.wsErrorHighlight</code> is not set, only whitespace errors in
1312 <code>new</code> lines are highlighted. The whitespace errors are colored
1313 whith <code>color.diff.whitespace</code>.
Junio C Hamano8c5d5942015-06-11 19:37:481314</p>
1315</dd>
1316<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231317--full-index
1318</dt>
1319<dd>
1320<p>
Junio C Hamano5cf43ca2008-08-20 09:14:141321 Instead of the first handful of characters, show the full
1322 pre- and post-image blob object names on the "index"
1323 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:231324</p>
1325</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591326<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341327--binary
1328</dt>
1329<dd>
1330<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531331 In addition to <code>--full-index</code>, output a binary diff that
1332 can be applied with <code>git-apply</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341333</p>
1334</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591335<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231336--abbrev[=&lt;n&gt;]
1337</dt>
1338<dd>
1339<p>
1340 Instead of showing the full 40-byte hexadecimal object
1341 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:561342 lines, show only a partial prefix. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531343 independent of the <code>--full-index</code> option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:231344 the diff-patch output format. Non default number of
Junio C Hamanoc14e6ad2014-10-31 20:25:531345 digits can be specified with <code>--abbrev=&lt;n&gt;</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231346</p>
1347</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591348<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141349-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231350</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591351<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541352--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1353</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231354<dd>
1355<p>
Junio C Hamanoe85e36f2010-08-10 05:30:141356 Break complete rewrite changes into pairs of delete and
1357 create. This serves two purposes:
Junio C Hamano1a4e8412005-12-27 08:17:231358</p>
Junio C Hamano68cf15a2010-11-06 01:01:591359<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:141360not as a series of deletion and insertion mixed together with a very
1361few lines that happen to match textually as the context, but as a
1362single deletion of everything old followed by a single insertion of
Junio C Hamanoc14e6ad2014-10-31 20:25:531363everything new, and the number <code>m</code> controls this aspect of the -B
1364option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the
Junio C Hamano076ffcc2013-02-06 05:13:211365original should remain in the result for Git to consider it a total
Junio C Hamanoe85e36f2010-08-10 05:30:141366rewrite (i.e. otherwise the resulting patch will be a series of
1367deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591368<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:141369source of a rename (usually -M only considers a file that disappeared
Junio C Hamanoc14e6ad2014-10-31 20:25:531370as the source of a rename), and the number <code>n</code> controls this aspect of
1371the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:591372addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:141373eligible for being picked up as a possible source of a rename to
1374another file.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231375</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591376<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141377-M[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231378</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591379<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261380--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541381</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231382<dd>
1383<p>
1384 Detect renames.
Junio C Hamanoc14e6ad2014-10-31 20:25:531385 If <code>n</code> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:141386 index (i.e. amount of addition/deletions compared to the
Junio C Hamanoc14e6ad2014-10-31 20:25:531387 file&#8217;s size). For example, <code>-M90%</code> means Git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:141388 delete/add pair to be a rename if more than 90% of the file
Junio C Hamanoc14e6ad2014-10-31 20:25:531389 hasn&#8217;t changed. Without a <code>%</code> sign, the number is to be read as
1390 a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
1391 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is
1392 the same as <code>-M5%</code>. To limit detection to exact renames, use
1393 <code>-M100%</code>. The default similarity index is 50%.
Junio C Hamano1a4e8412005-12-27 08:17:231394</p>
1395</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591396<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141397-C[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231398</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591399<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261400--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541401</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231402<dd>
1403<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531404 Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1405 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:231406</p>
1407</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591408<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231409--find-copies-harder
1410</dt>
1411<dd>
1412<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531413 For performance reasons, by default, <code>-C</code> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:231414 if the original file of the copy was modified in the same
1415 changeset. This flag makes the command
1416 inspect unmodified files as candidates for the source of
1417 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:141418 projects, so use it with caution. Giving more than one
Junio C Hamanoc14e6ad2014-10-31 20:25:531419 <code>-C</code> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:231420</p>
1421</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591422<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:021423-D
1424</dt>
1425<dt class="hdlist1">
1426--irreversible-delete
1427</dt>
1428<dd>
1429<p>
1430 Omit the preimage for deletes, i.e. print only the header but not
Junio C Hamanoc14e6ad2014-10-31 20:25:531431 the diff between the preimage and <code>/dev/null</code>. The resulting patch
1432 is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is
Junio C Hamanob02377c2011-04-28 22:26:021433 solely for people who want to just concentrate on reviewing the
Junio C Hamanod16fd1b2017-08-04 16:41:511434 text after the change. In addition, the output obviously lacks
Junio C Hamanob02377c2011-04-28 22:26:021435 enough information to apply such a patch in reverse, even manually,
1436 hence the name of the option.
1437</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531438<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:021439of a delete/create pair.</p></div>
1440</dd>
1441<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231442-l&lt;num&gt;
1443</dt>
1444<dd>
1445<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531446 The <code>-M</code> and <code>-C</code> options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:231447 is the number of potential rename/copy targets. This
1448 option prevents rename/copy detection from running if
1449 the number of rename/copy targets exceeds the specified
1450 number.
1451</p>
1452</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591453<dt class="hdlist1">
Junio C Hamano982eb112010-11-18 00:53:091454--diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1455</dt>
1456<dd>
1457<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531458 Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1459 Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1460 type (i.e. regular file, symlink, submodule, &#8230;) changed (<code>T</code>),
1461 are Unmerged (<code>U</code>), are
1462 Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
Junio C Hamano982eb112010-11-18 00:53:091463 Any combination of the filter characters (including none) can be used.
Junio C Hamanoc14e6ad2014-10-31 20:25:531464 When <code>*</code> (All-or-none) is added to the combination, all
Junio C Hamano982eb112010-11-18 00:53:091465 paths are selected if there is any file that matches
1466 other criteria in the comparison; if there is no file
1467 that matches other criteria, nothing is selected.
1468</p>
Junio C Hamanoeed15af2016-07-25 22:49:421469<div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1470<code>--diff-filter=ad</code> excludes added and deleted paths.</p></div>
Junio C Hamano982eb112010-11-18 00:53:091471</dd>
1472<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231473-S&lt;string&gt;
1474</dt>
1475<dd>
1476<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521477 Look for differences that change the number of occurrences of
1478 the specified string (i.e. addition/deletion) in a file.
1479 Intended for the scripter&#8217;s use.
Junio C Hamano1a4e8412005-12-27 08:17:231480</p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521481<div class="paragraph"><p>It is useful when you&#8217;re looking for an exact block of code (like a
1482struct), and want to know the history of that block since it first
1483came into being: use the feature iteratively to feed the interesting
Junio C Hamanoc14e6ad2014-10-31 20:25:531484block in the preimage back into <code>-S</code>, and keep going until you get the
Junio C Hamanof1f5a7b2013-06-11 22:23:521485very first version of the block.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231486</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591487<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:341488-G&lt;regex&gt;
1489</dt>
1490<dd>
1491<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521492 Look for differences whose patch text contains added/removed
1493 lines that match &lt;regex&gt;.
Junio C Hamano3b4609d2010-09-30 00:04:341494</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531495<div class="paragraph"><p>To illustrate the difference between <code>-S&lt;regex&gt; --pickaxe-regex</code> and
1496<code>-G&lt;regex&gt;</code>, consider a commit with the following diff in the same
Junio C Hamanof1f5a7b2013-06-11 22:23:521497file:</p></div>
1498<div class="listingblock">
1499<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531500<pre><code>+ return !regexec(regexp, two-&gt;ptr, 1, &amp;regmatch, 0);
Junio C Hamanof1f5a7b2013-06-11 22:23:521501...
Junio C Hamanoc14e6ad2014-10-31 20:25:531502- hit = !regexec(regexp, mf2.ptr, 1, &amp;regmatch, 0);</code></pre>
Junio C Hamanof1f5a7b2013-06-11 22:23:521503</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531504<div class="paragraph"><p>While <code>git log -G"regexec\(regexp"</code> will show this commit, <code>git log
1505-S"regexec\(regexp" --pickaxe-regex</code> will not (because the number of
Junio C Hamanof1f5a7b2013-06-11 22:23:521506occurrences of that string did not change).</p></div>
1507<div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1508information.</p></div>
Junio C Hamano3b4609d2010-09-30 00:04:341509</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591510<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231511--pickaxe-all
1512</dt>
1513<dd>
1514<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531515 When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:231516 changeset, not just the files that contain the change
1517 in &lt;string&gt;.
1518</p>
1519</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591520<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:281521--pickaxe-regex
1522</dt>
1523<dd>
1524<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531525 Treat the &lt;string&gt; given to <code>-S</code> as an extended POSIX regular
Junio C Hamanof1f5a7b2013-06-11 22:23:521526 expression to match.
Junio C Hamanobfe9e752006-04-05 21:43:281527</p>
1528</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591529<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231530-O&lt;orderfile&gt;
1531</dt>
1532<dd>
1533<p>
Junio C Hamanobcd98f42017-01-24 00:12:161534 Control the order in which files appear in the output.
Junio C Hamano322c6242015-03-23 21:32:461535 This overrides the <code>diff.orderFile</code> configuration variable
1536 (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
Junio C Hamanoc14e6ad2014-10-31 20:25:531537 use <code>-O/dev/null</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231538</p>
Junio C Hamanobcd98f42017-01-24 00:12:161539<div class="paragraph"><p>The output order is determined by the order of glob patterns in
1540&lt;orderfile&gt;.
1541All files with pathnames that match the first pattern are output
1542first, all files with pathnames that match the second pattern (but not
1543the first) are output next, and so on.
1544All files with pathnames that do not match any pattern are output
1545last, as if there was an implicit match-all pattern at the end of the
1546file.
1547If multiple pathnames have the same rank (they match the same pattern
1548but no earlier patterns), their output order relative to each other is
1549the normal order.</p></div>
1550<div class="paragraph"><p>&lt;orderfile&gt; is parsed as follows:</p></div>
1551<div class="openblock">
1552<div class="content">
1553<div class="ulist"><ul>
1554<li>
1555<p>
1556Blank lines are ignored, so they can be used as separators for
1557 readability.
1558</p>
1559</li>
1560<li>
1561<p>
1562Lines starting with a hash ("<code>#</code>") are ignored, so they can be used
1563 for comments. Add a backslash ("<code>\</code>") to the beginning of the
1564 pattern if it starts with a hash.
1565</p>
1566</li>
1567<li>
1568<p>
1569Each other line contains a single pattern.
1570</p>
1571</li>
1572</ul></div>
1573</div></div>
1574<div class="paragraph"><p>Patterns have the same syntax and semantics as patterns used for
1575fnmantch(3) without the FNM_PATHNAME flag, except a pathname also
1576matches a pattern if removing any number of the final pathname
1577components matches the pattern. For example, the pattern "<code>foo*bar</code>"
1578matches "<code>fooasdfbar</code>" and "<code>foo/bar/baz/asdf</code>" but not "<code>foobarx</code>".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231579</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591580<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231581-R
1582</dt>
1583<dd>
1584<p>
1585 Swap two inputs; that is, show differences from index or
1586 on-disk file to tree contents.
1587</p>
1588</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591589<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441590--relative[=&lt;path&gt;]
1591</dt>
1592<dd>
1593<p>
1594 When run from a subdirectory of the project, it can be
1595 told to exclude changes outside the directory and show
1596 pathnames relative to it with this option. When you are
1597 not in a subdirectory (e.g. in a bare repository), you
1598 can name which subdirectory to make the output relative
1599 to by giving a &lt;path&gt; as an argument.
1600</p>
1601</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591602<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221603-a
1604</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591605<dt class="hdlist1">
Junio C Hamanoc26f5482006-07-09 09:38:141606--text
1607</dt>
1608<dd>
1609<p>
1610 Treat all files as text.
1611</p>
1612</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591613<dt class="hdlist1">
Junio C Hamanofd468962007-02-14 23:45:041614--ignore-space-at-eol
1615</dt>
1616<dd>
1617<p>
Junio C Hamano3a702342007-12-12 21:34:021618 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:041619</p>
1620</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591621<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221622-b
1623</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591624<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071625--ignore-space-change
1626</dt>
1627<dd>
1628<p>
Junio C Hamano3a702342007-12-12 21:34:021629 Ignore changes in amount of whitespace. This ignores whitespace
1630 at line end, and considers all other sequences of one or
1631 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:071632</p>
1633</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591634<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221635-w
Junio C Hamanod9c2d2f2006-12-06 08:59:071636</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591637<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071638--ignore-all-space
1639</dt>
1640<dd>
1641<p>
Junio C Hamano3a702342007-12-12 21:34:021642 Ignore whitespace when comparing lines. This ignores
1643 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:071644 line has none.
1645</p>
1646</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591647<dt class="hdlist1">
Junio C Hamanoa1952302013-07-01 21:31:181648--ignore-blank-lines
1649</dt>
1650<dd>
1651<p>
1652 Ignore changes whose lines are all blank.
1653</p>
1654</dd>
1655<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161656--inter-hunk-context=&lt;lines&gt;
1657</dt>
1658<dd>
1659<p>
1660 Show the context between diff hunks, up to the specified number
1661 of lines, thereby fusing hunks that are close to each other.
Junio C Hamanobcd98f42017-01-24 00:12:161662 Defaults to <code>diff.interHunkContext</code> or 0 if the config option
1663 is unset.
Junio C Hamano1d40ee82009-01-07 10:14:161664</p>
1665</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591666<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091667-W
1668</dt>
1669<dt class="hdlist1">
1670--function-context
1671</dt>
1672<dd>
1673<p>
1674 Show whole surrounding functions of changes.
1675</p>
1676</dd>
1677<dt class="hdlist1">
Junio C Hamano48fd2f62007-03-19 02:02:301678--exit-code
1679</dt>
1680<dd>
1681<p>
1682 Make the program exit with codes similar to diff(1).
1683 That is, it exits with 1 if there were differences and
1684 0 means no differences.
1685</p>
1686</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591687<dt class="hdlist1">
Junio C Hamano35e57552007-03-25 07:54:351688--quiet
1689</dt>
1690<dd>
1691<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531692 Disable all output of the program. Implies <code>--exit-code</code>.
Junio C Hamano35e57552007-03-25 07:54:351693</p>
1694</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591695<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401696--ext-diff
1697</dt>
1698<dd>
1699<p>
1700 Allow an external diff helper to be executed. If you set an
Junio C Hamanoa28a9202012-06-21 07:08:231701 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1702 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401703</p>
1704</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591705<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401706--no-ext-diff
1707</dt>
1708<dd>
1709<p>
1710 Disallow external diff drivers.
1711</p>
1712</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591713<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311714--textconv
1715</dt>
1716<dt class="hdlist1">
1717--no-textconv
1718</dt>
1719<dd>
1720<p>
1721 Allow (or disallow) external text conversion filters to be run
Junio C Hamanoa28a9202012-06-21 07:08:231722 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
Junio C Hamanoc652aed2011-07-07 01:14:311723 details. Because textconv filters are typically a one-way
1724 conversion, the resulting diff is suitable for human
1725 consumption, but cannot be applied. For this reason, textconv
Junio C Hamanoa28a9202012-06-21 07:08:231726 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1727 <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:311728 diff plumbing commands.
1729</p>
1730</dd>
1731<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511732--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141733</dt>
1734<dd>
1735<p>
Junio C Hamano7d449522010-07-01 00:08:511736 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamanoc7102962013-05-29 23:57:171737 either "none", "untracked", "dirty" or "all", which is the default.
Junio C Hamano619596a2010-08-18 22:15:351738 Using "none" will consider the submodule modified when it either contains
1739 untracked or modified files or its HEAD differs from the commit recorded
1740 in the superproject and can be used to override any settings of the
Junio C Hamanoa28a9202012-06-21 07:08:231741 <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:511742 "untracked" is used submodules are not considered dirty when they only
1743 contain untracked content (but they are still scanned for modified
1744 content). Using "dirty" ignores all changes to the work tree of submodules,
1745 only changes to the commits stored in the superproject are shown (this was
1746 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141747</p>
1748</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591749<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331750--src-prefix=&lt;prefix&gt;
1751</dt>
1752<dd>
1753<p>
1754 Show the given source prefix instead of "a/".
1755</p>
1756</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591757<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331758--dst-prefix=&lt;prefix&gt;
1759</dt>
1760<dd>
1761<p>
1762 Show the given destination prefix instead of "b/".
1763</p>
1764</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591765<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331766--no-prefix
1767</dt>
1768<dd>
1769<p>
1770 Do not show any source or destination prefix.
1771</p>
1772</dd>
Junio C Hamanocd451662016-09-13 00:54:091773<dt class="hdlist1">
1774--line-prefix=&lt;prefix&gt;
1775</dt>
1776<dd>
1777<p>
1778 Prepend an additional prefix to every line of output.
1779</p>
1780</dd>
Junio C Hamanof7017f12016-10-27 23:31:341781<dt class="hdlist1">
1782--ita-invisible-in-index
1783</dt>
1784<dd>
1785<p>
1786 By default entries added by "git add -N" appear as an existing
1787 empty file in "git diff" and a new file in "git diff --cached".
1788 This option makes the entry appear as a new file in "git diff"
1789 and non-existent in "git diff --cached". This option could be
1790 reverted with <code>--ita-visible-in-index</code>. Both options are
1791 experimental and could be removed in future.
1792</p>
1793</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311794</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591795<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoa28a9202012-06-21 07:08:231796<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591797<div class="dlist"><dl>
1798<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231799&lt;tree-ish&gt;
1800</dt>
1801<dd>
1802<p>
1803 The id of a tree object to diff against.
1804</p>
1805</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591806<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231807--cached
1808</dt>
1809<dd>
1810<p>
1811 do not consider the on-disk file at all
1812</p>
1813</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591814<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231815-m
1816</dt>
1817<dd>
1818<p>
1819 By default, files recorded in the index but not checked
1820 out are reported as deleted. This flag makes
Junio C Hamano1aa40d22010-01-21 17:46:431821 <em>git diff-index</em> say that all non-checked-out files are up
Junio C Hamano1a4e8412005-12-27 08:17:231822 to date.
1823</p>
1824</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311825</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231826</div>
Junio C Hamano9629d4f2012-12-19 00:28:271827</div>
1828<div class="sect1">
Junio C Hamano543f8d62009-07-29 08:35:211829<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231830<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591831<div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:311832"git-diff-files" and "git diff --raw" are very similar.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591833<div class="paragraph"><p>These commands all compare two sets of things; what is
Junio C Hamanoba4b9282008-07-06 05:20:311834compared differs:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591835<div class="dlist"><dl>
1836<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231837git-diff-index &lt;tree-ish&gt;
1838</dt>
1839<dd>
1840<p>
1841 compares the &lt;tree-ish&gt; and the files on the filesystem.
1842</p>
1843</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591844<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231845git-diff-index --cached &lt;tree-ish&gt;
1846</dt>
1847<dd>
1848<p>
1849 compares the &lt;tree-ish&gt; and the index.
1850</p>
1851</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591852<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231853git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1854</dt>
1855<dd>
1856<p>
1857 compares the trees named by the two arguments.
1858</p>
1859</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591860<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231861git-diff-files [&lt;pattern&gt;&#8230;]
1862</dt>
1863<dd>
1864<p>
1865 compares the index and the files on the filesystem.
1866</p>
1867</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311868</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591869<div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
Junio C Hamano543f8d62009-07-29 08:35:211870what is being compared. After that, all the commands print one output
1871line per changed file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591872<div class="paragraph"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231873<div class="listingblock">
1874<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531875<pre><code>in-place edit :100644 100644 bcd1234... 0123456... M file0
Junio C Hamano1a4e8412005-12-27 08:17:231876copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1877rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1878create :000000 100644 0000000... 1234567... A file4
1879delete :100644 000000 1234567... 0000000... D file5
Junio C Hamanoc14e6ad2014-10-31 20:25:531880unmerged :000000 000000 0000000... 0000000... U file6</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231881</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591882<div class="paragraph"><p>That is, from the left to the right:</p></div>
1883<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231884<li>
1885<p>
1886a colon.
1887</p>
1888</li>
1889<li>
1890<p>
1891mode for "src"; 000000 if creation or unmerged.
1892</p>
1893</li>
1894<li>
1895<p>
1896a space.
1897</p>
1898</li>
1899<li>
1900<p>
1901mode for "dst"; 000000 if deletion or unmerged.
1902</p>
1903</li>
1904<li>
1905<p>
1906a space.
1907</p>
1908</li>
1909<li>
1910<p>
1911sha1 for "src"; 0{40} if creation or unmerged.
1912</p>
1913</li>
1914<li>
1915<p>
1916a space.
1917</p>
1918</li>
1919<li>
1920<p>
1921sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1922</p>
1923</li>
1924<li>
1925<p>
1926a space.
1927</p>
1928</li>
1929<li>
1930<p>
1931status, followed by optional "score" number.
1932</p>
1933</li>
1934<li>
1935<p>
Junio C Hamano92d80372016-07-13 22:00:051936a tab or a NUL when <code>-z</code> option is used.
Junio C Hamano1a4e8412005-12-27 08:17:231937</p>
1938</li>
1939<li>
1940<p>
1941path for "src"
1942</p>
1943</li>
1944<li>
1945<p>
Junio C Hamano92d80372016-07-13 22:00:051946a tab or a NUL when <code>-z</code> option is used; only exists for C or R.
Junio C Hamano1a4e8412005-12-27 08:17:231947</p>
1948</li>
1949<li>
1950<p>
1951path for "dst"; only exists for C or R.
1952</p>
1953</li>
1954<li>
1955<p>
Junio C Hamano92d80372016-07-13 22:00:051956an LF or a NUL when <code>-z</code> option is used, to terminate the record.
Junio C Hamano1a4e8412005-12-27 08:17:231957</p>
1958</li>
Junio C Hamanoba4b9282008-07-06 05:20:311959</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591960<div class="paragraph"><p>Possible status letters are:</p></div>
1961<div class="ulist"><ul>
Junio C Hamanoaa17c7c2008-11-03 04:36:581962<li>
1963<p>
1964A: addition of a file
1965</p>
1966</li>
1967<li>
1968<p>
1969C: copy of a file into a new one
1970</p>
1971</li>
1972<li>
1973<p>
1974D: deletion of a file
1975</p>
1976</li>
1977<li>
1978<p>
1979M: modification of the contents or mode of a file
1980</p>
1981</li>
1982<li>
1983<p>
1984R: renaming of a file
1985</p>
1986</li>
1987<li>
1988<p>
1989T: change in the type of the file
1990</p>
1991</li>
1992<li>
1993<p>
1994U: file is unmerged (you must complete the merge before it can
1995be committed)
1996</p>
1997</li>
1998<li>
1999<p>
2000X: "unknown" change type (most probably a bug, please report it)
2001</p>
2002</li>
2003</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:592004<div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:582005percentage of similarity between the source and target of the move or
Junio C Hamano6bb32e62015-02-17 22:11:262006copy). Status letter M may be followed by a score (denoting the
2007percentage of dissimilarity) for file rewrites.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592008<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:312009and it is out of sync with the index.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592010<div class="paragraph"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232011<div class="listingblock">
2012<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532013<pre><code>:100644 100644 5be4a4...... 000000...... M file.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232014</div></div>
Junio C Hamano0f6f3bf2017-03-13 07:01:532015<div class="paragraph"><p>Without the <code>-z</code> option, pathnames with "unusual" characters are
2016quoted as explained for the configuration variable <code>core.quotePath</code>
2017(see <a href="git-config.html">git-config(1)</a>). Using <code>-z</code> the filename is output
2018verbatim and the line is terminated by a NUL byte.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232019</div>
Junio C Hamano9629d4f2012-12-19 00:28:272020</div>
2021<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312022<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:122023<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592024<div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano92d80372016-07-13 22:00:052025can take <code>-c</code> or <code>--cc</code> option
Junio C Hamano67fad6d2007-05-06 08:53:122026to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:312027from the format described above in the following way:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592028<div class="olist arabic"><ol class="arabic">
Junio C Hamano67fad6d2007-05-06 08:53:122029<li>
2030<p>
2031there is a colon for each parent
2032</p>
2033</li>
2034<li>
2035<p>
2036there are more "src" modes and "src" sha1
2037</p>
2038</li>
2039<li>
2040<p>
2041status is concatenated status characters for each parent
2042</p>
2043</li>
2044<li>
2045<p>
2046no optional "score" number
2047</p>
2048</li>
2049<li>
2050<p>
2051single path, only for "dst"
2052</p>
2053</li>
Junio C Hamanoba4b9282008-07-06 05:20:312054</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592055<div class="paragraph"><p>Example:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:122056<div class="listingblock">
2057<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532058<pre><code>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</code></pre>
Junio C Hamano67fad6d2007-05-06 08:53:122059</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592060<div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
Junio C Hamanoba4b9282008-07-06 05:20:312061all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:122062</div>
Junio C Hamano9629d4f2012-12-19 00:28:272063</div>
2064<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312065<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232066<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592067<div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano92d80372016-07-13 22:00:052068with a <code>-p</code> option, "git diff" without the <code>--raw</code> option, or
Junio C Hamano00b8b632007-12-07 09:50:492069"git log" with the "-p" option, they
Junio C Hamano7ae0ab22007-11-03 02:46:462070do not produce the output described above; instead they produce a
2071patch file. You can customize the creation of such patches via the
Junio C Hamano042f2142016-06-27 18:05:052072<code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592073<div class="paragraph"><p>What the -p option produces is slightly different from the traditional
Junio C Hamano7f9fa862010-10-19 23:51:142074diff format:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592075<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:232076<li>
2077<p>
Junio C Hamano7f9fa862010-10-19 23:51:142078It is preceded with a "git diff" header that looks like this:
Junio C Hamano1a4e8412005-12-27 08:17:232079</p>
2080<div class="literalblock">
2081<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532082<pre><code>diff --git a/file1 b/file2</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232083</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532084<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:232085involved. Especially, even for a creation or a deletion,
Junio C Hamanoc14e6ad2014-10-31 20:25:532086<code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div>
2087<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:232088name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:312089the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232090</li>
2091<li>
2092<p>
2093It is followed by one or more extended header lines:
2094</p>
2095<div class="literalblock">
2096<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532097<pre><code>old mode &lt;mode&gt;
Junio C Hamano1a4e8412005-12-27 08:17:232098new mode &lt;mode&gt;
2099deleted file mode &lt;mode&gt;
2100new file mode &lt;mode&gt;
2101copy from &lt;path&gt;
2102copy to &lt;path&gt;
2103rename from &lt;path&gt;
2104rename to &lt;path&gt;
2105similarity index &lt;number&gt;
2106dissimilarity index &lt;number&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532107index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232108</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592109<div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
Junio C Hamano7f9fa862010-10-19 23:51:142110and file permission bits.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532111<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:592112<div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano7f9fa862010-10-19 23:51:142113the dissimilarity index is the percentage of changed lines. It
2114is a rounded down integer, followed by a percent sign. The
2115similarity index value of 100% is thus reserved for two equal
2116files, while 100% dissimilarity means that no line from the old
2117file made it into the new one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592118<div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
Junio C Hamano7f9fa862010-10-19 23:51:142119The &lt;mode&gt; is included if the file mode does not change; otherwise,
2120separate lines indicate the old and the new mode.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232121</li>
2122<li>
2123<p>
Junio C Hamano0f6f3bf2017-03-13 07:01:532124Pathnames with "unusual" characters are quoted as explained for
2125 the configuration variable <code>core.quotePath</code> (see
2126 <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1a4e8412005-12-27 08:17:232127</p>
2128</li>
Junio C Hamano7f9fa862010-10-19 23:51:142129<li>
2130<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:532131All the <code>file1</code> files in the output refer to files before the
2132 commit, and all the <code>file2</code> files refer to files after the commit.
Junio C Hamano7f9fa862010-10-19 23:51:142133 It is incorrect to apply each change to each file sequentially. For
2134 example, this patch will swap a and b:
2135</p>
2136<div class="literalblock">
2137<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532138<pre><code>diff --git a/a b/b
Junio C Hamano7f9fa862010-10-19 23:51:142139rename from a
2140rename to b
2141diff --git a/b b/a
2142rename from b
Junio C Hamanoc14e6ad2014-10-31 20:25:532143rename to a</code></pre>
Junio C Hamano7f9fa862010-10-19 23:51:142144</div></div>
2145</li>
Junio C Hamanoba4b9282008-07-06 05:20:312146</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:232147</div>
Junio C Hamano9629d4f2012-12-19 00:28:272148</div>
2149<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312150<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:192151<div class="sectionbody">
Junio C Hamano1dbca522015-05-22 20:48:552152<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:432153produce a <em>combined diff</em> when showing a merge. This is the default
Junio C Hamanoa28a9202012-06-21 07:08:232154format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
Junio C Hamano1dbca522015-05-22 20:48:552155<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:432156of these commands to force generation of diffs with individual parents
2157of a merge.</p></div>
2158<div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192159<div class="listingblock">
2160<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532161<pre><code>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:292162index fabadb8,cc95eb0..4866510
2163--- a/describe.c
2164+++ b/describe.c
2165@@@ -98,20 -98,12 +98,20 @@@
2166 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:192167 }
2168
2169- static void describe(char *arg)
2170 -static void describe(struct commit *cmit, int last_one)
2171++static void describe(char *arg, int last_one)
2172 {
Junio C Hamano29f14312006-10-26 08:47:292173 + unsigned char sha1[20];
2174 + struct commit *cmit;
2175 struct commit_list *list;
2176 static int initialized = 0;
2177 struct commit_name *n;
2178
2179 + if (get_sha1(arg, sha1) &lt; 0)
2180 + usage(describe_usage);
2181 + cmit = lookup_commit_reference(sha1);
2182 + if (!cmit)
2183 + usage(describe_usage);
2184 +
2185 if (!initialized) {
2186 initialized = 1;
Junio C Hamanoc14e6ad2014-10-31 20:25:532187 for_each_ref(get_name);</code></pre>
Junio C Hamanofb56a962006-01-28 10:38:192188</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592189<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:292190<li>
2191<p>
2192It is preceded with a "git diff" header, that looks like
Junio C Hamano92d80372016-07-13 22:00:052193 this (when <code>-c</code> option is used):
Junio C Hamano29f14312006-10-26 08:47:292194</p>
2195<div class="literalblock">
2196<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532197<pre><code>diff --combined file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292198</div></div>
Junio C Hamano92d80372016-07-13 22:00:052199<div class="paragraph"><p>or like this (when <code>--cc</code> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:292200<div class="literalblock">
2201<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532202<pre><code>diff --cc file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292203</div></div>
2204</li>
2205<li>
2206<p>
2207It is followed by one or more extended header lines
2208 (this example shows a merge with two parents):
2209</p>
2210<div class="literalblock">
2211<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532212<pre><code>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
Junio C Hamano29f14312006-10-26 08:47:292213mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2214new file mode &lt;mode&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532215deleted file mode &lt;mode&gt;,&lt;mode&gt;</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292216</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532217<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:042218the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:292219information about detected contents movement (renames and
2220copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:312221&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292222</li>
2223<li>
2224<p>
2225It is followed by two-line from-file/to-file header
2226</p>
2227<div class="literalblock">
2228<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532229<pre><code>--- a/file
2230+++ b/file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292231</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592232<div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamanoc14e6ad2014-10-31 20:25:532233format, <code>/dev/null</code> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:312234files.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292235</li>
2236<li>
2237<p>
2238Chunk header format is modified to prevent people from
Junio C Hamanoc14e6ad2014-10-31 20:25:532239 accidentally feeding it to <code>patch -p1</code>. Combined diff format
Junio C Hamano29f14312006-10-26 08:47:292240 was created for review of merge commit changes, and was not
2241 meant for apply. The change is similar to the change in the
2242 extended <em>index</em> header:
2243</p>
2244<div class="literalblock">
2245<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532246<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:292247</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532248<div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk
Junio C Hamanoba4b9282008-07-06 05:20:312249header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292250</li>
Junio C Hamanoba4b9282008-07-06 05:20:312251</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592252<div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
Junio C Hamanoc14e6ad2014-10-31 20:25:532253files 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
2254added to B), or <code>" "</code> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:192255compares two or more files file1, file2,&#8230; with one file X, and
2256shows how X differs from each of fileN. One column for each of
Junio C Hamano68cf15a2010-11-06 01:01:592257fileN is prepended to the output line to note how X&#8217;s line is
Junio C Hamanoba4b9282008-07-06 05:20:312258different from it.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532259<div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in
2260fileN but it does not appear in the result. A <code>+</code> character
Junio C Hamano54bf1e22008-12-20 06:30:112261in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:292262and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:312263added, from the point of view of that parent).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592264<div class="paragraph"><p>In the above example output, the function signature was changed
Junio C Hamanoc14e6ad2014-10-31 20:25:532265from both files (hence two <code>-</code> removals from both file1 and
2266file2, plus <code>++</code> to mean one line that was added does not appear
Junio C Hamanod75148a2014-04-08 19:48:382267in either file1 or file2). Also eight other lines are the same
Junio C Hamanoc14e6ad2014-10-31 20:25:532268from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div>
2269<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:192270merge commit with the merge result (i.e. file1..fileN are the
Junio C Hamanoc14e6ad2014-10-31 20:25:532271parents). When shown by <code>git diff-files -c</code>, it compares the
Junio C Hamanofb56a962006-01-28 10:38:192272two unresolved merge parents with the working tree file
2273(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:312274"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192275</div>
Junio C Hamano9629d4f2012-12-19 00:28:272276</div>
2277<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312278<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:022279<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:532280<div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and
2281copied files. The <code>--stat</code> option adds diffstat(1) graph to the
Junio C Hamano3a702342007-12-12 21:34:022282output. These options can be combined with other options, such as
Junio C Hamanoc14e6ad2014-10-31 20:25:532283<code>-p</code>, and are meant for human consumption.</p></div>
2284<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:022285formats the pathnames compactly by combining common prefix and suffix of
Junio C Hamanoc14e6ad2014-10-31 20:25:532286the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to
2287<code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022288<div class="listingblock">
2289<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532290<pre><code>arch/{i386 =&gt; x86}/Makefile | 4 +--</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022291</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532292<div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed
2293for easier machine consumption. An entry in <code>--numstat</code> output looks
Junio C Hamanoba4b9282008-07-06 05:20:312294like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022295<div class="listingblock">
2296<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532297<pre><code>1 2 README
22983 1 arch/{i386 =&gt; x86}/Makefile</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022299</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592300<div class="paragraph"><p>That is, from left to right:</p></div>
2301<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022302<li>
2303<p>
2304the number of added lines;
2305</p>
2306</li>
2307<li>
2308<p>
2309a tab;
2310</p>
2311</li>
2312<li>
2313<p>
2314the number of deleted lines;
2315</p>
2316</li>
2317<li>
2318<p>
2319a tab;
2320</p>
2321</li>
2322<li>
2323<p>
2324pathname (possibly with rename/copy information);
2325</p>
2326</li>
2327<li>
2328<p>
2329a newline.
2330</p>
2331</li>
Junio C Hamanoba4b9282008-07-06 05:20:312332</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532333<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:022334<div class="listingblock">
2335<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532336<pre><code>1 2 README NUL
23373 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022338</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592339<div class="paragraph"><p>That is:</p></div>
2340<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022341<li>
2342<p>
2343the number of added lines;
2344</p>
2345</li>
2346<li>
2347<p>
2348a tab;
2349</p>
2350</li>
2351<li>
2352<p>
2353the number of deleted lines;
2354</p>
2355</li>
2356<li>
2357<p>
2358a tab;
2359</p>
2360</li>
2361<li>
2362<p>
2363a NUL (only exists if renamed/copied);
2364</p>
2365</li>
2366<li>
2367<p>
2368pathname in preimage;
2369</p>
2370</li>
2371<li>
2372<p>
2373a NUL (only exists if renamed/copied);
2374</p>
2375</li>
2376<li>
2377<p>
2378pathname in postimage (only exists if renamed/copied);
2379</p>
2380</li>
2381<li>
2382<p>
2383a NUL.
2384</p>
2385</li>
Junio C Hamanoba4b9282008-07-06 05:20:312386</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532387<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:022388scripts that read the output to tell if the current record being read is
2389a single-path record or a rename/copy record without reading ahead.
Junio C Hamanoc14e6ad2014-10-31 20:25:532390After reading added and deleted lines, reading up to <code>NUL</code> would yield
2391the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:022392</div>
Junio C Hamano9629d4f2012-12-19 00:28:272393</div>
2394<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312395<h2 id="_operating_modes">Operating Modes</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232396<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592397<div class="paragraph"><p>You can choose whether you want to trust the index file entirely
Junio C Hamano92d80372016-07-13 22:00:052398(using the <code>--cached</code> flag) or ask the diff logic to show any files
Junio C Hamano68cf15a2010-11-06 01:01:592399that don&#8217;t match the stat state as being "tentatively changed". Both
Junio C Hamanoba4b9282008-07-06 05:20:312400of these operations are very useful indeed.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232401</div>
Junio C Hamano9629d4f2012-12-19 00:28:272402</div>
2403<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312404<h2 id="_cached_mode">Cached Mode</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232405<div class="sectionbody">
Junio C Hamano92d80372016-07-13 22:00:052406<div class="paragraph"><p>If <code>--cached</code> is specified, it allows you to ask:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232407<div class="literalblock">
2408<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532409<pre><code>show me the differences between HEAD and the current index
2410contents (the ones I'd write using 'git write-tree')</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232411</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592412<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:582413some files in the index and are ready to commit. You want to see exactly
Junio C Hamanodcc22ee2006-11-03 02:40:132414<strong>what</strong> you are going to commit, without having to write a new tree
Junio C Hamanoba4b9282008-07-06 05:20:312415object and compare it that way, and to do that, you just do</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232416<div class="literalblock">
2417<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532418<pre><code>git diff-index --cached HEAD</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232419</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532420<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
2421done an <code>update-index</code> to make that effective in the index file.
2422<code>git diff-files</code> wouldn&#8217;t show anything at all, since the index file
Junio C Hamano1aa40d22010-01-21 17:46:432423matches my working directory. But doing a <em>git diff-index</em> does:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232424<div class="literalblock">
2425<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532426<pre><code>torvalds@ppc970:~/git&gt; git diff-index --cached HEAD
Junio C Hamano1a4e8412005-12-27 08:17:232427-100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c
Junio C Hamanoc14e6ad2014-10-31 20:25:532428+100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232429</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592430<div class="paragraph"><p>You can see easily that the above is a rename.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532431<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:432432actually doing a <em>git write-tree</em> and comparing that. Except this one is much
Junio C Hamanoba4b9282008-07-06 05:20:312433nicer for the case where you just want to check where you are.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532434<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:232435asking yourself "what have I already marked for being committed, and
Junio C Hamano68cf15a2010-11-06 01:01:592436what&#8217;s the difference to a previous tree".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232437</div>
Junio C Hamano9629d4f2012-12-19 00:28:272438</div>
2439<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312440<h2 id="_non_cached_mode">Non-cached Mode</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232441<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592442<div class="paragraph"><p>The "non-cached" mode takes a different approach, and is potentially
2443the more useful of the two in that what it does can&#8217;t be emulated with
2444a <em>git write-tree</em> + <em>git diff-tree</em>. Thus that&#8217;s the default mode.
Junio C Hamanoba4b9282008-07-06 05:20:312445The non-cached version asks the question:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232446<div class="literalblock">
2447<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532448<pre><code>show me the differences between HEAD and the currently checked out
Junio C Hamano88bf5712017-09-10 08:39:232449tree - index contents _and_ files that aren't up to date</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232450</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592451<div class="paragraph"><p>which is obviously a very useful question too, since that tells you what
Junio C Hamano1aa40d22010-01-21 17:46:432452you <strong>could</strong> commit. Again, the output matches the <em>git diff-tree -r</em>
Junio C Hamanoba4b9282008-07-06 05:20:312453output to a tee, but with a twist.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592454<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:232455a backing store thing for it, and we use the magic "all-zero" sha1 to
Junio C Hamanoc14e6ad2014-10-31 20:25:532456show that. So let&#8217;s say that you have edited <code>kernel/sched.c</code>, but
Junio C Hamano1aa40d22010-01-21 17:46:432457have not actually done a <em>git update-index</em> on it yet - there is no
Junio C Hamanoba4b9282008-07-06 05:20:312458"object" associated with the new state, and you get:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232459<div class="literalblock">
2460<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532461<pre><code>torvalds@ppc970:~/v2.6/linux&gt; git diff-index --abbrev HEAD
2462:100644 100664 7476bb... 000000... kernel/sched.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232463</div></div>
Junio C Hamano88bf5712017-09-10 08:39:232464<div class="paragraph"><p>i.e., it shows that the tree has changed, and that <code>kernel/sched.c</code> is
2465not up to date and may contain new stuff. The all-zero sha1 means that to
Junio C Hamano1a4e8412005-12-27 08:17:232466get the real diff, you need to look at the object in the working directory
Junio C Hamanoba4b9282008-07-06 05:20:312467directly rather than do an object-to-object diff.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232468<div class="admonitionblock">
2469<table><tr>
2470<td class="icon">
2471<div class="title">Note</div>
2472</td>
Junio C Hamano1aa40d22010-01-21 17:46:432473<td class="content">As with other commands of this type, <em>git diff-index</em> does not
Junio C Hamano1a4e8412005-12-27 08:17:232474actually look at the contents of the file at all. So maybe
Junio C Hamanoc14e6ad2014-10-31 20:25:532475<code>kernel/sched.c</code> hasn&#8217;t actually changed, and it&#8217;s just that you
Junio C Hamano68cf15a2010-11-06 01:01:592476touched it. In either case, it&#8217;s a note that you need to
Junio C Hamano1aa40d22010-01-21 17:46:432477<em>git update-index</em> it to make the index be in sync.</td>
Junio C Hamano1a4e8412005-12-27 08:17:232478</tr></table>
2479</div>
2480<div class="admonitionblock">
2481<table><tr>
2482<td class="icon">
2483<div class="title">Note</div>
2484</td>
2485<td class="content">You can have a mixture of files show up as "has been updated"
2486and "is still dirty in the working directory" together. You can always
2487tell which file is in which state, since the "has been updated" ones
2488show a valid sha1, and the "not in sync with the index" ones will
2489always have the special all-zero sha1.</td>
2490</tr></table>
2491</div>
2492</div>
Junio C Hamano9629d4f2012-12-19 00:28:272493</div>
2494<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312495<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232496<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:232497<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232498</div>
Junio C Hamano7bd050f2011-09-22 06:32:222499</div>
Junio C Hamano9629d4f2012-12-19 00:28:272500</div>
Junio C Hamano7bd050f2011-09-22 06:32:222501<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:232502<div id="footer">
2503<div id="footer-text">
Junio C Hamano88bf5712017-09-10 08:39:232504Last updated 2017-09-10 17:38:46 JST
Junio C Hamano1a4e8412005-12-27 08:17:232505</div>
2506</div>
2507</body>
2508</html>