blob: 8837587dcb05d0d302a60c3a63a1f205a24316c5 [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 Hamano5f888332016-06-13 19:28:31827--compaction-heuristic
828</dt>
829<dt class="hdlist1">
830--no-compaction-heuristic
831</dt>
832<dd>
833<p>
834 These are to help debugging and tuning an experimental
835 heuristic (which is off by default) that shifts the hunk
836 boundary in an attempt to make the resulting patch easier
837 to read.
838</p>
839</dd>
840<dt class="hdlist1">
Junio C Hamano5a73f302011-10-14 05:58:34841--minimal
842</dt>
843<dd>
844<p>
845 Spend extra time to make sure the smallest possible
846 diff is produced.
847</p>
848</dd>
849<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02850--patience
851</dt>
852<dd>
853<p>
854 Generate a diff using the "patience diff" algorithm.
855</p>
856</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59857<dt class="hdlist1">
Junio C Hamanoaea9e6b2012-03-07 00:17:11858--histogram
859</dt>
860<dd>
861<p>
862 Generate a diff using the "histogram diff" algorithm.
863</p>
864</dd>
865<dt class="hdlist1">
Junio C Hamano80ad00d2013-02-18 00:19:03866--diff-algorithm={patience|minimal|histogram|myers}
867</dt>
868<dd>
869<p>
870 Choose a diff algorithm. The variants are as follows:
871</p>
872<div class="openblock">
873<div class="content">
874<div class="dlist"><dl>
875<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53876<code>default</code>, <code>myers</code>
Junio C Hamano80ad00d2013-02-18 00:19:03877</dt>
878<dd>
879<p>
880 The basic greedy diff algorithm. Currently, this is the default.
881</p>
882</dd>
883<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53884<code>minimal</code>
Junio C Hamano80ad00d2013-02-18 00:19:03885</dt>
886<dd>
887<p>
888 Spend extra time to make sure the smallest possible diff is
889 produced.
890</p>
891</dd>
892<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53893<code>patience</code>
Junio C Hamano80ad00d2013-02-18 00:19:03894</dt>
895<dd>
896<p>
897 Use "patience diff" algorithm when generating patches.
898</p>
899</dd>
900<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53901<code>histogram</code>
Junio C Hamano80ad00d2013-02-18 00:19:03902</dt>
903<dd>
904<p>
905 This algorithm extends the patience algorithm to "support
906 low-occurrence common elements".
907</p>
908</dd>
909</dl></div>
910</div></div>
911<div class="paragraph"><p>For instance, if you configured diff.algorithm variable to a
912non-default value and want to use the default one, then you
Junio C Hamanoc14e6ad2014-10-31 20:25:53913have to use <code>--diff-algorithm=default</code> option.</p></div>
Junio C Hamano80ad00d2013-02-18 00:19:03914</dd>
915<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32916--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamanoba7c8d82006-04-15 06:17:42917</dt>
918<dd>
919<p>
Junio C Hamanoaea9e6b2012-03-07 00:17:11920 Generate a diffstat. By default, as much space as necessary
921 will be used for the filename part, and the rest for the graph
922 part. Maximum width defaults to terminal width, or 80 columns
Junio C Hamano7f2b3cb2012-06-22 22:42:39923 if not connected to a terminal, and can be overridden by
Junio C Hamanoc14e6ad2014-10-31 20:25:53924 <code>&lt;width&gt;</code>. The width of the filename part can be limited by
925 giving another width <code>&lt;name-width&gt;</code> after a comma. The width
Junio C Hamanoaea9e6b2012-03-07 00:17:11926 of the graph part can be limited by using
Junio C Hamanoc14e6ad2014-10-31 20:25:53927 <code>--stat-graph-width=&lt;width&gt;</code> (affects all commands generating
928 a stat graph) or by setting <code>diff.statGraphWidth=&lt;width&gt;</code>
929 (does not affect <code>git format-patch</code>).
930 By giving a third parameter <code>&lt;count&gt;</code>, you can limit the
931 output to the first <code>&lt;count&gt;</code> lines, followed by <code>...</code> if
Junio C Hamanoaea9e6b2012-03-07 00:17:11932 there are more.
Junio C Hamanoba7c8d82006-04-15 06:17:42933</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53934<div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=&lt;width&gt;</code>,
935<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:42936</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59937<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48938--numstat
939</dt>
940<dd>
941<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53942 Similar to <code>--stat</code>, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:48943 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43944 abbreviation, to make it more machine friendly. For
Junio C Hamanoc14e6ad2014-10-31 20:25:53945 binary files, outputs two <code>-</code> instead of saying
946 <code>0 0</code>.
Junio C Hamanofbe00522006-10-19 05:58:48947</p>
948</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59949<dt class="hdlist1">
Junio C Hamano7d23f5e2006-12-16 07:44:04950--shortstat
951</dt>
952<dd>
953<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53954 Output only the last line of the <code>--stat</code> format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:04955 number of modified files, as well as number of added and deleted
956 lines.
957</p>
958</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59959<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32960--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03961</dt>
962<dd>
963<p>
Junio C Hamano1c222c52011-05-13 19:55:32964 Output the distribution of relative amount of changes for each
Junio C Hamanoc14e6ad2014-10-31 20:25:53965 sub-directory. The behavior of <code>--dirstat</code> can be customized by
Junio C Hamano1c222c52011-05-13 19:55:32966 passing it a comma separated list of parameters.
Junio C Hamanoc14e6ad2014-10-31 20:25:53967 The defaults are controlled by the <code>diff.dirstat</code> configuration
Junio C Hamanoa28a9202012-06-21 07:08:23968 variable (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1c222c52011-05-13 19:55:32969 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:03970</p>
Junio C Hamano9629d4f2012-12-19 00:28:27971<div class="openblock">
972<div class="content">
Junio C Hamano1c222c52011-05-13 19:55:32973<div class="dlist"><dl>
974<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53975<code>changes</code>
Junio C Hamano1c222c52011-05-13 19:55:32976</dt>
977<dd>
978<p>
979 Compute the dirstat numbers by counting the lines that have been
980 removed from the source, or added to the destination. This ignores
981 the amount of pure code movements within a file. In other words,
982 rearranging lines in a file is not counted as much as other changes.
983 This is the default behavior when no parameter is given.
984</p>
Junio C Hamano6a45be92008-04-22 08:19:03985</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59986<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53987<code>lines</code>
Junio C Hamanoa476efa2008-10-10 15:31:42988</dt>
989<dd>
990<p>
Junio C Hamano1c222c52011-05-13 19:55:32991 Compute the dirstat numbers by doing the regular line-based diff
992 analysis, and summing the removed/added line counts. (For binary
993 files, count 64-byte chunks instead, since binary files have no
Junio C Hamanoc14e6ad2014-10-31 20:25:53994 natural concept of lines). This is a more expensive <code>--dirstat</code>
995 behavior than the <code>changes</code> behavior, but it does count rearranged
Junio C Hamano1c222c52011-05-13 19:55:32996 lines within a file as much as other changes. The resulting output
Junio C Hamanoc14e6ad2014-10-31 20:25:53997 is consistent with what you get from the other <code>--*stat</code> options.
Junio C Hamanoa476efa2008-10-10 15:31:42998</p>
999</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591000<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531001<code>files</code>
Junio C Hamano1c222c52011-05-13 19:55:321002</dt>
1003<dd>
1004<p>
1005 Compute the dirstat numbers by counting the number of files changed.
1006 Each changed file counts equally in the dirstat analysis. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531007 the computationally cheapest <code>--dirstat</code> behavior, since it does
Junio C Hamano1c222c52011-05-13 19:55:321008 not have to look at the file contents at all.
1009</p>
1010</dd>
1011<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531012<code>cumulative</code>
Junio C Hamano1c222c52011-05-13 19:55:321013</dt>
1014<dd>
1015<p>
1016 Count changes in a child directory for the parent directory as well.
Junio C Hamanoc14e6ad2014-10-31 20:25:531017 Note that when using <code>cumulative</code>, the sum of the percentages
Junio C Hamano1c222c52011-05-13 19:55:321018 reported may exceed 100%. The default (non-cumulative) behavior can
Junio C Hamanoc14e6ad2014-10-31 20:25:531019 be specified with the <code>noncumulative</code> parameter.
Junio C Hamano1c222c52011-05-13 19:55:321020</p>
1021</dd>
1022<dt class="hdlist1">
1023&lt;limit&gt;
1024</dt>
1025<dd>
1026<p>
1027 An integer parameter specifies a cut-off percent (3% by default).
1028 Directories contributing less than this percentage of the changes
1029 are not shown in the output.
1030</p>
1031</dd>
1032</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271033</div></div>
Junio C Hamano1c222c52011-05-13 19:55:321034<div class="paragraph"><p>Example: The following will count changed files, while ignoring
1035directories with less than 10% of the total amount of changed files,
1036and accumulating child directory counts in the parent directories:
Junio C Hamanoc14e6ad2014-10-31 20:25:531037<code>--dirstat=files,10,cumulative</code>.</p></div>
Junio C Hamano1c222c52011-05-13 19:55:321038</dd>
1039<dt class="hdlist1">
Junio C Hamano6959c6c2006-05-17 10:34:111040--summary
1041</dt>
1042<dd>
1043<p>
1044 Output a condensed summary of extended header information
1045 such as creations, renames and mode changes.
1046</p>
1047</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591048<dt class="hdlist1">
Junio C Hamanod1308c92006-04-16 11:01:091049--patch-with-stat
1050</dt>
1051<dd>
1052<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531053 Synonym for <code>-p --stat</code>.
Junio C Hamanod1308c92006-04-16 11:01:091054</p>
1055</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591056<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231057-z
1058</dt>
1059<dd>
1060<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531061 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:341062 given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano1a4e8412005-12-27 08:17:231063</p>
Junio C Hamano68cf15a2010-11-06 01:01:591064<div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
Junio C Hamanoc14e6ad2014-10-31 20:25:531065and backslash characters replaced with <code>\t</code>, <code>\n</code>, <code>\"</code>, and <code>\\</code>,
Junio C Hamano5706e0b2009-11-24 10:54:161066respectively, and the pathname will be enclosed in double quotes if
1067any of those replacements occurred.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231068</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591069<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231070--name-only
1071</dt>
1072<dd>
1073<p>
1074 Show only names of changed files.
1075</p>
1076</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591077<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231078--name-status
1079</dt>
1080<dd>
1081<p>
Junio C Hamanoa9aee782008-04-23 16:09:201082 Show only names and status of changed files. See the description
Junio C Hamanoc14e6ad2014-10-31 20:25:531083 of the <code>--diff-filter</code> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:231084</p>
1085</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591086<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:551087--submodule[=&lt;format&gt;]
1088</dt>
1089<dd>
1090<p>
Junio C Hamanocd451662016-09-13 00:54:091091 Specify how differences in submodules are shown. When specifying
1092 <code>--submodule=short</code> the <em>short</em> format is used. This format just
1093 shows the names of the commits at the beginning and end of the range.
1094 When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em>
1095 format is used. This format lists the commits in the range like
1096 <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
1097 is specified, the <em>diff</em> format is used. This format shows an
1098 inline diff of the changes in the submodule contents between the
1099 commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format
1100 if the config option is unset.
Junio C Hamanoc21ab052009-10-31 04:03:551101</p>
1102</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591103<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:121104--color[=&lt;when&gt;]
Junio C Hamano9ae1a062006-07-10 08:12:341105</dt>
1106<dd>
1107<p>
1108 Show colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531109 <code>--color</code> (i.e. without <em>=&lt;when&gt;</em>) is the same as <code>--color=always</code>.
1110 <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:341111</p>
1112</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591113<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341114--no-color
1115</dt>
1116<dd>
1117<p>
Junio C Hamano5f2627d2011-05-06 20:23:481118 Turn off colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531119 It is the same as <code>--color=never</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341120</p>
1121</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591122<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531123--word-diff[=&lt;mode&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:411124</dt>
1125<dd>
1126<p>
Junio C Hamanocc7636a2010-05-21 14:57:531127 Show a word diff, using the &lt;mode&gt; to delimit changed words.
1128 By default, words are delimited by whitespace; see
Junio C Hamanoc14e6ad2014-10-31 20:25:531129 <code>--word-diff-regex</code> below. The &lt;mode&gt; defaults to <em>plain</em>, and
Junio C Hamanocc7636a2010-05-21 14:57:531130 must be one of:
Junio C Hamano85e45fa2006-08-13 07:47:411131</p>
Junio C Hamano9629d4f2012-12-19 00:28:271132<div class="openblock">
1133<div class="content">
Junio C Hamano68cf15a2010-11-06 01:01:591134<div class="dlist"><dl>
1135<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531136color
1137</dt>
1138<dd>
1139<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531140 Highlight changed words using only colors. Implies <code>--color</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531141</p>
1142</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591143<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531144plain
1145</dt>
1146<dd>
1147<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531148 Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no
Junio C Hamanocc7636a2010-05-21 14:57:531149 attempts to escape the delimiters if they appear in the input,
1150 so the output may be ambiguous.
1151</p>
1152</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591153<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531154porcelain
1155</dt>
1156<dd>
1157<p>
1158 Use a special line-based format intended for script
1159 consumption. Added/removed/unchanged runs are printed in the
Junio C Hamanoc14e6ad2014-10-31 20:25:531160 usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
Junio C Hamanocc7636a2010-05-21 14:57:531161 character at the beginning of the line and extending to the
1162 end of the line. Newlines in the input are represented by a
Junio C Hamanoc14e6ad2014-10-31 20:25:531163 tilde <code>~</code> on a line of its own.
Junio C Hamanocc7636a2010-05-21 14:57:531164</p>
1165</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591166<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531167none
1168</dt>
1169<dd>
1170<p>
1171 Disable word diff again.
1172</p>
1173</dd>
1174</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271175</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591176<div class="paragraph"><p>Note that despite the name of the first mode, color is used to
Junio C Hamanocc7636a2010-05-21 14:57:531177highlight the changed parts in all modes if enabled.</p></div>
1178</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591179<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531180--word-diff-regex=&lt;regex&gt;
1181</dt>
1182<dd>
1183<p>
1184 Use &lt;regex&gt; to decide what a word is, instead of considering
1185 runs of non-whitespace to be a word. Also implies
Junio C Hamanoc14e6ad2014-10-31 20:25:531186 <code>--word-diff</code> unless it was already enabled.
Junio C Hamanocc7636a2010-05-21 14:57:531187</p>
Junio C Hamano68cf15a2010-11-06 01:01:591188<div class="paragraph"><p>Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:021189&lt;regex&gt; is considered a word. Anything between these matches is
1190considered whitespace and ignored(!) for the purposes of finding
Junio C Hamanoc14e6ad2014-10-31 20:25:531191differences. You may want to append <code>|[^[:space:]]</code> to your regular
Junio C Hamano20d47e32009-01-26 06:36:021192expression to make sure that it matches all non-whitespace characters.
1193A match that contains a newline is silently truncated(!) at the
1194newline.</p></div>
Junio C Hamano713eded2015-12-03 00:24:021195<div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
1196and, correspondingly, show differences character by character.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591197<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:241198<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:021199overrides any diff driver or configuration setting. Diff drivers
1200override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:411201</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591202<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531203--color-words[=&lt;regex&gt;]
1204</dt>
1205<dd>
1206<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531207 Equivalent to <code>--word-diff=color</code> plus (if a regex was
1208 specified) <code>--word-diff-regex=&lt;regex&gt;</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531209</p>
1210</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591211<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341212--no-renames
1213</dt>
1214<dd>
1215<p>
1216 Turn off rename detection, even when the configuration
1217 file gives the default to do so.
1218</p>
1219</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591220<dt class="hdlist1">
Junio C Hamanoa890c4f2007-01-28 10:29:211221--check
1222</dt>
1223<dd>
1224<p>
Junio C Hamano84ea1e42016-04-08 21:53:481225 Warn if changes introduce conflict markers or whitespace errors.
1226 What are considered whitespace errors is controlled by <code>core.whitespace</code>
Junio C Hamano6005bfa2011-06-23 00:51:221227 configuration. By default, trailing whitespaces (including
1228 lines that solely consist of whitespaces) and a space character
1229 that is immediately followed by a tab character inside the
1230 initial indent of the line are considered whitespace errors.
1231 Exits with non-zero status if problems are found. Not compatible
1232 with --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:211233</p>
1234</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591235<dt class="hdlist1">
Junio C Hamano8c5d5942015-06-11 19:37:481236--ws-error-highlight=&lt;kind&gt;
1237</dt>
1238<dd>
1239<p>
1240 Highlight whitespace errors on lines specified by &lt;kind&gt;
1241 in the color specified by <code>color.diff.whitespace</code>. &lt;kind&gt;
1242 is a comma separated list of <code>old</code>, <code>new</code>, <code>context</code>. When
1243 this option is not given, only whitespace errors in <code>new</code>
1244 lines are highlighted. E.g. <code>--ws-error-highlight=new,old</code>
1245 highlights whitespace errors on both deleted and added lines.
1246 <code>all</code> can be used as a short-hand for <code>old,new,context</code>.
1247</p>
1248</dd>
1249<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231250--full-index
1251</dt>
1252<dd>
1253<p>
Junio C Hamano5cf43ca2008-08-20 09:14:141254 Instead of the first handful of characters, show the full
1255 pre- and post-image blob object names on the "index"
1256 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:231257</p>
1258</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591259<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341260--binary
1261</dt>
1262<dd>
1263<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531264 In addition to <code>--full-index</code>, output a binary diff that
1265 can be applied with <code>git-apply</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341266</p>
1267</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591268<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231269--abbrev[=&lt;n&gt;]
1270</dt>
1271<dd>
1272<p>
1273 Instead of showing the full 40-byte hexadecimal object
1274 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:561275 lines, show only a partial prefix. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531276 independent of the <code>--full-index</code> option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:231277 the diff-patch output format. Non default number of
Junio C Hamanoc14e6ad2014-10-31 20:25:531278 digits can be specified with <code>--abbrev=&lt;n&gt;</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231279</p>
1280</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591281<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141282-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231283</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591284<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541285--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1286</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231287<dd>
1288<p>
Junio C Hamanoe85e36f2010-08-10 05:30:141289 Break complete rewrite changes into pairs of delete and
1290 create. This serves two purposes:
Junio C Hamano1a4e8412005-12-27 08:17:231291</p>
Junio C Hamano68cf15a2010-11-06 01:01:591292<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:141293not as a series of deletion and insertion mixed together with a very
1294few lines that happen to match textually as the context, but as a
1295single deletion of everything old followed by a single insertion of
Junio C Hamanoc14e6ad2014-10-31 20:25:531296everything new, and the number <code>m</code> controls this aspect of the -B
1297option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the
Junio C Hamano076ffcc2013-02-06 05:13:211298original should remain in the result for Git to consider it a total
Junio C Hamanoe85e36f2010-08-10 05:30:141299rewrite (i.e. otherwise the resulting patch will be a series of
1300deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591301<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:141302source of a rename (usually -M only considers a file that disappeared
Junio C Hamanoc14e6ad2014-10-31 20:25:531303as the source of a rename), and the number <code>n</code> controls this aspect of
1304the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:591305addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:141306eligible for being picked up as a possible source of a rename to
1307another file.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231308</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591309<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141310-M[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231311</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591312<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261313--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541314</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231315<dd>
1316<p>
1317 Detect renames.
Junio C Hamanoc14e6ad2014-10-31 20:25:531318 If <code>n</code> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:141319 index (i.e. amount of addition/deletions compared to the
Junio C Hamanoc14e6ad2014-10-31 20:25:531320 file&#8217;s size). For example, <code>-M90%</code> means Git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:141321 delete/add pair to be a rename if more than 90% of the file
Junio C Hamanoc14e6ad2014-10-31 20:25:531322 hasn&#8217;t changed. Without a <code>%</code> sign, the number is to be read as
1323 a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
1324 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is
1325 the same as <code>-M5%</code>. To limit detection to exact renames, use
1326 <code>-M100%</code>. The default similarity index is 50%.
Junio C Hamano1a4e8412005-12-27 08:17:231327</p>
1328</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591329<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141330-C[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231331</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591332<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261333--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541334</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231335<dd>
1336<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531337 Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1338 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:231339</p>
1340</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591341<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231342--find-copies-harder
1343</dt>
1344<dd>
1345<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531346 For performance reasons, by default, <code>-C</code> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:231347 if the original file of the copy was modified in the same
1348 changeset. This flag makes the command
1349 inspect unmodified files as candidates for the source of
1350 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:141351 projects, so use it with caution. Giving more than one
Junio C Hamanoc14e6ad2014-10-31 20:25:531352 <code>-C</code> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:231353</p>
1354</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591355<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:021356-D
1357</dt>
1358<dt class="hdlist1">
1359--irreversible-delete
1360</dt>
1361<dd>
1362<p>
1363 Omit the preimage for deletes, i.e. print only the header but not
Junio C Hamanoc14e6ad2014-10-31 20:25:531364 the diff between the preimage and <code>/dev/null</code>. The resulting patch
1365 is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is
Junio C Hamanob02377c2011-04-28 22:26:021366 solely for people who want to just concentrate on reviewing the
1367 text after the change. In addition, the output obviously lack
1368 enough information to apply such a patch in reverse, even manually,
1369 hence the name of the option.
1370</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531371<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:021372of a delete/create pair.</p></div>
1373</dd>
1374<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231375-l&lt;num&gt;
1376</dt>
1377<dd>
1378<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531379 The <code>-M</code> and <code>-C</code> options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:231380 is the number of potential rename/copy targets. This
1381 option prevents rename/copy detection from running if
1382 the number of rename/copy targets exceeds the specified
1383 number.
1384</p>
1385</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591386<dt class="hdlist1">
Junio C Hamano982eb112010-11-18 00:53:091387--diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1388</dt>
1389<dd>
1390<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531391 Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1392 Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1393 type (i.e. regular file, symlink, submodule, &#8230;) changed (<code>T</code>),
1394 are Unmerged (<code>U</code>), are
1395 Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
Junio C Hamano982eb112010-11-18 00:53:091396 Any combination of the filter characters (including none) can be used.
Junio C Hamanoc14e6ad2014-10-31 20:25:531397 When <code>*</code> (All-or-none) is added to the combination, all
Junio C Hamano982eb112010-11-18 00:53:091398 paths are selected if there is any file that matches
1399 other criteria in the comparison; if there is no file
1400 that matches other criteria, nothing is selected.
1401</p>
Junio C Hamanoeed15af2016-07-25 22:49:421402<div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1403<code>--diff-filter=ad</code> excludes added and deleted paths.</p></div>
Junio C Hamano982eb112010-11-18 00:53:091404</dd>
1405<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231406-S&lt;string&gt;
1407</dt>
1408<dd>
1409<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521410 Look for differences that change the number of occurrences of
1411 the specified string (i.e. addition/deletion) in a file.
1412 Intended for the scripter&#8217;s use.
Junio C Hamano1a4e8412005-12-27 08:17:231413</p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521414<div class="paragraph"><p>It is useful when you&#8217;re looking for an exact block of code (like a
1415struct), and want to know the history of that block since it first
1416came into being: use the feature iteratively to feed the interesting
Junio C Hamanoc14e6ad2014-10-31 20:25:531417block in the preimage back into <code>-S</code>, and keep going until you get the
Junio C Hamanof1f5a7b2013-06-11 22:23:521418very first version of the block.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231419</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591420<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:341421-G&lt;regex&gt;
1422</dt>
1423<dd>
1424<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521425 Look for differences whose patch text contains added/removed
1426 lines that match &lt;regex&gt;.
Junio C Hamano3b4609d2010-09-30 00:04:341427</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531428<div class="paragraph"><p>To illustrate the difference between <code>-S&lt;regex&gt; --pickaxe-regex</code> and
1429<code>-G&lt;regex&gt;</code>, consider a commit with the following diff in the same
Junio C Hamanof1f5a7b2013-06-11 22:23:521430file:</p></div>
1431<div class="listingblock">
1432<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531433<pre><code>+ return !regexec(regexp, two-&gt;ptr, 1, &amp;regmatch, 0);
Junio C Hamanof1f5a7b2013-06-11 22:23:521434...
Junio C Hamanoc14e6ad2014-10-31 20:25:531435- hit = !regexec(regexp, mf2.ptr, 1, &amp;regmatch, 0);</code></pre>
Junio C Hamanof1f5a7b2013-06-11 22:23:521436</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531437<div class="paragraph"><p>While <code>git log -G"regexec\(regexp"</code> will show this commit, <code>git log
1438-S"regexec\(regexp" --pickaxe-regex</code> will not (because the number of
Junio C Hamanof1f5a7b2013-06-11 22:23:521439occurrences of that string did not change).</p></div>
1440<div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1441information.</p></div>
Junio C Hamano3b4609d2010-09-30 00:04:341442</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591443<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231444--pickaxe-all
1445</dt>
1446<dd>
1447<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531448 When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:231449 changeset, not just the files that contain the change
1450 in &lt;string&gt;.
1451</p>
1452</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591453<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:281454--pickaxe-regex
1455</dt>
1456<dd>
1457<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531458 Treat the &lt;string&gt; given to <code>-S</code> as an extended POSIX regular
Junio C Hamanof1f5a7b2013-06-11 22:23:521459 expression to match.
Junio C Hamanobfe9e752006-04-05 21:43:281460</p>
1461</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591462<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231463-O&lt;orderfile&gt;
1464</dt>
1465<dd>
1466<p>
1467 Output the patch in the order specified in the
1468 &lt;orderfile&gt;, which has one shell glob pattern per line.
Junio C Hamano322c6242015-03-23 21:32:461469 This overrides the <code>diff.orderFile</code> configuration variable
1470 (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
Junio C Hamanoc14e6ad2014-10-31 20:25:531471 use <code>-O/dev/null</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231472</p>
1473</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591474<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231475-R
1476</dt>
1477<dd>
1478<p>
1479 Swap two inputs; that is, show differences from index or
1480 on-disk file to tree contents.
1481</p>
1482</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591483<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441484--relative[=&lt;path&gt;]
1485</dt>
1486<dd>
1487<p>
1488 When run from a subdirectory of the project, it can be
1489 told to exclude changes outside the directory and show
1490 pathnames relative to it with this option. When you are
1491 not in a subdirectory (e.g. in a bare repository), you
1492 can name which subdirectory to make the output relative
1493 to by giving a &lt;path&gt; as an argument.
1494</p>
1495</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591496<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221497-a
1498</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591499<dt class="hdlist1">
Junio C Hamanoc26f5482006-07-09 09:38:141500--text
1501</dt>
1502<dd>
1503<p>
1504 Treat all files as text.
1505</p>
1506</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591507<dt class="hdlist1">
Junio C Hamanofd468962007-02-14 23:45:041508--ignore-space-at-eol
1509</dt>
1510<dd>
1511<p>
Junio C Hamano3a702342007-12-12 21:34:021512 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:041513</p>
1514</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591515<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221516-b
1517</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591518<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071519--ignore-space-change
1520</dt>
1521<dd>
1522<p>
Junio C Hamano3a702342007-12-12 21:34:021523 Ignore changes in amount of whitespace. This ignores whitespace
1524 at line end, and considers all other sequences of one or
1525 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:071526</p>
1527</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591528<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221529-w
Junio C Hamanod9c2d2f2006-12-06 08:59:071530</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591531<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071532--ignore-all-space
1533</dt>
1534<dd>
1535<p>
Junio C Hamano3a702342007-12-12 21:34:021536 Ignore whitespace when comparing lines. This ignores
1537 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:071538 line has none.
1539</p>
1540</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591541<dt class="hdlist1">
Junio C Hamanoa1952302013-07-01 21:31:181542--ignore-blank-lines
1543</dt>
1544<dd>
1545<p>
1546 Ignore changes whose lines are all blank.
1547</p>
1548</dd>
1549<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161550--inter-hunk-context=&lt;lines&gt;
1551</dt>
1552<dd>
1553<p>
1554 Show the context between diff hunks, up to the specified number
1555 of lines, thereby fusing hunks that are close to each other.
1556</p>
1557</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591558<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091559-W
1560</dt>
1561<dt class="hdlist1">
1562--function-context
1563</dt>
1564<dd>
1565<p>
1566 Show whole surrounding functions of changes.
1567</p>
1568</dd>
1569<dt class="hdlist1">
Junio C Hamano48fd2f62007-03-19 02:02:301570--exit-code
1571</dt>
1572<dd>
1573<p>
1574 Make the program exit with codes similar to diff(1).
1575 That is, it exits with 1 if there were differences and
1576 0 means no differences.
1577</p>
1578</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591579<dt class="hdlist1">
Junio C Hamano35e57552007-03-25 07:54:351580--quiet
1581</dt>
1582<dd>
1583<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531584 Disable all output of the program. Implies <code>--exit-code</code>.
Junio C Hamano35e57552007-03-25 07:54:351585</p>
1586</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591587<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401588--ext-diff
1589</dt>
1590<dd>
1591<p>
1592 Allow an external diff helper to be executed. If you set an
Junio C Hamanoa28a9202012-06-21 07:08:231593 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1594 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401595</p>
1596</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591597<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401598--no-ext-diff
1599</dt>
1600<dd>
1601<p>
1602 Disallow external diff drivers.
1603</p>
1604</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591605<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311606--textconv
1607</dt>
1608<dt class="hdlist1">
1609--no-textconv
1610</dt>
1611<dd>
1612<p>
1613 Allow (or disallow) external text conversion filters to be run
Junio C Hamanoa28a9202012-06-21 07:08:231614 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
Junio C Hamanoc652aed2011-07-07 01:14:311615 details. Because textconv filters are typically a one-way
1616 conversion, the resulting diff is suitable for human
1617 consumption, but cannot be applied. For this reason, textconv
Junio C Hamanoa28a9202012-06-21 07:08:231618 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1619 <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:311620 diff plumbing commands.
1621</p>
1622</dd>
1623<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511624--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141625</dt>
1626<dd>
1627<p>
Junio C Hamano7d449522010-07-01 00:08:511628 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamanoc7102962013-05-29 23:57:171629 either "none", "untracked", "dirty" or "all", which is the default.
Junio C Hamano619596a2010-08-18 22:15:351630 Using "none" will consider the submodule modified when it either contains
1631 untracked or modified files or its HEAD differs from the commit recorded
1632 in the superproject and can be used to override any settings of the
Junio C Hamanoa28a9202012-06-21 07:08:231633 <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:511634 "untracked" is used submodules are not considered dirty when they only
1635 contain untracked content (but they are still scanned for modified
1636 content). Using "dirty" ignores all changes to the work tree of submodules,
1637 only changes to the commits stored in the superproject are shown (this was
1638 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141639</p>
1640</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591641<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331642--src-prefix=&lt;prefix&gt;
1643</dt>
1644<dd>
1645<p>
1646 Show the given source prefix instead of "a/".
1647</p>
1648</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591649<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331650--dst-prefix=&lt;prefix&gt;
1651</dt>
1652<dd>
1653<p>
1654 Show the given destination prefix instead of "b/".
1655</p>
1656</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591657<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331658--no-prefix
1659</dt>
1660<dd>
1661<p>
1662 Do not show any source or destination prefix.
1663</p>
1664</dd>
Junio C Hamanocd451662016-09-13 00:54:091665<dt class="hdlist1">
1666--line-prefix=&lt;prefix&gt;
1667</dt>
1668<dd>
1669<p>
1670 Prepend an additional prefix to every line of output.
1671</p>
1672</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311673</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591674<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoa28a9202012-06-21 07:08:231675<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591676<div class="dlist"><dl>
1677<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231678&lt;tree-ish&gt;
1679</dt>
1680<dd>
1681<p>
1682 The id of a tree object to diff against.
1683</p>
1684</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591685<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231686--cached
1687</dt>
1688<dd>
1689<p>
1690 do not consider the on-disk file at all
1691</p>
1692</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591693<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231694-m
1695</dt>
1696<dd>
1697<p>
1698 By default, files recorded in the index but not checked
1699 out are reported as deleted. This flag makes
Junio C Hamano1aa40d22010-01-21 17:46:431700 <em>git diff-index</em> say that all non-checked-out files are up
Junio C Hamano1a4e8412005-12-27 08:17:231701 to date.
1702</p>
1703</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311704</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231705</div>
Junio C Hamano9629d4f2012-12-19 00:28:271706</div>
1707<div class="sect1">
Junio C Hamano543f8d62009-07-29 08:35:211708<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231709<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591710<div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:311711"git-diff-files" and "git diff --raw" are very similar.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591712<div class="paragraph"><p>These commands all compare two sets of things; what is
Junio C Hamanoba4b9282008-07-06 05:20:311713compared differs:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591714<div class="dlist"><dl>
1715<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231716git-diff-index &lt;tree-ish&gt;
1717</dt>
1718<dd>
1719<p>
1720 compares the &lt;tree-ish&gt; and the files on the filesystem.
1721</p>
1722</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591723<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231724git-diff-index --cached &lt;tree-ish&gt;
1725</dt>
1726<dd>
1727<p>
1728 compares the &lt;tree-ish&gt; and the index.
1729</p>
1730</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591731<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231732git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1733</dt>
1734<dd>
1735<p>
1736 compares the trees named by the two arguments.
1737</p>
1738</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591739<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231740git-diff-files [&lt;pattern&gt;&#8230;]
1741</dt>
1742<dd>
1743<p>
1744 compares the index and the files on the filesystem.
1745</p>
1746</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311747</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591748<div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
Junio C Hamano543f8d62009-07-29 08:35:211749what is being compared. After that, all the commands print one output
1750line per changed file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591751<div class="paragraph"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231752<div class="listingblock">
1753<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531754<pre><code>in-place edit :100644 100644 bcd1234... 0123456... M file0
Junio C Hamano1a4e8412005-12-27 08:17:231755copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1756rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1757create :000000 100644 0000000... 1234567... A file4
1758delete :100644 000000 1234567... 0000000... D file5
Junio C Hamanoc14e6ad2014-10-31 20:25:531759unmerged :000000 000000 0000000... 0000000... U file6</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231760</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591761<div class="paragraph"><p>That is, from the left to the right:</p></div>
1762<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231763<li>
1764<p>
1765a colon.
1766</p>
1767</li>
1768<li>
1769<p>
1770mode for "src"; 000000 if creation or unmerged.
1771</p>
1772</li>
1773<li>
1774<p>
1775a space.
1776</p>
1777</li>
1778<li>
1779<p>
1780mode for "dst"; 000000 if deletion or unmerged.
1781</p>
1782</li>
1783<li>
1784<p>
1785a space.
1786</p>
1787</li>
1788<li>
1789<p>
1790sha1 for "src"; 0{40} if creation or unmerged.
1791</p>
1792</li>
1793<li>
1794<p>
1795a space.
1796</p>
1797</li>
1798<li>
1799<p>
1800sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1801</p>
1802</li>
1803<li>
1804<p>
1805a space.
1806</p>
1807</li>
1808<li>
1809<p>
1810status, followed by optional "score" number.
1811</p>
1812</li>
1813<li>
1814<p>
Junio C Hamano92d80372016-07-13 22:00:051815a tab or a NUL when <code>-z</code> option is used.
Junio C Hamano1a4e8412005-12-27 08:17:231816</p>
1817</li>
1818<li>
1819<p>
1820path for "src"
1821</p>
1822</li>
1823<li>
1824<p>
Junio C Hamano92d80372016-07-13 22:00:051825a tab or a NUL when <code>-z</code> option is used; only exists for C or R.
Junio C Hamano1a4e8412005-12-27 08:17:231826</p>
1827</li>
1828<li>
1829<p>
1830path for "dst"; only exists for C or R.
1831</p>
1832</li>
1833<li>
1834<p>
Junio C Hamano92d80372016-07-13 22:00:051835an LF or a NUL when <code>-z</code> option is used, to terminate the record.
Junio C Hamano1a4e8412005-12-27 08:17:231836</p>
1837</li>
Junio C Hamanoba4b9282008-07-06 05:20:311838</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591839<div class="paragraph"><p>Possible status letters are:</p></div>
1840<div class="ulist"><ul>
Junio C Hamanoaa17c7c2008-11-03 04:36:581841<li>
1842<p>
1843A: addition of a file
1844</p>
1845</li>
1846<li>
1847<p>
1848C: copy of a file into a new one
1849</p>
1850</li>
1851<li>
1852<p>
1853D: deletion of a file
1854</p>
1855</li>
1856<li>
1857<p>
1858M: modification of the contents or mode of a file
1859</p>
1860</li>
1861<li>
1862<p>
1863R: renaming of a file
1864</p>
1865</li>
1866<li>
1867<p>
1868T: change in the type of the file
1869</p>
1870</li>
1871<li>
1872<p>
1873U: file is unmerged (you must complete the merge before it can
1874be committed)
1875</p>
1876</li>
1877<li>
1878<p>
1879X: "unknown" change type (most probably a bug, please report it)
1880</p>
1881</li>
1882</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591883<div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:581884percentage of similarity between the source and target of the move or
Junio C Hamano6bb32e62015-02-17 22:11:261885copy). Status letter M may be followed by a score (denoting the
1886percentage of dissimilarity) for file rewrites.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591887<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:311888and it is out of sync with the index.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591889<div class="paragraph"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231890<div class="listingblock">
1891<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531892<pre><code>:100644 100644 5be4a4...... 000000...... M file.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231893</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531894<div class="paragraph"><p>When <code>-z</code> option is not used, TAB, LF, and backslash characters
1895in pathnames are represented as <code>\t</code>, <code>\n</code>, and <code>\\</code>,
Junio C Hamanoba4b9282008-07-06 05:20:311896respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231897</div>
Junio C Hamano9629d4f2012-12-19 00:28:271898</div>
1899<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311900<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:121901<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591902<div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano92d80372016-07-13 22:00:051903can take <code>-c</code> or <code>--cc</code> option
Junio C Hamano67fad6d2007-05-06 08:53:121904to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:311905from the format described above in the following way:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591906<div class="olist arabic"><ol class="arabic">
Junio C Hamano67fad6d2007-05-06 08:53:121907<li>
1908<p>
1909there is a colon for each parent
1910</p>
1911</li>
1912<li>
1913<p>
1914there are more "src" modes and "src" sha1
1915</p>
1916</li>
1917<li>
1918<p>
1919status is concatenated status characters for each parent
1920</p>
1921</li>
1922<li>
1923<p>
1924no optional "score" number
1925</p>
1926</li>
1927<li>
1928<p>
1929single path, only for "dst"
1930</p>
1931</li>
Junio C Hamanoba4b9282008-07-06 05:20:311932</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591933<div class="paragraph"><p>Example:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121934<div class="listingblock">
1935<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531936<pre><code>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</code></pre>
Junio C Hamano67fad6d2007-05-06 08:53:121937</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591938<div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
Junio C Hamanoba4b9282008-07-06 05:20:311939all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121940</div>
Junio C Hamano9629d4f2012-12-19 00:28:271941</div>
1942<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311943<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231944<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591945<div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano92d80372016-07-13 22:00:051946with a <code>-p</code> option, "git diff" without the <code>--raw</code> option, or
Junio C Hamano00b8b632007-12-07 09:50:491947"git log" with the "-p" option, they
Junio C Hamano7ae0ab22007-11-03 02:46:461948do not produce the output described above; instead they produce a
1949patch file. You can customize the creation of such patches via the
Junio C Hamano042f2142016-06-27 18:05:051950<code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591951<div class="paragraph"><p>What the -p option produces is slightly different from the traditional
Junio C Hamano7f9fa862010-10-19 23:51:141952diff format:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591953<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231954<li>
1955<p>
Junio C Hamano7f9fa862010-10-19 23:51:141956It is preceded with a "git diff" header that looks like this:
Junio C Hamano1a4e8412005-12-27 08:17:231957</p>
1958<div class="literalblock">
1959<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531960<pre><code>diff --git a/file1 b/file2</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231961</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531962<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:231963involved. Especially, even for a creation or a deletion,
Junio C Hamanoc14e6ad2014-10-31 20:25:531964<code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div>
1965<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:231966name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:311967the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231968</li>
1969<li>
1970<p>
1971It is followed by one or more extended header lines:
1972</p>
1973<div class="literalblock">
1974<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531975<pre><code>old mode &lt;mode&gt;
Junio C Hamano1a4e8412005-12-27 08:17:231976new mode &lt;mode&gt;
1977deleted file mode &lt;mode&gt;
1978new file mode &lt;mode&gt;
1979copy from &lt;path&gt;
1980copy to &lt;path&gt;
1981rename from &lt;path&gt;
1982rename to &lt;path&gt;
1983similarity index &lt;number&gt;
1984dissimilarity index &lt;number&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:531985index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231986</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591987<div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
Junio C Hamano7f9fa862010-10-19 23:51:141988and file permission bits.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531989<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:591990<div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano7f9fa862010-10-19 23:51:141991the dissimilarity index is the percentage of changed lines. It
1992is a rounded down integer, followed by a percent sign. The
1993similarity index value of 100% is thus reserved for two equal
1994files, while 100% dissimilarity means that no line from the old
1995file made it into the new one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591996<div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
Junio C Hamano7f9fa862010-10-19 23:51:141997The &lt;mode&gt; is included if the file mode does not change; otherwise,
1998separate lines indicate the old and the new mode.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231999</li>
2000<li>
2001<p>
Junio C Hamanoa053d542006-10-27 09:29:132002TAB, LF, double quote and backslash characters in pathnames
Junio C Hamanoc14e6ad2014-10-31 20:25:532003 are represented as <code>\t</code>, <code>\n</code>, <code>\"</code> and <code>\\</code>, respectively.
Junio C Hamanoa053d542006-10-27 09:29:132004 If there is need for such substitution then the whole
2005 pathname is put in double quotes.
Junio C Hamano1a4e8412005-12-27 08:17:232006</p>
2007</li>
Junio C Hamano7f9fa862010-10-19 23:51:142008<li>
2009<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:532010All the <code>file1</code> files in the output refer to files before the
2011 commit, and all the <code>file2</code> files refer to files after the commit.
Junio C Hamano7f9fa862010-10-19 23:51:142012 It is incorrect to apply each change to each file sequentially. For
2013 example, this patch will swap a and b:
2014</p>
2015<div class="literalblock">
2016<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532017<pre><code>diff --git a/a b/b
Junio C Hamano7f9fa862010-10-19 23:51:142018rename from a
2019rename to b
2020diff --git a/b b/a
2021rename from b
Junio C Hamanoc14e6ad2014-10-31 20:25:532022rename to a</code></pre>
Junio C Hamano7f9fa862010-10-19 23:51:142023</div></div>
2024</li>
Junio C Hamanoba4b9282008-07-06 05:20:312025</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:232026</div>
Junio C Hamano9629d4f2012-12-19 00:28:272027</div>
2028<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312029<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:192030<div class="sectionbody">
Junio C Hamano1dbca522015-05-22 20:48:552031<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:432032produce a <em>combined diff</em> when showing a merge. This is the default
Junio C Hamanoa28a9202012-06-21 07:08:232033format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
Junio C Hamano1dbca522015-05-22 20:48:552034<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:432035of these commands to force generation of diffs with individual parents
2036of a merge.</p></div>
2037<div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192038<div class="listingblock">
2039<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532040<pre><code>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:292041index fabadb8,cc95eb0..4866510
2042--- a/describe.c
2043+++ b/describe.c
2044@@@ -98,20 -98,12 +98,20 @@@
2045 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:192046 }
2047
2048- static void describe(char *arg)
2049 -static void describe(struct commit *cmit, int last_one)
2050++static void describe(char *arg, int last_one)
2051 {
Junio C Hamano29f14312006-10-26 08:47:292052 + unsigned char sha1[20];
2053 + struct commit *cmit;
2054 struct commit_list *list;
2055 static int initialized = 0;
2056 struct commit_name *n;
2057
2058 + if (get_sha1(arg, sha1) &lt; 0)
2059 + usage(describe_usage);
2060 + cmit = lookup_commit_reference(sha1);
2061 + if (!cmit)
2062 + usage(describe_usage);
2063 +
2064 if (!initialized) {
2065 initialized = 1;
Junio C Hamanoc14e6ad2014-10-31 20:25:532066 for_each_ref(get_name);</code></pre>
Junio C Hamanofb56a962006-01-28 10:38:192067</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592068<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:292069<li>
2070<p>
2071It is preceded with a "git diff" header, that looks like
Junio C Hamano92d80372016-07-13 22:00:052072 this (when <code>-c</code> option is used):
Junio C Hamano29f14312006-10-26 08:47:292073</p>
2074<div class="literalblock">
2075<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532076<pre><code>diff --combined file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292077</div></div>
Junio C Hamano92d80372016-07-13 22:00:052078<div class="paragraph"><p>or like this (when <code>--cc</code> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:292079<div class="literalblock">
2080<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532081<pre><code>diff --cc file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292082</div></div>
2083</li>
2084<li>
2085<p>
2086It is followed by one or more extended header lines
2087 (this example shows a merge with two parents):
2088</p>
2089<div class="literalblock">
2090<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532091<pre><code>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
Junio C Hamano29f14312006-10-26 08:47:292092mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2093new file mode &lt;mode&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532094deleted file mode &lt;mode&gt;,&lt;mode&gt;</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292095</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532096<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:042097the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:292098information about detected contents movement (renames and
2099copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:312100&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292101</li>
2102<li>
2103<p>
2104It is followed by two-line from-file/to-file header
2105</p>
2106<div class="literalblock">
2107<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532108<pre><code>--- a/file
2109+++ b/file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292110</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592111<div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamanoc14e6ad2014-10-31 20:25:532112format, <code>/dev/null</code> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:312113files.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292114</li>
2115<li>
2116<p>
2117Chunk header format is modified to prevent people from
Junio C Hamanoc14e6ad2014-10-31 20:25:532118 accidentally feeding it to <code>patch -p1</code>. Combined diff format
Junio C Hamano29f14312006-10-26 08:47:292119 was created for review of merge commit changes, and was not
2120 meant for apply. The change is similar to the change in the
2121 extended <em>index</em> header:
2122</p>
2123<div class="literalblock">
2124<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532125<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:292126</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532127<div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk
Junio C Hamanoba4b9282008-07-06 05:20:312128header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292129</li>
Junio C Hamanoba4b9282008-07-06 05:20:312130</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592131<div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
Junio C Hamanoc14e6ad2014-10-31 20:25:532132files 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
2133added to B), or <code>" "</code> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:192134compares two or more files file1, file2,&#8230; with one file X, and
2135shows how X differs from each of fileN. One column for each of
Junio C Hamano68cf15a2010-11-06 01:01:592136fileN is prepended to the output line to note how X&#8217;s line is
Junio C Hamanoba4b9282008-07-06 05:20:312137different from it.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532138<div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in
2139fileN but it does not appear in the result. A <code>+</code> character
Junio C Hamano54bf1e22008-12-20 06:30:112140in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:292141and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:312142added, from the point of view of that parent).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592143<div class="paragraph"><p>In the above example output, the function signature was changed
Junio C Hamanoc14e6ad2014-10-31 20:25:532144from both files (hence two <code>-</code> removals from both file1 and
2145file2, plus <code>++</code> to mean one line that was added does not appear
Junio C Hamanod75148a2014-04-08 19:48:382146in either file1 or file2). Also eight other lines are the same
Junio C Hamanoc14e6ad2014-10-31 20:25:532147from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div>
2148<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:192149merge commit with the merge result (i.e. file1..fileN are the
Junio C Hamanoc14e6ad2014-10-31 20:25:532150parents). When shown by <code>git diff-files -c</code>, it compares the
Junio C Hamanofb56a962006-01-28 10:38:192151two unresolved merge parents with the working tree file
2152(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:312153"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192154</div>
Junio C Hamano9629d4f2012-12-19 00:28:272155</div>
2156<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312157<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:022158<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:532159<div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and
2160copied files. The <code>--stat</code> option adds diffstat(1) graph to the
Junio C Hamano3a702342007-12-12 21:34:022161output. These options can be combined with other options, such as
Junio C Hamanoc14e6ad2014-10-31 20:25:532162<code>-p</code>, and are meant for human consumption.</p></div>
2163<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:022164formats the pathnames compactly by combining common prefix and suffix of
Junio C Hamanoc14e6ad2014-10-31 20:25:532165the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to
2166<code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022167<div class="listingblock">
2168<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532169<pre><code>arch/{i386 =&gt; x86}/Makefile | 4 +--</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022170</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532171<div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed
2172for easier machine consumption. An entry in <code>--numstat</code> output looks
Junio C Hamanoba4b9282008-07-06 05:20:312173like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022174<div class="listingblock">
2175<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532176<pre><code>1 2 README
21773 1 arch/{i386 =&gt; x86}/Makefile</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022178</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592179<div class="paragraph"><p>That is, from left to right:</p></div>
2180<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022181<li>
2182<p>
2183the number of added lines;
2184</p>
2185</li>
2186<li>
2187<p>
2188a tab;
2189</p>
2190</li>
2191<li>
2192<p>
2193the number of deleted lines;
2194</p>
2195</li>
2196<li>
2197<p>
2198a tab;
2199</p>
2200</li>
2201<li>
2202<p>
2203pathname (possibly with rename/copy information);
2204</p>
2205</li>
2206<li>
2207<p>
2208a newline.
2209</p>
2210</li>
Junio C Hamanoba4b9282008-07-06 05:20:312211</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532212<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:022213<div class="listingblock">
2214<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532215<pre><code>1 2 README NUL
22163 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022217</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592218<div class="paragraph"><p>That is:</p></div>
2219<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022220<li>
2221<p>
2222the number of added lines;
2223</p>
2224</li>
2225<li>
2226<p>
2227a tab;
2228</p>
2229</li>
2230<li>
2231<p>
2232the number of deleted lines;
2233</p>
2234</li>
2235<li>
2236<p>
2237a tab;
2238</p>
2239</li>
2240<li>
2241<p>
2242a NUL (only exists if renamed/copied);
2243</p>
2244</li>
2245<li>
2246<p>
2247pathname in preimage;
2248</p>
2249</li>
2250<li>
2251<p>
2252a NUL (only exists if renamed/copied);
2253</p>
2254</li>
2255<li>
2256<p>
2257pathname in postimage (only exists if renamed/copied);
2258</p>
2259</li>
2260<li>
2261<p>
2262a NUL.
2263</p>
2264</li>
Junio C Hamanoba4b9282008-07-06 05:20:312265</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532266<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:022267scripts that read the output to tell if the current record being read is
2268a single-path record or a rename/copy record without reading ahead.
Junio C Hamanoc14e6ad2014-10-31 20:25:532269After reading added and deleted lines, reading up to <code>NUL</code> would yield
2270the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:022271</div>
Junio C Hamano9629d4f2012-12-19 00:28:272272</div>
2273<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312274<h2 id="_operating_modes">Operating Modes</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232275<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592276<div class="paragraph"><p>You can choose whether you want to trust the index file entirely
Junio C Hamano92d80372016-07-13 22:00:052277(using the <code>--cached</code> flag) or ask the diff logic to show any files
Junio C Hamano68cf15a2010-11-06 01:01:592278that don&#8217;t match the stat state as being "tentatively changed". Both
Junio C Hamanoba4b9282008-07-06 05:20:312279of these operations are very useful indeed.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232280</div>
Junio C Hamano9629d4f2012-12-19 00:28:272281</div>
2282<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312283<h2 id="_cached_mode">Cached Mode</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232284<div class="sectionbody">
Junio C Hamano92d80372016-07-13 22:00:052285<div class="paragraph"><p>If <code>--cached</code> is specified, it allows you to ask:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232286<div class="literalblock">
2287<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532288<pre><code>show me the differences between HEAD and the current index
2289contents (the ones I'd write using 'git write-tree')</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232290</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592291<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:582292some files in the index and are ready to commit. You want to see exactly
Junio C Hamanodcc22ee2006-11-03 02:40:132293<strong>what</strong> you are going to commit, without having to write a new tree
Junio C Hamanoba4b9282008-07-06 05:20:312294object and compare it that way, and to do that, you just do</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232295<div class="literalblock">
2296<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532297<pre><code>git diff-index --cached HEAD</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232298</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532299<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
2300done an <code>update-index</code> to make that effective in the index file.
2301<code>git diff-files</code> wouldn&#8217;t show anything at all, since the index file
Junio C Hamano1aa40d22010-01-21 17:46:432302matches my working directory. But doing a <em>git diff-index</em> does:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232303<div class="literalblock">
2304<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532305<pre><code>torvalds@ppc970:~/git&gt; git diff-index --cached HEAD
Junio C Hamano1a4e8412005-12-27 08:17:232306-100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c
Junio C Hamanoc14e6ad2014-10-31 20:25:532307+100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232308</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592309<div class="paragraph"><p>You can see easily that the above is a rename.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532310<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:432311actually doing a <em>git write-tree</em> and comparing that. Except this one is much
Junio C Hamanoba4b9282008-07-06 05:20:312312nicer for the case where you just want to check where you are.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532313<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:232314asking yourself "what have I already marked for being committed, and
Junio C Hamano68cf15a2010-11-06 01:01:592315what&#8217;s the difference to a previous tree".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232316</div>
Junio C Hamano9629d4f2012-12-19 00:28:272317</div>
2318<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312319<h2 id="_non_cached_mode">Non-cached Mode</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232320<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592321<div class="paragraph"><p>The "non-cached" mode takes a different approach, and is potentially
2322the more useful of the two in that what it does can&#8217;t be emulated with
2323a <em>git write-tree</em> + <em>git diff-tree</em>. Thus that&#8217;s the default mode.
Junio C Hamanoba4b9282008-07-06 05:20:312324The non-cached version asks the question:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232325<div class="literalblock">
2326<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532327<pre><code>show me the differences between HEAD and the currently checked out
2328tree - index contents _and_ files that aren't up-to-date</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232329</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592330<div class="paragraph"><p>which is obviously a very useful question too, since that tells you what
Junio C Hamano1aa40d22010-01-21 17:46:432331you <strong>could</strong> commit. Again, the output matches the <em>git diff-tree -r</em>
Junio C Hamanoba4b9282008-07-06 05:20:312332output to a tee, but with a twist.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592333<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:232334a backing store thing for it, and we use the magic "all-zero" sha1 to
Junio C Hamanoc14e6ad2014-10-31 20:25:532335show that. So let&#8217;s say that you have edited <code>kernel/sched.c</code>, but
Junio C Hamano1aa40d22010-01-21 17:46:432336have not actually done a <em>git update-index</em> on it yet - there is no
Junio C Hamanoba4b9282008-07-06 05:20:312337"object" associated with the new state, and you get:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232338<div class="literalblock">
2339<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532340<pre><code>torvalds@ppc970:~/v2.6/linux&gt; git diff-index --abbrev HEAD
2341:100644 100664 7476bb... 000000... kernel/sched.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232342</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532343<div class="paragraph"><p>i.e., it shows that the tree has changed, and that <code>kernel/sched.c</code> has is
Junio C Hamano1a4e8412005-12-27 08:17:232344not up-to-date and may contain new stuff. The all-zero sha1 means that to
2345get the real diff, you need to look at the object in the working directory
Junio C Hamanoba4b9282008-07-06 05:20:312346directly rather than do an object-to-object diff.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232347<div class="admonitionblock">
2348<table><tr>
2349<td class="icon">
2350<div class="title">Note</div>
2351</td>
Junio C Hamano1aa40d22010-01-21 17:46:432352<td class="content">As with other commands of this type, <em>git diff-index</em> does not
Junio C Hamano1a4e8412005-12-27 08:17:232353actually look at the contents of the file at all. So maybe
Junio C Hamanoc14e6ad2014-10-31 20:25:532354<code>kernel/sched.c</code> hasn&#8217;t actually changed, and it&#8217;s just that you
Junio C Hamano68cf15a2010-11-06 01:01:592355touched it. In either case, it&#8217;s a note that you need to
Junio C Hamano1aa40d22010-01-21 17:46:432356<em>git update-index</em> it to make the index be in sync.</td>
Junio C Hamano1a4e8412005-12-27 08:17:232357</tr></table>
2358</div>
2359<div class="admonitionblock">
2360<table><tr>
2361<td class="icon">
2362<div class="title">Note</div>
2363</td>
2364<td class="content">You can have a mixture of files show up as "has been updated"
2365and "is still dirty in the working directory" together. You can always
2366tell which file is in which state, since the "has been updated" ones
2367show a valid sha1, and the "not in sync with the index" ones will
2368always have the special all-zero sha1.</td>
2369</tr></table>
2370</div>
2371</div>
Junio C Hamano9629d4f2012-12-19 00:28:272372</div>
2373<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312374<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232375<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:232376<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232377</div>
Junio C Hamano7bd050f2011-09-22 06:32:222378</div>
Junio C Hamano9629d4f2012-12-19 00:28:272379</div>
Junio C Hamano7bd050f2011-09-22 06:32:222380<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:232381<div id="footer">
2382<div id="footer-text">
Junio C Hamano92d80372016-07-13 22:00:052383Last updated 2016-07-13 14:58:50 PDT
Junio C Hamano1a4e8412005-12-27 08:17:232384</div>
2385</div>
2386</body>
2387</html>