blob: 159cc66784f5190007f639e1c372bc275dcf9ab5 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9629d4f2012-12-19 00:28:275<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoc14e6ad2014-10-31 20:25:536<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-diff-index(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
Junio C Hamano9629d4f2012-12-19 00:28:279/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2324}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamanoba4b9282008-07-06 05:20:3130a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano1a4e8412005-12-27 08:17:2337
38em {
39 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5940 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2341}
42
43strong {
44 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5945 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2346}
47
Junio C Hamano1a4e8412005-12-27 08:17:2348h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2350 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamanoba4b9282008-07-06 05:20:3155h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2356 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2359 padding-top: 0.5em;
60}
Junio C Hamanoba4b9282008-07-06 05:20:3161h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9629d4f2012-12-19 00:28:2767h5 {
68 font-size: 1.0em;
69}
Junio C Hamano1a4e8412005-12-27 08:17:2370
71div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2372 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano68cf15a2010-11-06 01:01:5984ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9629d4f2012-12-19 00:28:2787ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5989
Junio C Hamanoc14e6ad2014-10-31 20:25:5390.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2394 padding: 0;
95 margin: 0;
96}
Junio C Hamanoc14e6ad2014-10-31 20:25:5397pre {
98 white-space: pre-wrap;
99}
Junio C Hamano1a4e8412005-12-27 08:17:23100
Junio C Hamano9629d4f2012-12-19 00:28:27101#author {
Junio C Hamano1a4e8412005-12-27 08:17:23102 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23103 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31104 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23105}
Junio C Hamano9629d4f2012-12-19 00:28:27106#email {
Junio C Hamano1a4e8412005-12-27 08:17:23107}
Junio C Hamano9629d4f2012-12-19 00:28:27108#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23109}
110
Junio C Hamano9629d4f2012-12-19 00:28:27111#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9629d4f2012-12-19 00:28:27117#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9629d4f2012-12-19 00:28:27121#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9629d4f2012-12-19 00:28:27126#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9629d4f2012-12-19 00:28:27130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22133 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59149 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9629d4f2012-12-19 00:28:27171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9629d4f2012-12-19 00:28:27177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23180 padding: 0.5em;
181}
182
Junio C Hamano7bd050f2011-09-22 06:32:22183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59186 margin-right: 10%;
Junio C Hamano9629d4f2012-12-19 00:28:27187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23189}
Junio C Hamano7bd050f2011-09-22 06:32:22190
Junio C Hamano68cf15a2010-11-06 01:01:59191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23193 text-align: right;
194}
Junio C Hamano68cf15a2010-11-06 01:01:59195
Junio C Hamano9629d4f2012-12-19 00:28:27196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31205div.verseblock + div.attribution {
206 text-align: left;
207}
Junio C Hamano1a4e8412005-12-27 08:17:23208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22219 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221
222div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23225}
226
Junio C Hamano1a4e8412005-12-27 08:17:23227div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano68cf15a2010-11-06 01:01:59229a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59238 font-style: normal;
239 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23240}
241dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59242 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23243}
244
245ul, ol {
246 list-style-position: outside;
247}
Junio C Hamano68cf15a2010-11-06 01:01:59248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23252 list-style-type: lower-alpha;
253}
Junio C Hamano68cf15a2010-11-06 01:01:59254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
Junio C Hamano1a4e8412005-12-27 08:17:23270
Junio C Hamano1a4e8412005-12-27 08:17:23271tfoot {
272 font-weight: bold;
273}
Junio C Hamano68cf15a2010-11-06 01:01:59274td > div.verse {
275 white-space: pre;
276}
Junio C Hamano68cf15a2010-11-06 01:01:59277
278div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
Junio C Hamano68cf15a2010-11-06 01:01:59282div.hdlist tr {
283 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31284}
Junio C Hamano68cf15a2010-11-06 01:01:59285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23289 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59290 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23291 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59292 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23293}
Junio C Hamano68cf15a2010-11-06 01:01:59294td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23295 vertical-align: top;
296}
Junio C Hamano68cf15a2010-11-06 01:01:59297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
Junio C Hamano1a4e8412005-12-27 08:17:23305
Junio C Hamano7bd050f2011-09-22 06:32:22306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9629d4f2012-12-19 00:28:27333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23340}
Junio C Hamanoba4b9282008-07-06 05:20:31341
Junio C Hamano9629d4f2012-12-19 00:28:27342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9629d4f2012-12-19 00:28:27350#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31351 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamanoc14e6ad2014-10-31 20:25:53358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamano9629d4f2012-12-19 00:28:27374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamanoc14e6ad2014-10-31 20:25:53416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9629d4f2012-12-19 00:28:27418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
Junio C Hamano9629d4f2012-12-19 00:28:27526body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59527 border-style: none;
528}
Junio C Hamano9629d4f2012-12-19 00:28:27529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59531}
532
533@media print {
Junio C Hamano9629d4f2012-12-19 00:28:27534 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59535}
Junio C Hamanoc14e6ad2014-10-31 20:25:53536
537
Junio C Hamano1a4e8412005-12-27 08:17:23538</style>
Junio C Hamano7bd050f2011-09-22 06:32:22539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9629d4f2012-12-19 00:28:27602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9629d4f2012-12-19 00:28:27612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9629d4f2012-12-19 00:28:27648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9629d4f2012-12-19 00:28:27651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9629d4f2012-12-19 00:28:27658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9629d4f2012-12-19 00:28:27672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamano7bd050f2011-09-22 06:32:22682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9629d4f2012-12-19 00:28:27705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22727}
728
729}
Junio C Hamano9629d4f2012-12-19 00:28:27730asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22731/*]]>*/
732</script>
Junio C Hamano1a4e8412005-12-27 08:17:23733</head>
Junio C Hamano9629d4f2012-12-19 00:28:27734<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23735<div id="header">
736<h1>
737git-diff-index(1) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>git-diff-index -
Junio C Hamano7e590a12013-06-02 23:46:52742 Compare a tree to the working tree or index
Junio C Hamano1a4e8412005-12-27 08:17:23743</p>
744</div>
745</div>
Junio C Hamano7bd050f2011-09-22 06:32:22746<div id="content">
Junio C Hamano9629d4f2012-12-19 00:28:27747<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59748<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23749<div class="sectionbody">
Junio C Hamano15567bc2011-07-23 00:51:59750<div class="verseblock">
Junio C Hamano9629d4f2012-12-19 00:28:27751<pre class="content"><em>git diff-index</em> [-m] [--cached] [&lt;common diff options&gt;] &lt;tree-ish&gt; [&lt;path&gt;&#8230;]</pre>
752<div class="attribution">
Junio C Hamano15567bc2011-07-23 00:51:59753</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23754</div>
Junio C Hamano9629d4f2012-12-19 00:28:27755</div>
756<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31757<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23758<div class="sectionbody">
Junio C Hamano7e590a12013-06-02 23:46:52759<div class="paragraph"><p>Compares the content and mode of the blobs found in a tree object
760with the corresponding tracked files in the working tree, or with the
761corresponding paths in the index. When &lt;path&gt; arguments are present,
762compares only paths matching those patterns. Otherwise all tracked
763files are compared.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23764</div>
Junio C Hamano9629d4f2012-12-19 00:28:27765</div>
766<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31767<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23768<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59769<div class="dlist"><dl>
770<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23771-p
772</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59773<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22774-u
775</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59776<dt class="hdlist1">
Junio C Hamanoe97d5772010-05-19 08:13:58777--patch
778</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23779<dd>
780<p>
Junio C Hamanoff979792007-11-16 10:11:30781 Generate patch (see section on generating patches).
Junio C Hamano1a4e8412005-12-27 08:17:23782</p>
783</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59784<dt class="hdlist1">
Junio C Hamano58f587a2013-07-22 19:20:59785-s
786</dt>
787<dt class="hdlist1">
788--no-patch
789</dt>
790<dd>
791<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53792 Suppress diff output. Useful for commands like <code>git show</code> that
793 show the patch by default, or to cancel the effect of <code>--patch</code>.
Junio C Hamano58f587a2013-07-22 19:20:59794</p>
795</dd>
796<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34797-U&lt;n&gt;
798</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59799<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34800--unified=&lt;n&gt;
801</dt>
802<dd>
803<p>
804 Generate diffs with &lt;n&gt; lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:37805 the usual three.
Junio C Hamanoc14e6ad2014-10-31 20:25:53806 Implies <code>-p</code>.
Junio C Hamano69361562007-07-26 02:14:34807</p>
808</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59809<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34810--raw
811</dt>
812<dd>
813<p>
Junio C Hamano85f1fde2015-06-01 20:37:32814 Generate the diff in raw format.
Junio C Hamano1dbca522015-05-22 20:48:55815 This is the default.
Junio C Hamano9ae1a062006-07-10 08:12:34816</p>
817</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59818<dt class="hdlist1">
Junio C Hamano54559c82006-04-13 07:45:12819--patch-with-raw
820</dt>
821<dd>
822<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53823 Synonym for <code>-p --raw</code>.
Junio C Hamano54559c82006-04-13 07:45:12824</p>
825</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59826<dt class="hdlist1">
Junio C Hamanoad70bf02016-09-26 23:44:27827--indent-heuristic
828</dt>
829<dt class="hdlist1">
830--no-indent-heuristic
831</dt>
832<dt class="hdlist1">
Junio C Hamano5f888332016-06-13 19:28:31833--compaction-heuristic
834</dt>
835<dt class="hdlist1">
836--no-compaction-heuristic
837</dt>
838<dd>
839<p>
Junio C Hamanoad70bf02016-09-26 23:44:27840 These are to help debugging and tuning experimental heuristics
841 (which are off by default) that shift diff hunk boundaries to
842 make patches easier to read.
Junio C Hamano5f888332016-06-13 19:28:31843</p>
844</dd>
845<dt class="hdlist1">
Junio C Hamano5a73f302011-10-14 05:58:34846--minimal
847</dt>
848<dd>
849<p>
850 Spend extra time to make sure the smallest possible
851 diff is produced.
852</p>
853</dd>
854<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02855--patience
856</dt>
857<dd>
858<p>
859 Generate a diff using the "patience diff" algorithm.
860</p>
861</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59862<dt class="hdlist1">
Junio C Hamanoaea9e6b2012-03-07 00:17:11863--histogram
864</dt>
865<dd>
866<p>
867 Generate a diff using the "histogram diff" algorithm.
868</p>
869</dd>
870<dt class="hdlist1">
Junio C Hamano80ad00d2013-02-18 00:19:03871--diff-algorithm={patience|minimal|histogram|myers}
872</dt>
873<dd>
874<p>
875 Choose a diff algorithm. The variants are as follows:
876</p>
877<div class="openblock">
878<div class="content">
879<div class="dlist"><dl>
880<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53881<code>default</code>, <code>myers</code>
Junio C Hamano80ad00d2013-02-18 00:19:03882</dt>
883<dd>
884<p>
885 The basic greedy diff algorithm. Currently, this is the default.
886</p>
887</dd>
888<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53889<code>minimal</code>
Junio C Hamano80ad00d2013-02-18 00:19:03890</dt>
891<dd>
892<p>
893 Spend extra time to make sure the smallest possible diff is
894 produced.
895</p>
896</dd>
897<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53898<code>patience</code>
Junio C Hamano80ad00d2013-02-18 00:19:03899</dt>
900<dd>
901<p>
902 Use "patience diff" algorithm when generating patches.
903</p>
904</dd>
905<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53906<code>histogram</code>
Junio C Hamano80ad00d2013-02-18 00:19:03907</dt>
908<dd>
909<p>
910 This algorithm extends the patience algorithm to "support
911 low-occurrence common elements".
912</p>
913</dd>
914</dl></div>
915</div></div>
916<div class="paragraph"><p>For instance, if you configured diff.algorithm variable to a
917non-default value and want to use the default one, then you
Junio C Hamanoc14e6ad2014-10-31 20:25:53918have to use <code>--diff-algorithm=default</code> option.</p></div>
Junio C Hamano80ad00d2013-02-18 00:19:03919</dd>
920<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32921--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamanoba7c8d82006-04-15 06:17:42922</dt>
923<dd>
924<p>
Junio C Hamanoaea9e6b2012-03-07 00:17:11925 Generate a diffstat. By default, as much space as necessary
926 will be used for the filename part, and the rest for the graph
927 part. Maximum width defaults to terminal width, or 80 columns
Junio C Hamano7f2b3cb2012-06-22 22:42:39928 if not connected to a terminal, and can be overridden by
Junio C Hamanoc14e6ad2014-10-31 20:25:53929 <code>&lt;width&gt;</code>. The width of the filename part can be limited by
930 giving another width <code>&lt;name-width&gt;</code> after a comma. The width
Junio C Hamanoaea9e6b2012-03-07 00:17:11931 of the graph part can be limited by using
Junio C Hamanoc14e6ad2014-10-31 20:25:53932 <code>--stat-graph-width=&lt;width&gt;</code> (affects all commands generating
933 a stat graph) or by setting <code>diff.statGraphWidth=&lt;width&gt;</code>
934 (does not affect <code>git format-patch</code>).
935 By giving a third parameter <code>&lt;count&gt;</code>, you can limit the
936 output to the first <code>&lt;count&gt;</code> lines, followed by <code>...</code> if
Junio C Hamanoaea9e6b2012-03-07 00:17:11937 there are more.
Junio C Hamanoba7c8d82006-04-15 06:17:42938</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53939<div class="paragraph"><p>These parameters can also be set individually with <code>--stat-width=&lt;width&gt;</code>,
940<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:42941</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59942<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48943--numstat
944</dt>
945<dd>
946<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53947 Similar to <code>--stat</code>, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:48948 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43949 abbreviation, to make it more machine friendly. For
Junio C Hamanoc14e6ad2014-10-31 20:25:53950 binary files, outputs two <code>-</code> instead of saying
951 <code>0 0</code>.
Junio C Hamanofbe00522006-10-19 05:58:48952</p>
953</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59954<dt class="hdlist1">
Junio C Hamano7d23f5e2006-12-16 07:44:04955--shortstat
956</dt>
957<dd>
958<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53959 Output only the last line of the <code>--stat</code> format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:04960 number of modified files, as well as number of added and deleted
961 lines.
962</p>
963</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59964<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32965--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03966</dt>
967<dd>
968<p>
Junio C Hamano1c222c52011-05-13 19:55:32969 Output the distribution of relative amount of changes for each
Junio C Hamanoc14e6ad2014-10-31 20:25:53970 sub-directory. The behavior of <code>--dirstat</code> can be customized by
Junio C Hamano1c222c52011-05-13 19:55:32971 passing it a comma separated list of parameters.
Junio C Hamanoc14e6ad2014-10-31 20:25:53972 The defaults are controlled by the <code>diff.dirstat</code> configuration
Junio C Hamanoa28a9202012-06-21 07:08:23973 variable (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1c222c52011-05-13 19:55:32974 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:03975</p>
Junio C Hamano9629d4f2012-12-19 00:28:27976<div class="openblock">
977<div class="content">
Junio C Hamano1c222c52011-05-13 19:55:32978<div class="dlist"><dl>
979<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53980<code>changes</code>
Junio C Hamano1c222c52011-05-13 19:55:32981</dt>
982<dd>
983<p>
984 Compute the dirstat numbers by counting the lines that have been
985 removed from the source, or added to the destination. This ignores
986 the amount of pure code movements within a file. In other words,
987 rearranging lines in a file is not counted as much as other changes.
988 This is the default behavior when no parameter is given.
989</p>
Junio C Hamano6a45be92008-04-22 08:19:03990</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59991<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:53992<code>lines</code>
Junio C Hamanoa476efa2008-10-10 15:31:42993</dt>
994<dd>
995<p>
Junio C Hamano1c222c52011-05-13 19:55:32996 Compute the dirstat numbers by doing the regular line-based diff
997 analysis, and summing the removed/added line counts. (For binary
998 files, count 64-byte chunks instead, since binary files have no
Junio C Hamanoc14e6ad2014-10-31 20:25:53999 natural concept of lines). This is a more expensive <code>--dirstat</code>
1000 behavior than the <code>changes</code> behavior, but it does count rearranged
Junio C Hamano1c222c52011-05-13 19:55:321001 lines within a file as much as other changes. The resulting output
Junio C Hamanoc14e6ad2014-10-31 20:25:531002 is consistent with what you get from the other <code>--*stat</code> options.
Junio C Hamanoa476efa2008-10-10 15:31:421003</p>
1004</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591005<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531006<code>files</code>
Junio C Hamano1c222c52011-05-13 19:55:321007</dt>
1008<dd>
1009<p>
1010 Compute the dirstat numbers by counting the number of files changed.
1011 Each changed file counts equally in the dirstat analysis. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531012 the computationally cheapest <code>--dirstat</code> behavior, since it does
Junio C Hamano1c222c52011-05-13 19:55:321013 not have to look at the file contents at all.
1014</p>
1015</dd>
1016<dt class="hdlist1">
Junio C Hamanoc14e6ad2014-10-31 20:25:531017<code>cumulative</code>
Junio C Hamano1c222c52011-05-13 19:55:321018</dt>
1019<dd>
1020<p>
1021 Count changes in a child directory for the parent directory as well.
Junio C Hamanoc14e6ad2014-10-31 20:25:531022 Note that when using <code>cumulative</code>, the sum of the percentages
Junio C Hamano1c222c52011-05-13 19:55:321023 reported may exceed 100%. The default (non-cumulative) behavior can
Junio C Hamanoc14e6ad2014-10-31 20:25:531024 be specified with the <code>noncumulative</code> parameter.
Junio C Hamano1c222c52011-05-13 19:55:321025</p>
1026</dd>
1027<dt class="hdlist1">
1028&lt;limit&gt;
1029</dt>
1030<dd>
1031<p>
1032 An integer parameter specifies a cut-off percent (3% by default).
1033 Directories contributing less than this percentage of the changes
1034 are not shown in the output.
1035</p>
1036</dd>
1037</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271038</div></div>
Junio C Hamano1c222c52011-05-13 19:55:321039<div class="paragraph"><p>Example: The following will count changed files, while ignoring
1040directories with less than 10% of the total amount of changed files,
1041and accumulating child directory counts in the parent directories:
Junio C Hamanoc14e6ad2014-10-31 20:25:531042<code>--dirstat=files,10,cumulative</code>.</p></div>
Junio C Hamano1c222c52011-05-13 19:55:321043</dd>
1044<dt class="hdlist1">
Junio C Hamano6959c6c2006-05-17 10:34:111045--summary
1046</dt>
1047<dd>
1048<p>
1049 Output a condensed summary of extended header information
1050 such as creations, renames and mode changes.
1051</p>
1052</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591053<dt class="hdlist1">
Junio C Hamanod1308c92006-04-16 11:01:091054--patch-with-stat
1055</dt>
1056<dd>
1057<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531058 Synonym for <code>-p --stat</code>.
Junio C Hamanod1308c92006-04-16 11:01:091059</p>
1060</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591061<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231062-z
1063</dt>
1064<dd>
1065<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531066 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:341067 given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano1a4e8412005-12-27 08:17:231068</p>
Junio C Hamano68cf15a2010-11-06 01:01:591069<div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
Junio C Hamanoc14e6ad2014-10-31 20:25:531070and backslash characters replaced with <code>\t</code>, <code>\n</code>, <code>\"</code>, and <code>\\</code>,
Junio C Hamano5706e0b2009-11-24 10:54:161071respectively, and the pathname will be enclosed in double quotes if
1072any of those replacements occurred.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231073</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591074<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231075--name-only
1076</dt>
1077<dd>
1078<p>
1079 Show only names of changed files.
1080</p>
1081</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591082<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231083--name-status
1084</dt>
1085<dd>
1086<p>
Junio C Hamanoa9aee782008-04-23 16:09:201087 Show only names and status of changed files. See the description
Junio C Hamanoc14e6ad2014-10-31 20:25:531088 of the <code>--diff-filter</code> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:231089</p>
1090</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591091<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:551092--submodule[=&lt;format&gt;]
1093</dt>
1094<dd>
1095<p>
Junio C Hamanocd451662016-09-13 00:54:091096 Specify how differences in submodules are shown. When specifying
1097 <code>--submodule=short</code> the <em>short</em> format is used. This format just
1098 shows the names of the commits at the beginning and end of the range.
1099 When <code>--submodule</code> or <code>--submodule=log</code> is specified, the <em>log</em>
1100 format is used. This format lists the commits in the range like
1101 <a href="git-submodule.html">git-submodule(1)</a> <code>summary</code> does. When <code>--submodule=diff</code>
1102 is specified, the <em>diff</em> format is used. This format shows an
1103 inline diff of the changes in the submodule contents between the
1104 commit range. Defaults to <code>diff.submodule</code> or the <em>short</em> format
1105 if the config option is unset.
Junio C Hamanoc21ab052009-10-31 04:03:551106</p>
1107</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591108<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:121109--color[=&lt;when&gt;]
Junio C Hamano9ae1a062006-07-10 08:12:341110</dt>
1111<dd>
1112<p>
1113 Show colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531114 <code>--color</code> (i.e. without <em>=&lt;when&gt;</em>) is the same as <code>--color=always</code>.
1115 <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:341116</p>
1117</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591118<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341119--no-color
1120</dt>
1121<dd>
1122<p>
Junio C Hamano5f2627d2011-05-06 20:23:481123 Turn off colored diff.
Junio C Hamanoc14e6ad2014-10-31 20:25:531124 It is the same as <code>--color=never</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341125</p>
1126</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591127<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531128--word-diff[=&lt;mode&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:411129</dt>
1130<dd>
1131<p>
Junio C Hamanocc7636a2010-05-21 14:57:531132 Show a word diff, using the &lt;mode&gt; to delimit changed words.
1133 By default, words are delimited by whitespace; see
Junio C Hamanoc14e6ad2014-10-31 20:25:531134 <code>--word-diff-regex</code> below. The &lt;mode&gt; defaults to <em>plain</em>, and
Junio C Hamanocc7636a2010-05-21 14:57:531135 must be one of:
Junio C Hamano85e45fa2006-08-13 07:47:411136</p>
Junio C Hamano9629d4f2012-12-19 00:28:271137<div class="openblock">
1138<div class="content">
Junio C Hamano68cf15a2010-11-06 01:01:591139<div class="dlist"><dl>
1140<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531141color
1142</dt>
1143<dd>
1144<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531145 Highlight changed words using only colors. Implies <code>--color</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531146</p>
1147</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591148<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531149plain
1150</dt>
1151<dd>
1152<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531153 Show words as <code>[-removed-]</code> and <code>{+added+}</code>. Makes no
Junio C Hamanocc7636a2010-05-21 14:57:531154 attempts to escape the delimiters if they appear in the input,
1155 so the output may be ambiguous.
1156</p>
1157</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591158<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531159porcelain
1160</dt>
1161<dd>
1162<p>
1163 Use a special line-based format intended for script
1164 consumption. Added/removed/unchanged runs are printed in the
Junio C Hamanoc14e6ad2014-10-31 20:25:531165 usual unified diff format, starting with a <code>+</code>/<code>-</code>/` `
Junio C Hamanocc7636a2010-05-21 14:57:531166 character at the beginning of the line and extending to the
1167 end of the line. Newlines in the input are represented by a
Junio C Hamanoc14e6ad2014-10-31 20:25:531168 tilde <code>~</code> on a line of its own.
Junio C Hamanocc7636a2010-05-21 14:57:531169</p>
1170</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591171<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531172none
1173</dt>
1174<dd>
1175<p>
1176 Disable word diff again.
1177</p>
1178</dd>
1179</dl></div>
Junio C Hamano9629d4f2012-12-19 00:28:271180</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591181<div class="paragraph"><p>Note that despite the name of the first mode, color is used to
Junio C Hamanocc7636a2010-05-21 14:57:531182highlight the changed parts in all modes if enabled.</p></div>
1183</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591184<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531185--word-diff-regex=&lt;regex&gt;
1186</dt>
1187<dd>
1188<p>
1189 Use &lt;regex&gt; to decide what a word is, instead of considering
1190 runs of non-whitespace to be a word. Also implies
Junio C Hamanoc14e6ad2014-10-31 20:25:531191 <code>--word-diff</code> unless it was already enabled.
Junio C Hamanocc7636a2010-05-21 14:57:531192</p>
Junio C Hamano68cf15a2010-11-06 01:01:591193<div class="paragraph"><p>Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:021194&lt;regex&gt; is considered a word. Anything between these matches is
1195considered whitespace and ignored(!) for the purposes of finding
Junio C Hamanoc14e6ad2014-10-31 20:25:531196differences. You may want to append <code>|[^[:space:]]</code> to your regular
Junio C Hamano20d47e32009-01-26 06:36:021197expression to make sure that it matches all non-whitespace characters.
1198A match that contains a newline is silently truncated(!) at the
1199newline.</p></div>
Junio C Hamano713eded2015-12-03 00:24:021200<div class="paragraph"><p>For example, <code>--word-diff-regex=.</code> will treat each character as a word
1201and, correspondingly, show differences character by character.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591202<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:241203<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:021204overrides any diff driver or configuration setting. Diff drivers
1205override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:411206</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591207<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:531208--color-words[=&lt;regex&gt;]
1209</dt>
1210<dd>
1211<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531212 Equivalent to <code>--word-diff=color</code> plus (if a regex was
1213 specified) <code>--word-diff-regex=&lt;regex&gt;</code>.
Junio C Hamanocc7636a2010-05-21 14:57:531214</p>
1215</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591216<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341217--no-renames
1218</dt>
1219<dd>
1220<p>
1221 Turn off rename detection, even when the configuration
1222 file gives the default to do so.
1223</p>
1224</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591225<dt class="hdlist1">
Junio C Hamanoa890c4f2007-01-28 10:29:211226--check
1227</dt>
1228<dd>
1229<p>
Junio C Hamano84ea1e42016-04-08 21:53:481230 Warn if changes introduce conflict markers or whitespace errors.
1231 What are considered whitespace errors is controlled by <code>core.whitespace</code>
Junio C Hamano6005bfa2011-06-23 00:51:221232 configuration. By default, trailing whitespaces (including
1233 lines that solely consist of whitespaces) and a space character
1234 that is immediately followed by a tab character inside the
1235 initial indent of the line are considered whitespace errors.
1236 Exits with non-zero status if problems are found. Not compatible
1237 with --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:211238</p>
1239</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591240<dt class="hdlist1">
Junio C Hamano8c5d5942015-06-11 19:37:481241--ws-error-highlight=&lt;kind&gt;
1242</dt>
1243<dd>
1244<p>
1245 Highlight whitespace errors on lines specified by &lt;kind&gt;
1246 in the color specified by <code>color.diff.whitespace</code>. &lt;kind&gt;
1247 is a comma separated list of <code>old</code>, <code>new</code>, <code>context</code>. When
1248 this option is not given, only whitespace errors in <code>new</code>
1249 lines are highlighted. E.g. <code>--ws-error-highlight=new,old</code>
1250 highlights whitespace errors on both deleted and added lines.
1251 <code>all</code> can be used as a short-hand for <code>old,new,context</code>.
Junio C Hamano4a401d52016-10-26 22:24:371252 The <code>diff.wsErrorHighlight</code> configuration variable can be
1253 used to specify the default behaviour.
Junio C Hamano8c5d5942015-06-11 19:37:481254</p>
1255</dd>
1256<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231257--full-index
1258</dt>
1259<dd>
1260<p>
Junio C Hamano5cf43ca2008-08-20 09:14:141261 Instead of the first handful of characters, show the full
1262 pre- and post-image blob object names on the "index"
1263 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:231264</p>
1265</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591266<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:341267--binary
1268</dt>
1269<dd>
1270<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531271 In addition to <code>--full-index</code>, output a binary diff that
1272 can be applied with <code>git-apply</code>.
Junio C Hamano9ae1a062006-07-10 08:12:341273</p>
1274</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591275<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231276--abbrev[=&lt;n&gt;]
1277</dt>
1278<dd>
1279<p>
1280 Instead of showing the full 40-byte hexadecimal object
1281 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:561282 lines, show only a partial prefix. This is
Junio C Hamanoc14e6ad2014-10-31 20:25:531283 independent of the <code>--full-index</code> option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:231284 the diff-patch output format. Non default number of
Junio C Hamanoc14e6ad2014-10-31 20:25:531285 digits can be specified with <code>--abbrev=&lt;n&gt;</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231286</p>
1287</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591288<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141289-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231290</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591291<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541292--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1293</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231294<dd>
1295<p>
Junio C Hamanoe85e36f2010-08-10 05:30:141296 Break complete rewrite changes into pairs of delete and
1297 create. This serves two purposes:
Junio C Hamano1a4e8412005-12-27 08:17:231298</p>
Junio C Hamano68cf15a2010-11-06 01:01:591299<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:141300not as a series of deletion and insertion mixed together with a very
1301few lines that happen to match textually as the context, but as a
1302single deletion of everything old followed by a single insertion of
Junio C Hamanoc14e6ad2014-10-31 20:25:531303everything new, and the number <code>m</code> controls this aspect of the -B
1304option (defaults to 60%). <code>-B/70%</code> specifies that less than 30% of the
Junio C Hamano076ffcc2013-02-06 05:13:211305original should remain in the result for Git to consider it a total
Junio C Hamanoe85e36f2010-08-10 05:30:141306rewrite (i.e. otherwise the resulting patch will be a series of
1307deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591308<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:141309source of a rename (usually -M only considers a file that disappeared
Junio C Hamanoc14e6ad2014-10-31 20:25:531310as the source of a rename), and the number <code>n</code> controls this aspect of
1311the -B option (defaults to 50%). <code>-B20%</code> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:591312addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:141313eligible for being picked up as a possible source of a rename to
1314another file.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231315</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591316<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141317-M[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231318</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591319<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261320--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541321</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231322<dd>
1323<p>
1324 Detect renames.
Junio C Hamanoc14e6ad2014-10-31 20:25:531325 If <code>n</code> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:141326 index (i.e. amount of addition/deletions compared to the
Junio C Hamanoc14e6ad2014-10-31 20:25:531327 file&#8217;s size). For example, <code>-M90%</code> means Git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:141328 delete/add pair to be a rename if more than 90% of the file
Junio C Hamanoc14e6ad2014-10-31 20:25:531329 hasn&#8217;t changed. Without a <code>%</code> sign, the number is to be read as
1330 a fraction, with a decimal point before it. I.e., <code>-M5</code> becomes
1331 0.5, and is thus the same as <code>-M50%</code>. Similarly, <code>-M05</code> is
1332 the same as <code>-M5%</code>. To limit detection to exact renames, use
1333 <code>-M100%</code>. The default similarity index is 50%.
Junio C Hamano1a4e8412005-12-27 08:17:231334</p>
1335</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591336<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141337-C[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231338</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591339<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261340--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541341</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231342<dd>
1343<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531344 Detect copies as well as renames. See also <code>--find-copies-harder</code>.
1345 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:231346</p>
1347</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591348<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231349--find-copies-harder
1350</dt>
1351<dd>
1352<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531353 For performance reasons, by default, <code>-C</code> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:231354 if the original file of the copy was modified in the same
1355 changeset. This flag makes the command
1356 inspect unmodified files as candidates for the source of
1357 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:141358 projects, so use it with caution. Giving more than one
Junio C Hamanoc14e6ad2014-10-31 20:25:531359 <code>-C</code> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:231360</p>
1361</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591362<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:021363-D
1364</dt>
1365<dt class="hdlist1">
1366--irreversible-delete
1367</dt>
1368<dd>
1369<p>
1370 Omit the preimage for deletes, i.e. print only the header but not
Junio C Hamanoc14e6ad2014-10-31 20:25:531371 the diff between the preimage and <code>/dev/null</code>. The resulting patch
1372 is not meant to be applied with <code>patch</code> or <code>git apply</code>; this is
Junio C Hamanob02377c2011-04-28 22:26:021373 solely for people who want to just concentrate on reviewing the
1374 text after the change. In addition, the output obviously lack
1375 enough information to apply such a patch in reverse, even manually,
1376 hence the name of the option.
1377</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531378<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:021379of a delete/create pair.</p></div>
1380</dd>
1381<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231382-l&lt;num&gt;
1383</dt>
1384<dd>
1385<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531386 The <code>-M</code> and <code>-C</code> options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:231387 is the number of potential rename/copy targets. This
1388 option prevents rename/copy detection from running if
1389 the number of rename/copy targets exceeds the specified
1390 number.
1391</p>
1392</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591393<dt class="hdlist1">
Junio C Hamano982eb112010-11-18 00:53:091394--diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1395</dt>
1396<dd>
1397<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531398 Select only files that are Added (<code>A</code>), Copied (<code>C</code>),
1399 Deleted (<code>D</code>), Modified (<code>M</code>), Renamed (<code>R</code>), have their
1400 type (i.e. regular file, symlink, submodule, &#8230;) changed (<code>T</code>),
1401 are Unmerged (<code>U</code>), are
1402 Unknown (<code>X</code>), or have had their pairing Broken (<code>B</code>).
Junio C Hamano982eb112010-11-18 00:53:091403 Any combination of the filter characters (including none) can be used.
Junio C Hamanoc14e6ad2014-10-31 20:25:531404 When <code>*</code> (All-or-none) is added to the combination, all
Junio C Hamano982eb112010-11-18 00:53:091405 paths are selected if there is any file that matches
1406 other criteria in the comparison; if there is no file
1407 that matches other criteria, nothing is selected.
1408</p>
Junio C Hamanoeed15af2016-07-25 22:49:421409<div class="paragraph"><p>Also, these upper-case letters can be downcased to exclude. E.g.
1410<code>--diff-filter=ad</code> excludes added and deleted paths.</p></div>
Junio C Hamano982eb112010-11-18 00:53:091411</dd>
1412<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231413-S&lt;string&gt;
1414</dt>
1415<dd>
1416<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521417 Look for differences that change the number of occurrences of
1418 the specified string (i.e. addition/deletion) in a file.
1419 Intended for the scripter&#8217;s use.
Junio C Hamano1a4e8412005-12-27 08:17:231420</p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521421<div class="paragraph"><p>It is useful when you&#8217;re looking for an exact block of code (like a
1422struct), and want to know the history of that block since it first
1423came into being: use the feature iteratively to feed the interesting
Junio C Hamanoc14e6ad2014-10-31 20:25:531424block in the preimage back into <code>-S</code>, and keep going until you get the
Junio C Hamanof1f5a7b2013-06-11 22:23:521425very first version of the block.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231426</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591427<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:341428-G&lt;regex&gt;
1429</dt>
1430<dd>
1431<p>
Junio C Hamanof1f5a7b2013-06-11 22:23:521432 Look for differences whose patch text contains added/removed
1433 lines that match &lt;regex&gt;.
Junio C Hamano3b4609d2010-09-30 00:04:341434</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531435<div class="paragraph"><p>To illustrate the difference between <code>-S&lt;regex&gt; --pickaxe-regex</code> and
1436<code>-G&lt;regex&gt;</code>, consider a commit with the following diff in the same
Junio C Hamanof1f5a7b2013-06-11 22:23:521437file:</p></div>
1438<div class="listingblock">
1439<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531440<pre><code>+ return !regexec(regexp, two-&gt;ptr, 1, &amp;regmatch, 0);
Junio C Hamanof1f5a7b2013-06-11 22:23:521441...
Junio C Hamanoc14e6ad2014-10-31 20:25:531442- hit = !regexec(regexp, mf2.ptr, 1, &amp;regmatch, 0);</code></pre>
Junio C Hamanof1f5a7b2013-06-11 22:23:521443</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531444<div class="paragraph"><p>While <code>git log -G"regexec\(regexp"</code> will show this commit, <code>git log
1445-S"regexec\(regexp" --pickaxe-regex</code> will not (because the number of
Junio C Hamanof1f5a7b2013-06-11 22:23:521446occurrences of that string did not change).</p></div>
1447<div class="paragraph"><p>See the <em>pickaxe</em> entry in <a href="gitdiffcore.html">gitdiffcore(7)</a> for more
1448information.</p></div>
Junio C Hamano3b4609d2010-09-30 00:04:341449</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591450<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231451--pickaxe-all
1452</dt>
1453<dd>
1454<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531455 When <code>-S</code> or <code>-G</code> finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:231456 changeset, not just the files that contain the change
1457 in &lt;string&gt;.
1458</p>
1459</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591460<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:281461--pickaxe-regex
1462</dt>
1463<dd>
1464<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531465 Treat the &lt;string&gt; given to <code>-S</code> as an extended POSIX regular
Junio C Hamanof1f5a7b2013-06-11 22:23:521466 expression to match.
Junio C Hamanobfe9e752006-04-05 21:43:281467</p>
1468</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591469<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231470-O&lt;orderfile&gt;
1471</dt>
1472<dd>
1473<p>
1474 Output the patch in the order specified in the
1475 &lt;orderfile&gt;, which has one shell glob pattern per line.
Junio C Hamano322c6242015-03-23 21:32:461476 This overrides the <code>diff.orderFile</code> configuration variable
1477 (see <a href="git-config.html">git-config(1)</a>). To cancel <code>diff.orderFile</code>,
Junio C Hamanoc14e6ad2014-10-31 20:25:531478 use <code>-O/dev/null</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231479</p>
1480</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591481<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231482-R
1483</dt>
1484<dd>
1485<p>
1486 Swap two inputs; that is, show differences from index or
1487 on-disk file to tree contents.
1488</p>
1489</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591490<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441491--relative[=&lt;path&gt;]
1492</dt>
1493<dd>
1494<p>
1495 When run from a subdirectory of the project, it can be
1496 told to exclude changes outside the directory and show
1497 pathnames relative to it with this option. When you are
1498 not in a subdirectory (e.g. in a bare repository), you
1499 can name which subdirectory to make the output relative
1500 to by giving a &lt;path&gt; as an argument.
1501</p>
1502</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591503<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221504-a
1505</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591506<dt class="hdlist1">
Junio C Hamanoc26f5482006-07-09 09:38:141507--text
1508</dt>
1509<dd>
1510<p>
1511 Treat all files as text.
1512</p>
1513</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591514<dt class="hdlist1">
Junio C Hamanofd468962007-02-14 23:45:041515--ignore-space-at-eol
1516</dt>
1517<dd>
1518<p>
Junio C Hamano3a702342007-12-12 21:34:021519 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:041520</p>
1521</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591522<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221523-b
1524</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591525<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071526--ignore-space-change
1527</dt>
1528<dd>
1529<p>
Junio C Hamano3a702342007-12-12 21:34:021530 Ignore changes in amount of whitespace. This ignores whitespace
1531 at line end, and considers all other sequences of one or
1532 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:071533</p>
1534</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591535<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221536-w
Junio C Hamanod9c2d2f2006-12-06 08:59:071537</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591538<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071539--ignore-all-space
1540</dt>
1541<dd>
1542<p>
Junio C Hamano3a702342007-12-12 21:34:021543 Ignore whitespace when comparing lines. This ignores
1544 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:071545 line has none.
1546</p>
1547</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591548<dt class="hdlist1">
Junio C Hamanoa1952302013-07-01 21:31:181549--ignore-blank-lines
1550</dt>
1551<dd>
1552<p>
1553 Ignore changes whose lines are all blank.
1554</p>
1555</dd>
1556<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161557--inter-hunk-context=&lt;lines&gt;
1558</dt>
1559<dd>
1560<p>
1561 Show the context between diff hunks, up to the specified number
1562 of lines, thereby fusing hunks that are close to each other.
1563</p>
1564</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591565<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091566-W
1567</dt>
1568<dt class="hdlist1">
1569--function-context
1570</dt>
1571<dd>
1572<p>
1573 Show whole surrounding functions of changes.
1574</p>
1575</dd>
1576<dt class="hdlist1">
Junio C Hamano48fd2f62007-03-19 02:02:301577--exit-code
1578</dt>
1579<dd>
1580<p>
1581 Make the program exit with codes similar to diff(1).
1582 That is, it exits with 1 if there were differences and
1583 0 means no differences.
1584</p>
1585</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591586<dt class="hdlist1">
Junio C Hamano35e57552007-03-25 07:54:351587--quiet
1588</dt>
1589<dd>
1590<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531591 Disable all output of the program. Implies <code>--exit-code</code>.
Junio C Hamano35e57552007-03-25 07:54:351592</p>
1593</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591594<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401595--ext-diff
1596</dt>
1597<dd>
1598<p>
1599 Allow an external diff helper to be executed. If you set an
Junio C Hamanoa28a9202012-06-21 07:08:231600 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1601 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401602</p>
1603</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591604<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401605--no-ext-diff
1606</dt>
1607<dd>
1608<p>
1609 Disallow external diff drivers.
1610</p>
1611</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591612<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311613--textconv
1614</dt>
1615<dt class="hdlist1">
1616--no-textconv
1617</dt>
1618<dd>
1619<p>
1620 Allow (or disallow) external text conversion filters to be run
Junio C Hamanoa28a9202012-06-21 07:08:231621 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
Junio C Hamanoc652aed2011-07-07 01:14:311622 details. Because textconv filters are typically a one-way
1623 conversion, the resulting diff is suitable for human
1624 consumption, but cannot be applied. For this reason, textconv
Junio C Hamanoa28a9202012-06-21 07:08:231625 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1626 <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:311627 diff plumbing commands.
1628</p>
1629</dd>
1630<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511631--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141632</dt>
1633<dd>
1634<p>
Junio C Hamano7d449522010-07-01 00:08:511635 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamanoc7102962013-05-29 23:57:171636 either "none", "untracked", "dirty" or "all", which is the default.
Junio C Hamano619596a2010-08-18 22:15:351637 Using "none" will consider the submodule modified when it either contains
1638 untracked or modified files or its HEAD differs from the commit recorded
1639 in the superproject and can be used to override any settings of the
Junio C Hamanoa28a9202012-06-21 07:08:231640 <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:511641 "untracked" is used submodules are not considered dirty when they only
1642 contain untracked content (but they are still scanned for modified
1643 content). Using "dirty" ignores all changes to the work tree of submodules,
1644 only changes to the commits stored in the superproject are shown (this was
1645 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141646</p>
1647</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591648<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331649--src-prefix=&lt;prefix&gt;
1650</dt>
1651<dd>
1652<p>
1653 Show the given source prefix instead of "a/".
1654</p>
1655</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591656<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331657--dst-prefix=&lt;prefix&gt;
1658</dt>
1659<dd>
1660<p>
1661 Show the given destination prefix instead of "b/".
1662</p>
1663</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591664<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331665--no-prefix
1666</dt>
1667<dd>
1668<p>
1669 Do not show any source or destination prefix.
1670</p>
1671</dd>
Junio C Hamanocd451662016-09-13 00:54:091672<dt class="hdlist1">
1673--line-prefix=&lt;prefix&gt;
1674</dt>
1675<dd>
1676<p>
1677 Prepend an additional prefix to every line of output.
1678</p>
1679</dd>
Junio C Hamanof7017f12016-10-27 23:31:341680<dt class="hdlist1">
1681--ita-invisible-in-index
1682</dt>
1683<dd>
1684<p>
1685 By default entries added by "git add -N" appear as an existing
1686 empty file in "git diff" and a new file in "git diff --cached".
1687 This option makes the entry appear as a new file in "git diff"
1688 and non-existent in "git diff --cached". This option could be
1689 reverted with <code>--ita-visible-in-index</code>. Both options are
1690 experimental and could be removed in future.
1691</p>
1692</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311693</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591694<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoa28a9202012-06-21 07:08:231695<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591696<div class="dlist"><dl>
1697<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231698&lt;tree-ish&gt;
1699</dt>
1700<dd>
1701<p>
1702 The id of a tree object to diff against.
1703</p>
1704</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591705<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231706--cached
1707</dt>
1708<dd>
1709<p>
1710 do not consider the on-disk file at all
1711</p>
1712</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591713<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231714-m
1715</dt>
1716<dd>
1717<p>
1718 By default, files recorded in the index but not checked
1719 out are reported as deleted. This flag makes
Junio C Hamano1aa40d22010-01-21 17:46:431720 <em>git diff-index</em> say that all non-checked-out files are up
Junio C Hamano1a4e8412005-12-27 08:17:231721 to date.
1722</p>
1723</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311724</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231725</div>
Junio C Hamano9629d4f2012-12-19 00:28:271726</div>
1727<div class="sect1">
Junio C Hamano543f8d62009-07-29 08:35:211728<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231729<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591730<div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:311731"git-diff-files" and "git diff --raw" are very similar.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591732<div class="paragraph"><p>These commands all compare two sets of things; what is
Junio C Hamanoba4b9282008-07-06 05:20:311733compared differs:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591734<div class="dlist"><dl>
1735<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231736git-diff-index &lt;tree-ish&gt;
1737</dt>
1738<dd>
1739<p>
1740 compares the &lt;tree-ish&gt; and the files on the filesystem.
1741</p>
1742</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591743<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231744git-diff-index --cached &lt;tree-ish&gt;
1745</dt>
1746<dd>
1747<p>
1748 compares the &lt;tree-ish&gt; and the index.
1749</p>
1750</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591751<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231752git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1753</dt>
1754<dd>
1755<p>
1756 compares the trees named by the two arguments.
1757</p>
1758</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591759<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231760git-diff-files [&lt;pattern&gt;&#8230;]
1761</dt>
1762<dd>
1763<p>
1764 compares the index and the files on the filesystem.
1765</p>
1766</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311767</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591768<div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
Junio C Hamano543f8d62009-07-29 08:35:211769what is being compared. After that, all the commands print one output
1770line per changed file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591771<div class="paragraph"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231772<div class="listingblock">
1773<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531774<pre><code>in-place edit :100644 100644 bcd1234... 0123456... M file0
Junio C Hamano1a4e8412005-12-27 08:17:231775copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1776rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1777create :000000 100644 0000000... 1234567... A file4
1778delete :100644 000000 1234567... 0000000... D file5
Junio C Hamanoc14e6ad2014-10-31 20:25:531779unmerged :000000 000000 0000000... 0000000... U file6</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231780</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591781<div class="paragraph"><p>That is, from the left to the right:</p></div>
1782<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231783<li>
1784<p>
1785a colon.
1786</p>
1787</li>
1788<li>
1789<p>
1790mode for "src"; 000000 if creation or unmerged.
1791</p>
1792</li>
1793<li>
1794<p>
1795a space.
1796</p>
1797</li>
1798<li>
1799<p>
1800mode for "dst"; 000000 if deletion or unmerged.
1801</p>
1802</li>
1803<li>
1804<p>
1805a space.
1806</p>
1807</li>
1808<li>
1809<p>
1810sha1 for "src"; 0{40} if creation or unmerged.
1811</p>
1812</li>
1813<li>
1814<p>
1815a space.
1816</p>
1817</li>
1818<li>
1819<p>
1820sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1821</p>
1822</li>
1823<li>
1824<p>
1825a space.
1826</p>
1827</li>
1828<li>
1829<p>
1830status, followed by optional "score" number.
1831</p>
1832</li>
1833<li>
1834<p>
Junio C Hamano92d80372016-07-13 22:00:051835a tab or a NUL when <code>-z</code> option is used.
Junio C Hamano1a4e8412005-12-27 08:17:231836</p>
1837</li>
1838<li>
1839<p>
1840path for "src"
1841</p>
1842</li>
1843<li>
1844<p>
Junio C Hamano92d80372016-07-13 22:00:051845a tab or a NUL when <code>-z</code> option is used; only exists for C or R.
Junio C Hamano1a4e8412005-12-27 08:17:231846</p>
1847</li>
1848<li>
1849<p>
1850path for "dst"; only exists for C or R.
1851</p>
1852</li>
1853<li>
1854<p>
Junio C Hamano92d80372016-07-13 22:00:051855an LF or a NUL when <code>-z</code> option is used, to terminate the record.
Junio C Hamano1a4e8412005-12-27 08:17:231856</p>
1857</li>
Junio C Hamanoba4b9282008-07-06 05:20:311858</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591859<div class="paragraph"><p>Possible status letters are:</p></div>
1860<div class="ulist"><ul>
Junio C Hamanoaa17c7c2008-11-03 04:36:581861<li>
1862<p>
1863A: addition of a file
1864</p>
1865</li>
1866<li>
1867<p>
1868C: copy of a file into a new one
1869</p>
1870</li>
1871<li>
1872<p>
1873D: deletion of a file
1874</p>
1875</li>
1876<li>
1877<p>
1878M: modification of the contents or mode of a file
1879</p>
1880</li>
1881<li>
1882<p>
1883R: renaming of a file
1884</p>
1885</li>
1886<li>
1887<p>
1888T: change in the type of the file
1889</p>
1890</li>
1891<li>
1892<p>
1893U: file is unmerged (you must complete the merge before it can
1894be committed)
1895</p>
1896</li>
1897<li>
1898<p>
1899X: "unknown" change type (most probably a bug, please report it)
1900</p>
1901</li>
1902</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591903<div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:581904percentage of similarity between the source and target of the move or
Junio C Hamano6bb32e62015-02-17 22:11:261905copy). Status letter M may be followed by a score (denoting the
1906percentage of dissimilarity) for file rewrites.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591907<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:311908and it is out of sync with the index.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591909<div class="paragraph"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231910<div class="listingblock">
1911<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531912<pre><code>:100644 100644 5be4a4...... 000000...... M file.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231913</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531914<div class="paragraph"><p>When <code>-z</code> option is not used, TAB, LF, and backslash characters
1915in pathnames are represented as <code>\t</code>, <code>\n</code>, and <code>\\</code>,
Junio C Hamanoba4b9282008-07-06 05:20:311916respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231917</div>
Junio C Hamano9629d4f2012-12-19 00:28:271918</div>
1919<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311920<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:121921<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591922<div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano92d80372016-07-13 22:00:051923can take <code>-c</code> or <code>--cc</code> option
Junio C Hamano67fad6d2007-05-06 08:53:121924to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:311925from the format described above in the following way:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591926<div class="olist arabic"><ol class="arabic">
Junio C Hamano67fad6d2007-05-06 08:53:121927<li>
1928<p>
1929there is a colon for each parent
1930</p>
1931</li>
1932<li>
1933<p>
1934there are more "src" modes and "src" sha1
1935</p>
1936</li>
1937<li>
1938<p>
1939status is concatenated status characters for each parent
1940</p>
1941</li>
1942<li>
1943<p>
1944no optional "score" number
1945</p>
1946</li>
1947<li>
1948<p>
1949single path, only for "dst"
1950</p>
1951</li>
Junio C Hamanoba4b9282008-07-06 05:20:311952</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591953<div class="paragraph"><p>Example:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121954<div class="listingblock">
1955<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531956<pre><code>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</code></pre>
Junio C Hamano67fad6d2007-05-06 08:53:121957</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591958<div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
Junio C Hamanoba4b9282008-07-06 05:20:311959all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121960</div>
Junio C Hamano9629d4f2012-12-19 00:28:271961</div>
1962<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311963<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231964<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591965<div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano92d80372016-07-13 22:00:051966with a <code>-p</code> option, "git diff" without the <code>--raw</code> option, or
Junio C Hamano00b8b632007-12-07 09:50:491967"git log" with the "-p" option, they
Junio C Hamano7ae0ab22007-11-03 02:46:461968do not produce the output described above; instead they produce a
1969patch file. You can customize the creation of such patches via the
Junio C Hamano042f2142016-06-27 18:05:051970<code>GIT_EXTERNAL_DIFF</code> and the <code>GIT_DIFF_OPTS</code> environment variables.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591971<div class="paragraph"><p>What the -p option produces is slightly different from the traditional
Junio C Hamano7f9fa862010-10-19 23:51:141972diff format:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591973<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231974<li>
1975<p>
Junio C Hamano7f9fa862010-10-19 23:51:141976It is preceded with a "git diff" header that looks like this:
Junio C Hamano1a4e8412005-12-27 08:17:231977</p>
1978<div class="literalblock">
1979<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531980<pre><code>diff --git a/file1 b/file2</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231981</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531982<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:231983involved. Especially, even for a creation or a deletion,
Junio C Hamanoc14e6ad2014-10-31 20:25:531984<code>/dev/null</code> is <em>not</em> used in place of the <code>a/</code> or <code>b/</code> filenames.</p></div>
1985<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:231986name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:311987the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231988</li>
1989<li>
1990<p>
1991It is followed by one or more extended header lines:
1992</p>
1993<div class="literalblock">
1994<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531995<pre><code>old mode &lt;mode&gt;
Junio C Hamano1a4e8412005-12-27 08:17:231996new mode &lt;mode&gt;
1997deleted file mode &lt;mode&gt;
1998new file mode &lt;mode&gt;
1999copy from &lt;path&gt;
2000copy to &lt;path&gt;
2001rename from &lt;path&gt;
2002rename to &lt;path&gt;
2003similarity index &lt;number&gt;
2004dissimilarity index &lt;number&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532005index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232006</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592007<div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
Junio C Hamano7f9fa862010-10-19 23:51:142008and file permission bits.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532009<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:592010<div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano7f9fa862010-10-19 23:51:142011the dissimilarity index is the percentage of changed lines. It
2012is a rounded down integer, followed by a percent sign. The
2013similarity index value of 100% is thus reserved for two equal
2014files, while 100% dissimilarity means that no line from the old
2015file made it into the new one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592016<div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
Junio C Hamano7f9fa862010-10-19 23:51:142017The &lt;mode&gt; is included if the file mode does not change; otherwise,
2018separate lines indicate the old and the new mode.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232019</li>
2020<li>
2021<p>
Junio C Hamanoa053d542006-10-27 09:29:132022TAB, LF, double quote and backslash characters in pathnames
Junio C Hamanoc14e6ad2014-10-31 20:25:532023 are represented as <code>\t</code>, <code>\n</code>, <code>\"</code> and <code>\\</code>, respectively.
Junio C Hamanoa053d542006-10-27 09:29:132024 If there is need for such substitution then the whole
2025 pathname is put in double quotes.
Junio C Hamano1a4e8412005-12-27 08:17:232026</p>
2027</li>
Junio C Hamano7f9fa862010-10-19 23:51:142028<li>
2029<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:532030All the <code>file1</code> files in the output refer to files before the
2031 commit, and all the <code>file2</code> files refer to files after the commit.
Junio C Hamano7f9fa862010-10-19 23:51:142032 It is incorrect to apply each change to each file sequentially. For
2033 example, this patch will swap a and b:
2034</p>
2035<div class="literalblock">
2036<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532037<pre><code>diff --git a/a b/b
Junio C Hamano7f9fa862010-10-19 23:51:142038rename from a
2039rename to b
2040diff --git a/b b/a
2041rename from b
Junio C Hamanoc14e6ad2014-10-31 20:25:532042rename to a</code></pre>
Junio C Hamano7f9fa862010-10-19 23:51:142043</div></div>
2044</li>
Junio C Hamanoba4b9282008-07-06 05:20:312045</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:232046</div>
Junio C Hamano9629d4f2012-12-19 00:28:272047</div>
2048<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312049<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:192050<div class="sectionbody">
Junio C Hamano1dbca522015-05-22 20:48:552051<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:432052produce a <em>combined diff</em> when showing a merge. This is the default
Junio C Hamanoa28a9202012-06-21 07:08:232053format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
Junio C Hamano1dbca522015-05-22 20:48:552054<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:432055of these commands to force generation of diffs with individual parents
2056of a merge.</p></div>
2057<div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192058<div class="listingblock">
2059<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532060<pre><code>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:292061index fabadb8,cc95eb0..4866510
2062--- a/describe.c
2063+++ b/describe.c
2064@@@ -98,20 -98,12 +98,20 @@@
2065 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:192066 }
2067
2068- static void describe(char *arg)
2069 -static void describe(struct commit *cmit, int last_one)
2070++static void describe(char *arg, int last_one)
2071 {
Junio C Hamano29f14312006-10-26 08:47:292072 + unsigned char sha1[20];
2073 + struct commit *cmit;
2074 struct commit_list *list;
2075 static int initialized = 0;
2076 struct commit_name *n;
2077
2078 + if (get_sha1(arg, sha1) &lt; 0)
2079 + usage(describe_usage);
2080 + cmit = lookup_commit_reference(sha1);
2081 + if (!cmit)
2082 + usage(describe_usage);
2083 +
2084 if (!initialized) {
2085 initialized = 1;
Junio C Hamanoc14e6ad2014-10-31 20:25:532086 for_each_ref(get_name);</code></pre>
Junio C Hamanofb56a962006-01-28 10:38:192087</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592088<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:292089<li>
2090<p>
2091It is preceded with a "git diff" header, that looks like
Junio C Hamano92d80372016-07-13 22:00:052092 this (when <code>-c</code> option is used):
Junio C Hamano29f14312006-10-26 08:47:292093</p>
2094<div class="literalblock">
2095<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532096<pre><code>diff --combined file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292097</div></div>
Junio C Hamano92d80372016-07-13 22:00:052098<div class="paragraph"><p>or like this (when <code>--cc</code> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:292099<div class="literalblock">
2100<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532101<pre><code>diff --cc file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292102</div></div>
2103</li>
2104<li>
2105<p>
2106It is followed by one or more extended header lines
2107 (this example shows a merge with two parents):
2108</p>
2109<div class="literalblock">
2110<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532111<pre><code>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
Junio C Hamano29f14312006-10-26 08:47:292112mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
2113new file mode &lt;mode&gt;
Junio C Hamanoc14e6ad2014-10-31 20:25:532114deleted file mode &lt;mode&gt;,&lt;mode&gt;</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292115</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532116<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:042117the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:292118information about detected contents movement (renames and
2119copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:312120&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292121</li>
2122<li>
2123<p>
2124It is followed by two-line from-file/to-file header
2125</p>
2126<div class="literalblock">
2127<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532128<pre><code>--- a/file
2129+++ b/file</code></pre>
Junio C Hamano29f14312006-10-26 08:47:292130</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592131<div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamanoc14e6ad2014-10-31 20:25:532132format, <code>/dev/null</code> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:312133files.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292134</li>
2135<li>
2136<p>
2137Chunk header format is modified to prevent people from
Junio C Hamanoc14e6ad2014-10-31 20:25:532138 accidentally feeding it to <code>patch -p1</code>. Combined diff format
Junio C Hamano29f14312006-10-26 08:47:292139 was created for review of merge commit changes, and was not
2140 meant for apply. The change is similar to the change in the
2141 extended <em>index</em> header:
2142</p>
2143<div class="literalblock">
2144<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532145<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:292146</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532147<div class="paragraph"><p>There are (number of parents + 1) <code>@</code> characters in the chunk
Junio C Hamanoba4b9282008-07-06 05:20:312148header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:292149</li>
Junio C Hamanoba4b9282008-07-06 05:20:312150</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:592151<div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
Junio C Hamanoc14e6ad2014-10-31 20:25:532152files 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
2153added to B), or <code>" "</code> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:192154compares two or more files file1, file2,&#8230; with one file X, and
2155shows how X differs from each of fileN. One column for each of
Junio C Hamano68cf15a2010-11-06 01:01:592156fileN is prepended to the output line to note how X&#8217;s line is
Junio C Hamanoba4b9282008-07-06 05:20:312157different from it.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532158<div class="paragraph"><p>A <code>-</code> character in the column N means that the line appears in
2159fileN but it does not appear in the result. A <code>+</code> character
Junio C Hamano54bf1e22008-12-20 06:30:112160in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:292161and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:312162added, from the point of view of that parent).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592163<div class="paragraph"><p>In the above example output, the function signature was changed
Junio C Hamanoc14e6ad2014-10-31 20:25:532164from both files (hence two <code>-</code> removals from both file1 and
2165file2, plus <code>++</code> to mean one line that was added does not appear
Junio C Hamanod75148a2014-04-08 19:48:382166in either file1 or file2). Also eight other lines are the same
Junio C Hamanoc14e6ad2014-10-31 20:25:532167from file1 but do not appear in file2 (hence prefixed with <code>+</code>).</p></div>
2168<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:192169merge commit with the merge result (i.e. file1..fileN are the
Junio C Hamanoc14e6ad2014-10-31 20:25:532170parents). When shown by <code>git diff-files -c</code>, it compares the
Junio C Hamanofb56a962006-01-28 10:38:192171two unresolved merge parents with the working tree file
2172(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:312173"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:192174</div>
Junio C Hamano9629d4f2012-12-19 00:28:272175</div>
2176<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312177<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:022178<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:532179<div class="paragraph"><p>The <code>--summary</code> option describes newly added, deleted, renamed and
2180copied files. The <code>--stat</code> option adds diffstat(1) graph to the
Junio C Hamano3a702342007-12-12 21:34:022181output. These options can be combined with other options, such as
Junio C Hamanoc14e6ad2014-10-31 20:25:532182<code>-p</code>, and are meant for human consumption.</p></div>
2183<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:022184formats the pathnames compactly by combining common prefix and suffix of
Junio C Hamanoc14e6ad2014-10-31 20:25:532185the pathnames. For example, a change that moves <code>arch/i386/Makefile</code> to
2186<code>arch/x86/Makefile</code> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022187<div class="listingblock">
2188<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532189<pre><code>arch/{i386 =&gt; x86}/Makefile | 4 +--</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022190</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532191<div class="paragraph"><p>The <code>--numstat</code> option gives the diffstat(1) information but is designed
2192for easier machine consumption. An entry in <code>--numstat</code> output looks
Junio C Hamanoba4b9282008-07-06 05:20:312193like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:022194<div class="listingblock">
2195<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532196<pre><code>1 2 README
21973 1 arch/{i386 =&gt; x86}/Makefile</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022198</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592199<div class="paragraph"><p>That is, from left to right:</p></div>
2200<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022201<li>
2202<p>
2203the number of added lines;
2204</p>
2205</li>
2206<li>
2207<p>
2208a tab;
2209</p>
2210</li>
2211<li>
2212<p>
2213the number of deleted lines;
2214</p>
2215</li>
2216<li>
2217<p>
2218a tab;
2219</p>
2220</li>
2221<li>
2222<p>
2223pathname (possibly with rename/copy information);
2224</p>
2225</li>
2226<li>
2227<p>
2228a newline.
2229</p>
2230</li>
Junio C Hamanoba4b9282008-07-06 05:20:312231</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532232<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:022233<div class="listingblock">
2234<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532235<pre><code>1 2 README NUL
22363 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</code></pre>
Junio C Hamano3a702342007-12-12 21:34:022237</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592238<div class="paragraph"><p>That is:</p></div>
2239<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:022240<li>
2241<p>
2242the number of added lines;
2243</p>
2244</li>
2245<li>
2246<p>
2247a tab;
2248</p>
2249</li>
2250<li>
2251<p>
2252the number of deleted lines;
2253</p>
2254</li>
2255<li>
2256<p>
2257a tab;
2258</p>
2259</li>
2260<li>
2261<p>
2262a NUL (only exists if renamed/copied);
2263</p>
2264</li>
2265<li>
2266<p>
2267pathname in preimage;
2268</p>
2269</li>
2270<li>
2271<p>
2272a NUL (only exists if renamed/copied);
2273</p>
2274</li>
2275<li>
2276<p>
2277pathname in postimage (only exists if renamed/copied);
2278</p>
2279</li>
2280<li>
2281<p>
2282a NUL.
2283</p>
2284</li>
Junio C Hamanoba4b9282008-07-06 05:20:312285</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532286<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:022287scripts that read the output to tell if the current record being read is
2288a single-path record or a rename/copy record without reading ahead.
Junio C Hamanoc14e6ad2014-10-31 20:25:532289After reading added and deleted lines, reading up to <code>NUL</code> would yield
2290the pathname, but if that is <code>NUL</code>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:022291</div>
Junio C Hamano9629d4f2012-12-19 00:28:272292</div>
2293<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312294<h2 id="_operating_modes">Operating Modes</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232295<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592296<div class="paragraph"><p>You can choose whether you want to trust the index file entirely
Junio C Hamano92d80372016-07-13 22:00:052297(using the <code>--cached</code> flag) or ask the diff logic to show any files
Junio C Hamano68cf15a2010-11-06 01:01:592298that don&#8217;t match the stat state as being "tentatively changed". Both
Junio C Hamanoba4b9282008-07-06 05:20:312299of these operations are very useful indeed.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232300</div>
Junio C Hamano9629d4f2012-12-19 00:28:272301</div>
2302<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312303<h2 id="_cached_mode">Cached Mode</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232304<div class="sectionbody">
Junio C Hamano92d80372016-07-13 22:00:052305<div class="paragraph"><p>If <code>--cached</code> is specified, it allows you to ask:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232306<div class="literalblock">
2307<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532308<pre><code>show me the differences between HEAD and the current index
2309contents (the ones I'd write using 'git write-tree')</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232310</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592311<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:582312some files in the index and are ready to commit. You want to see exactly
Junio C Hamanodcc22ee2006-11-03 02:40:132313<strong>what</strong> you are going to commit, without having to write a new tree
Junio C Hamanoba4b9282008-07-06 05:20:312314object and compare it that way, and to do that, you just do</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232315<div class="literalblock">
2316<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532317<pre><code>git diff-index --cached HEAD</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232318</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532319<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
2320done an <code>update-index</code> to make that effective in the index file.
2321<code>git diff-files</code> wouldn&#8217;t show anything at all, since the index file
Junio C Hamano1aa40d22010-01-21 17:46:432322matches my working directory. But doing a <em>git diff-index</em> does:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232323<div class="literalblock">
2324<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532325<pre><code>torvalds@ppc970:~/git&gt; git diff-index --cached HEAD
Junio C Hamano1a4e8412005-12-27 08:17:232326-100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c
Junio C Hamanoc14e6ad2014-10-31 20:25:532327+100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232328</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592329<div class="paragraph"><p>You can see easily that the above is a rename.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532330<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:432331actually doing a <em>git write-tree</em> and comparing that. Except this one is much
Junio C Hamanoba4b9282008-07-06 05:20:312332nicer for the case where you just want to check where you are.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532333<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:232334asking yourself "what have I already marked for being committed, and
Junio C Hamano68cf15a2010-11-06 01:01:592335what&#8217;s the difference to a previous tree".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232336</div>
Junio C Hamano9629d4f2012-12-19 00:28:272337</div>
2338<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312339<h2 id="_non_cached_mode">Non-cached Mode</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232340<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:592341<div class="paragraph"><p>The "non-cached" mode takes a different approach, and is potentially
2342the more useful of the two in that what it does can&#8217;t be emulated with
2343a <em>git write-tree</em> + <em>git diff-tree</em>. Thus that&#8217;s the default mode.
Junio C Hamanoba4b9282008-07-06 05:20:312344The non-cached version asks the question:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232345<div class="literalblock">
2346<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532347<pre><code>show me the differences between HEAD and the currently checked out
2348tree - index contents _and_ files that aren't up-to-date</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232349</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:592350<div class="paragraph"><p>which is obviously a very useful question too, since that tells you what
Junio C Hamano1aa40d22010-01-21 17:46:432351you <strong>could</strong> commit. Again, the output matches the <em>git diff-tree -r</em>
Junio C Hamanoba4b9282008-07-06 05:20:312352output to a tee, but with a twist.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:592353<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:232354a backing store thing for it, and we use the magic "all-zero" sha1 to
Junio C Hamanoc14e6ad2014-10-31 20:25:532355show that. So let&#8217;s say that you have edited <code>kernel/sched.c</code>, but
Junio C Hamano1aa40d22010-01-21 17:46:432356have not actually done a <em>git update-index</em> on it yet - there is no
Junio C Hamanoba4b9282008-07-06 05:20:312357"object" associated with the new state, and you get:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232358<div class="literalblock">
2359<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:532360<pre><code>torvalds@ppc970:~/v2.6/linux&gt; git diff-index --abbrev HEAD
2361:100644 100664 7476bb... 000000... kernel/sched.c</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:232362</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:532363<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:232364not up-to-date and may contain new stuff. The all-zero sha1 means that to
2365get the real diff, you need to look at the object in the working directory
Junio C Hamanoba4b9282008-07-06 05:20:312366directly rather than do an object-to-object diff.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232367<div class="admonitionblock">
2368<table><tr>
2369<td class="icon">
2370<div class="title">Note</div>
2371</td>
Junio C Hamano1aa40d22010-01-21 17:46:432372<td class="content">As with other commands of this type, <em>git diff-index</em> does not
Junio C Hamano1a4e8412005-12-27 08:17:232373actually look at the contents of the file at all. So maybe
Junio C Hamanoc14e6ad2014-10-31 20:25:532374<code>kernel/sched.c</code> hasn&#8217;t actually changed, and it&#8217;s just that you
Junio C Hamano68cf15a2010-11-06 01:01:592375touched it. In either case, it&#8217;s a note that you need to
Junio C Hamano1aa40d22010-01-21 17:46:432376<em>git update-index</em> it to make the index be in sync.</td>
Junio C Hamano1a4e8412005-12-27 08:17:232377</tr></table>
2378</div>
2379<div class="admonitionblock">
2380<table><tr>
2381<td class="icon">
2382<div class="title">Note</div>
2383</td>
2384<td class="content">You can have a mixture of files show up as "has been updated"
2385and "is still dirty in the working directory" together. You can always
2386tell which file is in which state, since the "has been updated" ones
2387show a valid sha1, and the "not in sync with the index" ones will
2388always have the special all-zero sha1.</td>
2389</tr></table>
2390</div>
2391</div>
Junio C Hamano9629d4f2012-12-19 00:28:272392</div>
2393<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:312394<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:232395<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:232396<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:232397</div>
Junio C Hamano7bd050f2011-09-22 06:32:222398</div>
Junio C Hamano9629d4f2012-12-19 00:28:272399</div>
Junio C Hamano7bd050f2011-09-22 06:32:222400<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:232401<div id="footer">
2402<div id="footer-text">
Junio C Hamano92d80372016-07-13 22:00:052403Last updated 2016-07-13 14:58:50 PDT
Junio C Hamano1a4e8412005-12-27 08:17:232404</div>
2405</div>
2406</body>
2407</html>