blob: e572e9c0191479cb505afddff9ddb81dbcef527b [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>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano7bd050f2011-09-22 06:32:226<meta name="generator" content="AsciiDoc 8.5.2" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-diff-files(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamano1a4e8412005-12-27 08:17:2327
28em {
29 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5930 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2331}
32
33strong {
34 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5935 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2336}
37
38tt {
39 color: navy;
40}
41
42h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2354 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano1a4e8412005-12-27 08:17:2362
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano68cf15a2010-11-06 01:01:5977ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano1a4e8412005-12-27 08:17:2381pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2391}
92span#email {
93}
Junio C Hamano68cf15a2010-11-06 01:01:5994span#revnumber, span#revdate, span#revremark {
Junio C Hamano1a4e8412005-12-27 08:17:2395 font-family: sans-serif;
96}
97
98div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano68cf15a2010-11-06 01:01:59114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano1a4e8412005-12-27 08:17:23118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22121 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23129}
130
131div.content { /* Block element content. */
132 padding: 0;
133}
134
135/* Block element titles. */
136div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59137 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
143}
144div.title + * {
145 margin-top: 0;
146}
147
148td div.title:first-child {
149 margin-top: 0.0em;
150}
151div.content div.title:first-child {
152 margin-top: 0.0em;
153}
154div.content + div.title {
155 margin-top: 0.0em;
156}
157
158div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
162}
163
164div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
168}
169
Junio C Hamano7bd050f2011-09-22 06:32:22170div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59173 margin-right: 10%;
Junio C Hamano7bd050f2011-09-22 06:32:22174 border-left: 5px solid #dddddd;
175 color: #777777;
Junio C Hamano1a4e8412005-12-27 08:17:23176}
Junio C Hamano7bd050f2011-09-22 06:32:22177
Junio C Hamano68cf15a2010-11-06 01:01:59178div.quoteblock > div.attribution {
179 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23180 text-align: right;
181}
Junio C Hamano68cf15a2010-11-06 01:01:59182
Junio C Hamano68cf15a2010-11-06 01:01:59183div.verseblock > div.content {
184 white-space: pre;
185}
186div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
189}
190/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31191div.verseblock + div.attribution {
192 text-align: left;
193}
Junio C Hamano1a4e8412005-12-27 08:17:23194
195div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
202}
203div.admonitionblock td.content {
204 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22205 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23206}
207
208div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23211}
212
Junio C Hamano1a4e8412005-12-27 08:17:23213div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23214span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59215a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23216
217dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
220}
221dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59224 font-style: normal;
225 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59228 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23229}
230
231ul, ol {
232 list-style-position: outside;
233}
Junio C Hamano68cf15a2010-11-06 01:01:59234ol.arabic {
235 list-style-type: decimal;
236}
237ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23238 list-style-type: lower-alpha;
239}
Junio C Hamano68cf15a2010-11-06 01:01:59240ol.upperalpha {
241 list-style-type: upper-alpha;
242}
243ol.lowerroman {
244 list-style-type: lower-roman;
245}
246ol.upperroman {
247 list-style-type: upper-roman;
248}
249
250div.compact ul, div.compact ol,
251div.compact p, div.compact p,
252div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
255}
Junio C Hamano1a4e8412005-12-27 08:17:23256
257div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31258 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23259}
Junio C Hamano7bd050f2011-09-22 06:32:22260thead, p.table.header {
Junio C Hamano1a4e8412005-12-27 08:17:23261 font-family: sans-serif;
262 font-weight: bold;
263}
264tfoot {
265 font-weight: bold;
266}
Junio C Hamano68cf15a2010-11-06 01:01:59267td > div.verse {
268 white-space: pre;
269}
270p.table {
271 margin-top: 0;
272}
273/* Because the table frame attribute is overriden by CSS in most browsers. */
274div.tableblock > table[frame="void"] {
275 border-style: none;
276}
277div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
280}
281div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
284}
Junio C Hamano1a4e8412005-12-27 08:17:23285
Junio C Hamano68cf15a2010-11-06 01:01:59286
287div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
290}
Junio C Hamano68cf15a2010-11-06 01:01:59291div.hdlist tr {
292 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31293}
Junio C Hamano68cf15a2010-11-06 01:01:59294dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
296}
297td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23298 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59299 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23300 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59301 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23302}
Junio C Hamano68cf15a2010-11-06 01:01:59303td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23304 vertical-align: top;
305}
Junio C Hamano68cf15a2010-11-06 01:01:59306div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
309}
310
311.comment {
312 background: yellow;
313}
Junio C Hamano1a4e8412005-12-27 08:17:23314
Junio C Hamano7bd050f2011-09-22 06:32:22315.footnote, .footnoteref {
316 font-size: 0.8em;
317}
318
319span.footnote, span.footnoteref {
320 vertical-align: super;
321}
322
323#footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
326}
327
328#footnotes div.footnote {
329 margin: 0 0 5px 0;
330}
331
332#footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
340}
341
342
Junio C Hamano1a4e8412005-12-27 08:17:23343@media print {
344 div#footer-badges { display: none; }
345}
Junio C Hamanoba4b9282008-07-06 05:20:31346
Junio C Hamano7bd050f2011-09-22 06:32:22347div#toc {
348 margin-bottom: 2.5em;
349}
350
Junio C Hamanoba4b9282008-07-06 05:20:31351div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
358}
359
360div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
363}
364div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
367}
368div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
371}
372div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
375}
Junio C Hamano68cf15a2010-11-06 01:01:59376/* Overrides for manpage documents */
377h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
382}
383h2 {
384 border-style: none;
385}
386div.sectionbody {
387 margin-left: 5%;
388}
389
390@media print {
391 div#toc { display: none; }
392}
393
Junio C Hamano1a4e8412005-12-27 08:17:23394/* Workarounds for IE6's broken and incomplete CSS2. */
395
396div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
400}
401div.sidebar-title, div.image-title {
Junio C Hamano68cf15a2010-11-06 01:01:59402 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
407}
408
409div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
413}
414
Junio C Hamano68cf15a2010-11-06 01:01:59415div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
418}
419
420div.verseblock-content {
421 white-space: pre;
422}
423div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
Junio C Hamano1a4e8412005-12-27 08:17:23426}
427
428div.exampleblock-content {
Junio C Hamano7bd050f2011-09-22 06:32:22429 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23430 padding-left: 0.5em;
431}
Junio C Hamanoba4b9282008-07-06 05:20:31432
433/* IE6 sets dynamically generated links as visited. */
434div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23435</style>
Junio C Hamano7bd050f2011-09-22 06:32:22436<script type="text/javascript">
437/*<![CDATA[*/
438window.onload = function(){asciidoc.footnotes();}
439var asciidoc = { // Namespace.
440
441/////////////////////////////////////////////////////////////////////
442// Table Of Contents generator
443/////////////////////////////////////////////////////////////////////
444
445/* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
447 *
448 * Table Of Content generator
449 * Version: 0.4
450 *
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
453 */
454
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
457
458// toclevels = 1..4.
459toc: function (toclevels) {
460
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
468 }
469 return text;
470 }
471
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
476 }
477
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
490 }
491 iterate(i);
492 }
493 }
494 }
495 iterate(el);
496 return result;
497 }
498
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
512 }
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
515},
516
517
518/////////////////////////////////////////////////////////////////////
519// Footnotes generator
520/////////////////////////////////////////////////////////////////////
521
522/* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
524 */
525
526footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
547 }
548 }
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
561 }
562 }
563 }
564}
565
566}
567/*]]>*/
568</script>
Junio C Hamano1a4e8412005-12-27 08:17:23569</head>
570<body>
571<div id="header">
572<h1>
573git-diff-files(1) Manual Page
574</h1>
575<h2>NAME</h2>
576<div class="sectionbody">
577<p>git-diff-files -
578 Compares files in the working tree and the index
579</p>
580</div>
581</div>
Junio C Hamano7bd050f2011-09-22 06:32:22582<div id="content">
Junio C Hamano68cf15a2010-11-06 01:01:59583<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23584<div class="sectionbody">
Junio C Hamano15567bc2011-07-23 00:51:59585<div class="verseblock">
586<div class="verseblock-content"><em>git diff-files</em> [-q] [-0|-1|-2|-3|-c|--cc] [&lt;common diff options&gt;] [&lt;path&gt;&#8230;]</div>
587<div class="verseblock-attribution">
588</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23589</div>
Junio C Hamanoba4b9282008-07-06 05:20:31590<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23591<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59592<div class="paragraph"><p>Compares the files in the working tree and the index. When paths
Junio C Hamano1a4e8412005-12-27 08:17:23593are specified, compares only those named paths. Otherwise all
594entries in the index are compared. The output format is the
Junio C Hamano1aa40d22010-01-21 17:46:43595same as for <em>git diff-index</em> and <em>git diff-tree</em>.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23596</div>
Junio C Hamanoba4b9282008-07-06 05:20:31597<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23598<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59599<div class="dlist"><dl>
600<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23601-p
602</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59603<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22604-u
605</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59606<dt class="hdlist1">
Junio C Hamanoe97d5772010-05-19 08:13:58607--patch
608</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23609<dd>
610<p>
Junio C Hamanoff979792007-11-16 10:11:30611 Generate patch (see section on generating patches).
612
Junio C Hamano1a4e8412005-12-27 08:17:23613</p>
614</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59615<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34616-U&lt;n&gt;
617</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59618<dt class="hdlist1">
Junio C Hamano69361562007-07-26 02:14:34619--unified=&lt;n&gt;
620</dt>
621<dd>
622<p>
623 Generate diffs with &lt;n&gt; lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:37624 the usual three.
625 Implies <tt>-p</tt>.
Junio C Hamano69361562007-07-26 02:14:34626</p>
627</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59628<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34629--raw
630</dt>
631<dd>
632<p>
633 Generate the raw format.
Junio C Hamanoff979792007-11-16 10:11:30634 This is the default.
Junio C Hamano9ae1a062006-07-10 08:12:34635</p>
636</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59637<dt class="hdlist1">
Junio C Hamano54559c82006-04-13 07:45:12638--patch-with-raw
639</dt>
640<dd>
641<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37642 Synonym for <tt>-p --raw</tt>.
Junio C Hamano54559c82006-04-13 07:45:12643</p>
644</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59645<dt class="hdlist1">
Junio C Hamano5a73f302011-10-14 05:58:34646--minimal
647</dt>
648<dd>
649<p>
650 Spend extra time to make sure the smallest possible
651 diff is produced.
652</p>
653</dd>
654<dt class="hdlist1">
Junio C Hamano20d47e32009-01-26 06:36:02655--patience
656</dt>
657<dd>
658<p>
659 Generate a diff using the "patience diff" algorithm.
660</p>
661</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59662<dt class="hdlist1">
Junio C Hamanoaea9e6b2012-03-07 00:17:11663--histogram
664</dt>
665<dd>
666<p>
667 Generate a diff using the "histogram diff" algorithm.
668</p>
669</dd>
670<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32671--stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]
Junio C Hamanoba7c8d82006-04-15 06:17:42672</dt>
673<dd>
674<p>
Junio C Hamanoaea9e6b2012-03-07 00:17:11675 Generate a diffstat. By default, as much space as necessary
676 will be used for the filename part, and the rest for the graph
677 part. Maximum width defaults to terminal width, or 80 columns
Junio C Hamano7f2b3cb2012-06-22 22:42:39678 if not connected to a terminal, and can be overridden by
Junio C Hamanoaea9e6b2012-03-07 00:17:11679 <tt>&lt;width&gt;</tt>. The width of the filename part can be limited by
680 giving another width <tt>&lt;name-width&gt;</tt> after a comma. The width
681 of the graph part can be limited by using
682 <tt>--stat-graph-width=&lt;width&gt;</tt> (affects all commands generating
683 a stat graph) or by setting <tt>diff.statGraphWidth=&lt;width&gt;</tt>
684 (does not affect <tt>git format-patch</tt>).
Junio C Hamano4c4b0122011-06-30 01:19:32685 By giving a third parameter <tt>&lt;count&gt;</tt>, you can limit the
Junio C Hamanob76a6862012-05-02 22:02:46686 output to the first <tt>&lt;count&gt;</tt> lines, followed by <tt>...</tt> if
Junio C Hamanoaea9e6b2012-03-07 00:17:11687 there are more.
Junio C Hamanoba7c8d82006-04-15 06:17:42688</p>
Junio C Hamano4c4b0122011-06-30 01:19:32689<div class="paragraph"><p>These parameters can also be set individually with <tt>--stat-width=&lt;width&gt;</tt>,
690<tt>--stat-name-width=&lt;name-width&gt;</tt> and <tt>--stat-count=&lt;count&gt;</tt>.</p></div>
Junio C Hamanoba7c8d82006-04-15 06:17:42691</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59692<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48693--numstat
694</dt>
695<dd>
696<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37697 Similar to <tt>--stat</tt>, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:48698 deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:43699 abbreviation, to make it more machine friendly. For
700 binary files, outputs two <tt>-</tt> instead of saying
701 <tt>0 0</tt>.
Junio C Hamanofbe00522006-10-19 05:58:48702</p>
703</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59704<dt class="hdlist1">
Junio C Hamano7d23f5e2006-12-16 07:44:04705--shortstat
706</dt>
707<dd>
708<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37709 Output only the last line of the <tt>--stat</tt> format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:04710 number of modified files, as well as number of added and deleted
711 lines.
712</p>
713</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59714<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32715--dirstat[=&lt;param1,param2,&#8230;&gt;]
Junio C Hamano6a45be92008-04-22 08:19:03716</dt>
717<dd>
718<p>
Junio C Hamano1c222c52011-05-13 19:55:32719 Output the distribution of relative amount of changes for each
720 sub-directory. The behavior of <tt>--dirstat</tt> can be customized by
721 passing it a comma separated list of parameters.
722 The defaults are controlled by the <tt>diff.dirstat</tt> configuration
Junio C Hamanoa28a9202012-06-21 07:08:23723 variable (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano1c222c52011-05-13 19:55:32724 The following parameters are available:
Junio C Hamano6a45be92008-04-22 08:19:03725</p>
Junio C Hamano1c222c52011-05-13 19:55:32726<div class="dlist"><dl>
727<dt class="hdlist1">
728<tt>changes</tt>
729</dt>
730<dd>
731<p>
732 Compute the dirstat numbers by counting the lines that have been
733 removed from the source, or added to the destination. This ignores
734 the amount of pure code movements within a file. In other words,
735 rearranging lines in a file is not counted as much as other changes.
736 This is the default behavior when no parameter is given.
737</p>
Junio C Hamano6a45be92008-04-22 08:19:03738</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59739<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32740<tt>lines</tt>
Junio C Hamanoa476efa2008-10-10 15:31:42741</dt>
742<dd>
743<p>
Junio C Hamano1c222c52011-05-13 19:55:32744 Compute the dirstat numbers by doing the regular line-based diff
745 analysis, and summing the removed/added line counts. (For binary
746 files, count 64-byte chunks instead, since binary files have no
747 natural concept of lines). This is a more expensive <tt>--dirstat</tt>
748 behavior than the <tt>changes</tt> behavior, but it does count rearranged
749 lines within a file as much as other changes. The resulting output
750 is consistent with what you get from the other <tt>--*stat</tt> options.
Junio C Hamanoa476efa2008-10-10 15:31:42751</p>
752</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59753<dt class="hdlist1">
Junio C Hamano1c222c52011-05-13 19:55:32754<tt>files</tt>
755</dt>
756<dd>
757<p>
758 Compute the dirstat numbers by counting the number of files changed.
759 Each changed file counts equally in the dirstat analysis. This is
760 the computationally cheapest <tt>--dirstat</tt> behavior, since it does
761 not have to look at the file contents at all.
762</p>
763</dd>
764<dt class="hdlist1">
765<tt>cumulative</tt>
766</dt>
767<dd>
768<p>
769 Count changes in a child directory for the parent directory as well.
770 Note that when using <tt>cumulative</tt>, the sum of the percentages
771 reported may exceed 100%. The default (non-cumulative) behavior can
772 be specified with the <tt>noncumulative</tt> parameter.
773</p>
774</dd>
775<dt class="hdlist1">
776&lt;limit&gt;
777</dt>
778<dd>
779<p>
780 An integer parameter specifies a cut-off percent (3% by default).
781 Directories contributing less than this percentage of the changes
782 are not shown in the output.
783</p>
784</dd>
785</dl></div>
786<div class="paragraph"><p>Example: The following will count changed files, while ignoring
787directories with less than 10% of the total amount of changed files,
788and accumulating child directory counts in the parent directories:
789<tt>--dirstat=files,10,cumulative</tt>.</p></div>
790</dd>
791<dt class="hdlist1">
Junio C Hamano6959c6c2006-05-17 10:34:11792--summary
793</dt>
794<dd>
795<p>
796 Output a condensed summary of extended header information
797 such as creations, renames and mode changes.
798</p>
799</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59800<dt class="hdlist1">
Junio C Hamanod1308c92006-04-16 11:01:09801--patch-with-stat
802</dt>
803<dd>
804<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37805 Synonym for <tt>-p --stat</tt>.
Junio C Hamanod1308c92006-04-16 11:01:09806</p>
807</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59808<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23809-z
810</dt>
811<dd>
812<p>
Junio C Hamano0c053e82010-04-19 06:46:34813 When <tt>--raw</tt>, <tt>--numstat</tt>, <tt>--name-only</tt> or <tt>--name-status</tt> has been
814 given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano1a4e8412005-12-27 08:17:23815</p>
Junio C Hamano68cf15a2010-11-06 01:01:59816<div class="paragraph"><p>Without this option, each pathname output will have TAB, LF, double quotes,
Junio C Hamano5706e0b2009-11-24 10:54:16817and backslash characters replaced with <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt>, and <tt>\\</tt>,
818respectively, and the pathname will be enclosed in double quotes if
819any of those replacements occurred.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23820</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59821<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23822--name-only
823</dt>
824<dd>
825<p>
826 Show only names of changed files.
827</p>
828</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59829<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23830--name-status
831</dt>
832<dd>
833<p>
Junio C Hamanoa9aee782008-04-23 16:09:20834 Show only names and status of changed files. See the description
835 of the <tt>--diff-filter</tt> option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:23836</p>
837</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59838<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55839--submodule[=&lt;format&gt;]
840</dt>
841<dd>
842<p>
Junio C Hamanoe768cc12012-03-16 05:43:05843 Specify how differences in submodules are shown. When <tt>--submodule</tt>
844 or <tt>--submodule=log</tt> is given, the <em>log</em> format is used. This format lists
Junio C Hamanoa28a9202012-06-21 07:08:23845 the commits in the range like <a href="git-submodule.html">git-submodule(1)</a> <tt>summary</tt> does.
Junio C Hamanoe768cc12012-03-16 05:43:05846 Omitting the <tt>--submodule</tt> option or specifying <tt>--submodule=short</tt>,
847 uses the <em>short</em> format. This format just shows the names of the commits
Junio C Hamanob4e58b12012-11-26 03:13:06848 at the beginning and end of the range. Can be tweaked via the
849 <tt>diff.submodule</tt> configuration variable.
Junio C Hamanoc21ab052009-10-31 04:03:55850</p>
851</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59852<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:12853--color[=&lt;when&gt;]
Junio C Hamano9ae1a062006-07-10 08:12:34854</dt>
855<dd>
856<p>
857 Show colored diff.
Junio C Hamano5f2627d2011-05-06 20:23:48858 The value must be <tt>always</tt> (the default for <tt>&lt;when&gt;</tt>), <tt>never</tt>, or <tt>auto</tt>.
859 The default value is <tt>never</tt>.
Junio C Hamano9ae1a062006-07-10 08:12:34860</p>
861</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59862<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34863--no-color
864</dt>
865<dd>
866<p>
Junio C Hamano5f2627d2011-05-06 20:23:48867 Turn off colored diff.
868 It is the same as <tt>--color=never</tt>.
Junio C Hamano9ae1a062006-07-10 08:12:34869</p>
870</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59871<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53872--word-diff[=&lt;mode&gt;]
Junio C Hamano85e45fa2006-08-13 07:47:41873</dt>
874<dd>
875<p>
Junio C Hamanocc7636a2010-05-21 14:57:53876 Show a word diff, using the &lt;mode&gt; to delimit changed words.
877 By default, words are delimited by whitespace; see
878 <tt>--word-diff-regex</tt> below. The &lt;mode&gt; defaults to <em>plain</em>, and
879 must be one of:
Junio C Hamano85e45fa2006-08-13 07:47:41880</p>
Junio C Hamano68cf15a2010-11-06 01:01:59881<div class="dlist"><dl>
882<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53883color
884</dt>
885<dd>
886<p>
887 Highlight changed words using only colors. Implies <tt>--color</tt>.
888</p>
889</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59890<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53891plain
892</dt>
893<dd>
894<p>
Junio C Hamanob76a6862012-05-02 22:02:46895 Show words as <tt>[-removed-]</tt> and <tt>{+added+}</tt>. Makes no
Junio C Hamanocc7636a2010-05-21 14:57:53896 attempts to escape the delimiters if they appear in the input,
897 so the output may be ambiguous.
898</p>
899</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59900<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53901porcelain
902</dt>
903<dd>
904<p>
905 Use a special line-based format intended for script
906 consumption. Added/removed/unchanged runs are printed in the
Junio C Hamano68cf15a2010-11-06 01:01:59907 usual unified diff format, starting with a <tt>+</tt>/<tt>-</tt>/` `
Junio C Hamanocc7636a2010-05-21 14:57:53908 character at the beginning of the line and extending to the
909 end of the line. Newlines in the input are represented by a
910 tilde <tt>~</tt> on a line of its own.
911</p>
912</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59913<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53914none
915</dt>
916<dd>
917<p>
918 Disable word diff again.
919</p>
920</dd>
921</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:59922<div class="paragraph"><p>Note that despite the name of the first mode, color is used to
Junio C Hamanocc7636a2010-05-21 14:57:53923highlight the changed parts in all modes if enabled.</p></div>
924</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59925<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53926--word-diff-regex=&lt;regex&gt;
927</dt>
928<dd>
929<p>
930 Use &lt;regex&gt; to decide what a word is, instead of considering
931 runs of non-whitespace to be a word. Also implies
932 <tt>--word-diff</tt> unless it was already enabled.
933</p>
Junio C Hamano68cf15a2010-11-06 01:01:59934<div class="paragraph"><p>Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:02935&lt;regex&gt; is considered a word. Anything between these matches is
936considered whitespace and ignored(!) for the purposes of finding
937differences. You may want to append <tt>|[^[:space:]]</tt> to your regular
938expression to make sure that it matches all non-whitespace characters.
939A match that contains a newline is silently truncated(!) at the
940newline.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59941<div class="paragraph"><p>The regex can also be set via a diff driver or configuration option, see
Junio C Hamanoa28a9202012-06-21 07:08:23942<a href="gitattributes.html">gitattributes(1)</a> or <a href="git-config.html">git-config(1)</a>. Giving it explicitly
Junio C Hamano20d47e32009-01-26 06:36:02943overrides any diff driver or configuration setting. Diff drivers
944override configuration settings.</p></div>
Junio C Hamano85e45fa2006-08-13 07:47:41945</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59946<dt class="hdlist1">
Junio C Hamanocc7636a2010-05-21 14:57:53947--color-words[=&lt;regex&gt;]
948</dt>
949<dd>
950<p>
951 Equivalent to <tt>--word-diff=color</tt> plus (if a regex was
952 specified) <tt>--word-diff-regex=&lt;regex&gt;</tt>.
953</p>
954</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59955<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34956--no-renames
957</dt>
958<dd>
959<p>
960 Turn off rename detection, even when the configuration
961 file gives the default to do so.
962</p>
963</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59964<dt class="hdlist1">
Junio C Hamanoa890c4f2007-01-28 10:29:21965--check
966</dt>
967<dd>
968<p>
Junio C Hamano6005bfa2011-06-23 00:51:22969 Warn if changes introduce whitespace errors. What are
970 considered whitespace errors is controlled by <tt>core.whitespace</tt>
971 configuration. By default, trailing whitespaces (including
972 lines that solely consist of whitespaces) and a space character
973 that is immediately followed by a tab character inside the
974 initial indent of the line are considered whitespace errors.
975 Exits with non-zero status if problems are found. Not compatible
976 with --exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:21977</p>
978</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59979<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23980--full-index
981</dt>
982<dd>
983<p>
Junio C Hamano5cf43ca2008-08-20 09:14:14984 Instead of the first handful of characters, show the full
985 pre- and post-image blob object names on the "index"
986 line when generating patch format output.
Junio C Hamano1a4e8412005-12-27 08:17:23987</p>
988</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59989<dt class="hdlist1">
Junio C Hamano9ae1a062006-07-10 08:12:34990--binary
991</dt>
992<dd>
993<p>
Junio C Hamano3b70d3c2009-11-21 17:37:37994 In addition to <tt>--full-index</tt>, output a binary diff that
995 can be applied with <tt>git-apply</tt>.
Junio C Hamano9ae1a062006-07-10 08:12:34996</p>
997</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59998<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23999--abbrev[=&lt;n&gt;]
1000</dt>
1001<dd>
1002<p>
1003 Instead of showing the full 40-byte hexadecimal object
1004 name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:561005 lines, show only a partial prefix. This is
Junio C Hamano3b70d3c2009-11-21 17:37:371006 independent of the <tt>--full-index</tt> option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:231007 the diff-patch output format. Non default number of
Junio C Hamano3b70d3c2009-11-21 17:37:371008 digits can be specified with <tt>--abbrev=&lt;n&gt;</tt>.
Junio C Hamano1a4e8412005-12-27 08:17:231009</p>
1010</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591011<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141012-B[&lt;n&gt;][/&lt;m&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231013</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591014<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541015--break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]
1016</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231017<dd>
1018<p>
Junio C Hamanoe85e36f2010-08-10 05:30:141019 Break complete rewrite changes into pairs of delete and
1020 create. This serves two purposes:
Junio C Hamano1a4e8412005-12-27 08:17:231021</p>
Junio C Hamano68cf15a2010-11-06 01:01:591022<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:141023not as a series of deletion and insertion mixed together with a very
1024few lines that happen to match textually as the context, but as a
1025single deletion of everything old followed by a single insertion of
1026everything new, and the number <tt>m</tt> controls this aspect of the -B
1027option (defaults to 60%). <tt>-B/70%</tt> specifies that less than 30% of the
1028original should remain in the result for git to consider it a total
1029rewrite (i.e. otherwise the resulting patch will be a series of
1030deletion and insertion mixed together with context lines).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591031<div class="paragraph"><p>When used with -M, a totally-rewritten file is also considered as the
Junio C Hamanoe85e36f2010-08-10 05:30:141032source of a rename (usually -M only considers a file that disappeared
1033as the source of a rename), and the number <tt>n</tt> controls this aspect of
1034the -B option (defaults to 50%). <tt>-B20%</tt> specifies that a change with
Junio C Hamano68cf15a2010-11-06 01:01:591035addition and deletion compared to 20% or more of the file&#8217;s size are
Junio C Hamanoe85e36f2010-08-10 05:30:141036eligible for being picked up as a possible source of a rename to
1037another file.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231038</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591039<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141040-M[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231041</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591042<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261043--find-renames[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541044</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231045<dd>
1046<p>
1047 Detect renames.
Junio C Hamano5f2627d2011-05-06 20:23:481048 If <tt>n</tt> is specified, it is a threshold on the similarity
Junio C Hamanoe85e36f2010-08-10 05:30:141049 index (i.e. amount of addition/deletions compared to the
Junio C Hamano68cf15a2010-11-06 01:01:591050 file&#8217;s size). For example, <tt>-M90%</tt> means git should consider a
Junio C Hamanoe85e36f2010-08-10 05:30:141051 delete/add pair to be a rename if more than 90% of the file
Junio C Hamano68cf15a2010-11-06 01:01:591052 hasn&#8217;t changed.
Junio C Hamano1a4e8412005-12-27 08:17:231053</p>
1054</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591055<dt class="hdlist1">
Junio C Hamanoe85e36f2010-08-10 05:30:141056-C[&lt;n&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:231057</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591058<dt class="hdlist1">
Junio C Hamano0d75e872010-12-17 06:57:261059--find-copies[=&lt;n&gt;]
Junio C Hamano39c7a692010-10-27 06:08:541060</dt>
Junio C Hamano1a4e8412005-12-27 08:17:231061<dd>
1062<p>
Junio C Hamano16f98872007-06-12 16:09:141063 Detect copies as well as renames. See also <tt>--find-copies-harder</tt>.
Junio C Hamanoe85e36f2010-08-10 05:30:141064 If <tt>n</tt> is specified, it has the same meaning as for <tt>-M&lt;n&gt;</tt>.
Junio C Hamano1a4e8412005-12-27 08:17:231065</p>
1066</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591067<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231068--find-copies-harder
1069</dt>
1070<dd>
1071<p>
Junio C Hamano16f98872007-06-12 16:09:141072 For performance reasons, by default, <tt>-C</tt> option finds copies only
Junio C Hamano1a4e8412005-12-27 08:17:231073 if the original file of the copy was modified in the same
1074 changeset. This flag makes the command
1075 inspect unmodified files as candidates for the source of
1076 copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:141077 projects, so use it with caution. Giving more than one
1078 <tt>-C</tt> option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:231079</p>
1080</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591081<dt class="hdlist1">
Junio C Hamanob02377c2011-04-28 22:26:021082-D
1083</dt>
1084<dt class="hdlist1">
1085--irreversible-delete
1086</dt>
1087<dd>
1088<p>
1089 Omit the preimage for deletes, i.e. print only the header but not
1090 the diff between the preimage and <tt>/dev/null</tt>. The resulting patch
1091 is not meant to be applied with <tt>patch</tt> nor <tt>git apply</tt>; this is
1092 solely for people who want to just concentrate on reviewing the
1093 text after the change. In addition, the output obviously lack
1094 enough information to apply such a patch in reverse, even manually,
1095 hence the name of the option.
1096</p>
1097<div class="paragraph"><p>When used together with <tt>-B</tt>, omit also the preimage in the deletion part
1098of a delete/create pair.</p></div>
1099</dd>
1100<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231101-l&lt;num&gt;
1102</dt>
1103<dd>
1104<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371105 The <tt>-M</tt> and <tt>-C</tt> options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:231106 is the number of potential rename/copy targets. This
1107 option prevents rename/copy detection from running if
1108 the number of rename/copy targets exceeds the specified
1109 number.
1110</p>
1111</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591112<dt class="hdlist1">
Junio C Hamano982eb112010-11-18 00:53:091113--diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]
1114</dt>
1115<dd>
1116<p>
1117 Select only files that are Added (<tt>A</tt>), Copied (<tt>C</tt>),
1118 Deleted (<tt>D</tt>), Modified (<tt>M</tt>), Renamed (<tt>R</tt>), have their
1119 type (i.e. regular file, symlink, submodule, &#8230;) changed (<tt>T</tt>),
1120 are Unmerged (<tt>U</tt>), are
1121 Unknown (<tt>X</tt>), or have had their pairing Broken (<tt>B</tt>).
1122 Any combination of the filter characters (including none) can be used.
1123 When <tt>*</tt> (All-or-none) is added to the combination, all
1124 paths are selected if there is any file that matches
1125 other criteria in the comparison; if there is no file
1126 that matches other criteria, nothing is selected.
1127</p>
1128</dd>
1129<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231130-S&lt;string&gt;
1131</dt>
1132<dd>
1133<p>
Junio C Hamano5217a272009-03-21 00:39:331134 Look for differences that introduce or remove an instance of
1135 &lt;string&gt;. Note that this is different than the string simply
1136 appearing in diff output; see the <em>pickaxe</em> entry in
Junio C Hamanoa28a9202012-06-21 07:08:231137 <a href="gitdiffcore.html">gitdiffcore(7)</a> for more details.
Junio C Hamano1a4e8412005-12-27 08:17:231138</p>
1139</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591140<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:341141-G&lt;regex&gt;
1142</dt>
1143<dd>
1144<p>
1145 Look for differences whose added or removed line matches
1146 the given &lt;regex&gt;.
1147</p>
1148</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591149<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231150--pickaxe-all
1151</dt>
1152<dd>
1153<p>
Junio C Hamano3b4609d2010-09-30 00:04:341154 When <tt>-S</tt> or <tt>-G</tt> finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:231155 changeset, not just the files that contain the change
1156 in &lt;string&gt;.
1157</p>
1158</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591159<dt class="hdlist1">
Junio C Hamanobfe9e752006-04-05 21:43:281160--pickaxe-regex
1161</dt>
1162<dd>
1163<p>
1164 Make the &lt;string&gt; not a plain string but an extended POSIX
1165 regex to match.
1166</p>
1167</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591168<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231169-O&lt;orderfile&gt;
1170</dt>
1171<dd>
1172<p>
1173 Output the patch in the order specified in the
1174 &lt;orderfile&gt;, which has one shell glob pattern per line.
1175</p>
1176</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591177<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231178-R
1179</dt>
1180<dd>
1181<p>
1182 Swap two inputs; that is, show differences from index or
1183 on-disk file to tree contents.
1184</p>
1185</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591186<dt class="hdlist1">
Junio C Hamano24bc09a2008-02-28 00:27:441187--relative[=&lt;path&gt;]
1188</dt>
1189<dd>
1190<p>
1191 When run from a subdirectory of the project, it can be
1192 told to exclude changes outside the directory and show
1193 pathnames relative to it with this option. When you are
1194 not in a subdirectory (e.g. in a bare repository), you
1195 can name which subdirectory to make the output relative
1196 to by giving a &lt;path&gt; as an argument.
1197</p>
1198</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591199<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221200-a
1201</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591202<dt class="hdlist1">
Junio C Hamanoc26f5482006-07-09 09:38:141203--text
1204</dt>
1205<dd>
1206<p>
1207 Treat all files as text.
1208</p>
1209</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591210<dt class="hdlist1">
Junio C Hamanofd468962007-02-14 23:45:041211--ignore-space-at-eol
1212</dt>
1213<dd>
1214<p>
Junio C Hamano3a702342007-12-12 21:34:021215 Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:041216</p>
1217</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591218<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221219-b
1220</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591221<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071222--ignore-space-change
1223</dt>
1224<dd>
1225<p>
Junio C Hamano3a702342007-12-12 21:34:021226 Ignore changes in amount of whitespace. This ignores whitespace
1227 at line end, and considers all other sequences of one or
1228 more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:071229</p>
1230</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591231<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:221232-w
Junio C Hamanod9c2d2f2006-12-06 08:59:071233</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591234<dt class="hdlist1">
Junio C Hamanod9c2d2f2006-12-06 08:59:071235--ignore-all-space
1236</dt>
1237<dd>
1238<p>
Junio C Hamano3a702342007-12-12 21:34:021239 Ignore whitespace when comparing lines. This ignores
1240 differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:071241 line has none.
1242</p>
1243</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591244<dt class="hdlist1">
Junio C Hamano1d40ee82009-01-07 10:14:161245--inter-hunk-context=&lt;lines&gt;
1246</dt>
1247<dd>
1248<p>
1249 Show the context between diff hunks, up to the specified number
1250 of lines, thereby fusing hunks that are close to each other.
1251</p>
1252</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591253<dt class="hdlist1">
Junio C Hamano11821ed2011-10-19 18:42:091254-W
1255</dt>
1256<dt class="hdlist1">
1257--function-context
1258</dt>
1259<dd>
1260<p>
1261 Show whole surrounding functions of changes.
1262</p>
1263</dd>
1264<dt class="hdlist1">
Junio C Hamano48fd2f62007-03-19 02:02:301265--exit-code
1266</dt>
1267<dd>
1268<p>
1269 Make the program exit with codes similar to diff(1).
1270 That is, it exits with 1 if there were differences and
1271 0 means no differences.
1272</p>
1273</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591274<dt class="hdlist1">
Junio C Hamano35e57552007-03-25 07:54:351275--quiet
1276</dt>
1277<dd>
1278<p>
Junio C Hamano3b70d3c2009-11-21 17:37:371279 Disable all output of the program. Implies <tt>--exit-code</tt>.
Junio C Hamano35e57552007-03-25 07:54:351280</p>
1281</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591282<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401283--ext-diff
1284</dt>
1285<dd>
1286<p>
1287 Allow an external diff helper to be executed. If you set an
Junio C Hamanoa28a9202012-06-21 07:08:231288 external diff driver with <a href="gitattributes.html">gitattributes(5)</a>, you need
1289 to use this option with <a href="git-log.html">git-log(1)</a> and friends.
Junio C Hamanobb0f4042007-07-04 06:41:401290</p>
1291</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591292<dt class="hdlist1">
Junio C Hamanobb0f4042007-07-04 06:41:401293--no-ext-diff
1294</dt>
1295<dd>
1296<p>
1297 Disallow external diff drivers.
1298</p>
1299</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591300<dt class="hdlist1">
Junio C Hamanoc652aed2011-07-07 01:14:311301--textconv
1302</dt>
1303<dt class="hdlist1">
1304--no-textconv
1305</dt>
1306<dd>
1307<p>
1308 Allow (or disallow) external text conversion filters to be run
Junio C Hamanoa28a9202012-06-21 07:08:231309 when comparing binary files. See <a href="gitattributes.html">gitattributes(5)</a> for
Junio C Hamanoc652aed2011-07-07 01:14:311310 details. Because textconv filters are typically a one-way
1311 conversion, the resulting diff is suitable for human
1312 consumption, but cannot be applied. For this reason, textconv
Junio C Hamanoa28a9202012-06-21 07:08:231313 filters are enabled by default only for <a href="git-diff.html">git-diff(1)</a> and
1314 <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:311315 diff plumbing commands.
1316</p>
1317</dd>
1318<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:511319--ignore-submodules[=&lt;when&gt;]
Junio C Hamanodfccbb02008-05-26 01:16:141320</dt>
1321<dd>
1322<p>
Junio C Hamano7d449522010-07-01 00:08:511323 Ignore changes to submodules in the diff generation. &lt;when&gt; can be
Junio C Hamano619596a2010-08-18 22:15:351324 either "none", "untracked", "dirty" or "all", which is the default
1325 Using "none" will consider the submodule modified when it either contains
1326 untracked or modified files or its HEAD differs from the commit recorded
1327 in the superproject and can be used to override any settings of the
Junio C Hamanoa28a9202012-06-21 07:08:231328 <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:511329 "untracked" is used submodules are not considered dirty when they only
1330 contain untracked content (but they are still scanned for modified
1331 content). Using "dirty" ignores all changes to the work tree of submodules,
1332 only changes to the commits stored in the superproject are shown (this was
1333 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:141334</p>
1335</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591336<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331337--src-prefix=&lt;prefix&gt;
1338</dt>
1339<dd>
1340<p>
1341 Show the given source prefix instead of "a/".
1342</p>
1343</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591344<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331345--dst-prefix=&lt;prefix&gt;
1346</dt>
1347<dd>
1348<p>
1349 Show the given destination prefix instead of "b/".
1350</p>
1351</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591352<dt class="hdlist1">
Junio C Hamanoe27cbd22007-12-21 17:57:331353--no-prefix
1354</dt>
1355<dd>
1356<p>
1357 Do not show any source or destination prefix.
1358</p>
1359</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311360</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591361<div class="paragraph"><p>For more detailed explanation on these common options, see also
Junio C Hamanoa28a9202012-06-21 07:08:231362<a href="gitdiffcore.html">gitdiffcore(7)</a>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591363<div class="dlist"><dl>
1364<dt class="hdlist1">
Junio C Hamanobd53dbf2009-01-18 18:26:371365-1 --base
1366</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591367<dt class="hdlist1">
Junio C Hamanobd53dbf2009-01-18 18:26:371368-2 --ours
1369</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591370<dt class="hdlist1">
Junio C Hamanobd53dbf2009-01-18 18:26:371371-3 --theirs
1372</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591373<dt class="hdlist1">
Junio C Hamanobd53dbf2009-01-18 18:26:371374-0
Junio C Hamano1a4e8412005-12-27 08:17:231375</dt>
1376<dd>
1377<p>
1378 Diff against the "base" version, "our branch" or "their
1379 branch" respectively. With these options, diffs for
1380 merged entries are not shown.
1381</p>
Junio C Hamano68cf15a2010-11-06 01:01:591382<div class="paragraph"><p>The default is to diff against our branch (-2) and the
Junio C Hamano1a4e8412005-12-27 08:17:231383cleanly resolved paths. The option -0 can be given to
Junio C Hamanoba4b9282008-07-06 05:20:311384omit diff output for unmerged entries and just show "Unmerged".</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231385</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591386<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471387-c
1388</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591389<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471390--cc
Junio C Hamanofb56a962006-01-28 10:38:191391</dt>
1392<dd>
1393<p>
1394 This compares stage 2 (our branch), stage 3 (their
1395 branch) and the working tree file and outputs a combined
1396 diff, similar to the way <em>diff-tree</em> shows a merge
1397 commit with these flags.
1398</p>
1399</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591400<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231401-q
1402</dt>
1403<dd>
1404<p>
Junio C Hamano51c2ab02006-07-09 20:38:541405 Remain silent even on nonexistent files
Junio C Hamano1a4e8412005-12-27 08:17:231406</p>
1407</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311408</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231409</div>
Junio C Hamano543f8d62009-07-29 08:35:211410<h2 id="_raw_output_format">Raw output format</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231411<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591412<div class="paragraph"><p>The raw output format from "git-diff-index", "git-diff-tree",
Junio C Hamanoba4b9282008-07-06 05:20:311413"git-diff-files" and "git diff --raw" are very similar.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591414<div class="paragraph"><p>These commands all compare two sets of things; what is
Junio C Hamanoba4b9282008-07-06 05:20:311415compared differs:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591416<div class="dlist"><dl>
1417<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231418git-diff-index &lt;tree-ish&gt;
1419</dt>
1420<dd>
1421<p>
1422 compares the &lt;tree-ish&gt; and the files on the filesystem.
1423</p>
1424</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591425<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231426git-diff-index --cached &lt;tree-ish&gt;
1427</dt>
1428<dd>
1429<p>
1430 compares the &lt;tree-ish&gt; and the index.
1431</p>
1432</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591433<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231434git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]
1435</dt>
1436<dd>
1437<p>
1438 compares the trees named by the two arguments.
1439</p>
1440</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591441<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231442git-diff-files [&lt;pattern&gt;&#8230;]
1443</dt>
1444<dd>
1445<p>
1446 compares the index and the files on the filesystem.
1447</p>
1448</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311449</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591450<div class="paragraph"><p>The "git-diff-tree" command begins its output by printing the hash of
Junio C Hamano543f8d62009-07-29 08:35:211451what is being compared. After that, all the commands print one output
1452line per changed file.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591453<div class="paragraph"><p>An output line is formatted this way:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231454<div class="listingblock">
1455<div class="content">
1456<pre><tt>in-place edit :100644 100644 bcd1234... 0123456... M file0
1457copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
1458rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
1459create :000000 100644 0000000... 1234567... A file4
1460delete :100644 000000 1234567... 0000000... D file5
1461unmerged :000000 000000 0000000... 0000000... U file6</tt></pre>
1462</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591463<div class="paragraph"><p>That is, from the left to the right:</p></div>
1464<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231465<li>
1466<p>
1467a colon.
1468</p>
1469</li>
1470<li>
1471<p>
1472mode for "src"; 000000 if creation or unmerged.
1473</p>
1474</li>
1475<li>
1476<p>
1477a space.
1478</p>
1479</li>
1480<li>
1481<p>
1482mode for "dst"; 000000 if deletion or unmerged.
1483</p>
1484</li>
1485<li>
1486<p>
1487a space.
1488</p>
1489</li>
1490<li>
1491<p>
1492sha1 for "src"; 0{40} if creation or unmerged.
1493</p>
1494</li>
1495<li>
1496<p>
1497a space.
1498</p>
1499</li>
1500<li>
1501<p>
1502sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".
1503</p>
1504</li>
1505<li>
1506<p>
1507a space.
1508</p>
1509</li>
1510<li>
1511<p>
1512status, followed by optional "score" number.
1513</p>
1514</li>
1515<li>
1516<p>
1517a tab or a NUL when <em>-z</em> option is used.
1518</p>
1519</li>
1520<li>
1521<p>
1522path for "src"
1523</p>
1524</li>
1525<li>
1526<p>
1527a tab or a NUL when <em>-z</em> option is used; only exists for C or R.
1528</p>
1529</li>
1530<li>
1531<p>
1532path for "dst"; only exists for C or R.
1533</p>
1534</li>
1535<li>
1536<p>
1537an LF or a NUL when <em>-z</em> option is used, to terminate the record.
1538</p>
1539</li>
Junio C Hamanoba4b9282008-07-06 05:20:311540</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591541<div class="paragraph"><p>Possible status letters are:</p></div>
1542<div class="ulist"><ul>
Junio C Hamanoaa17c7c2008-11-03 04:36:581543<li>
1544<p>
1545A: addition of a file
1546</p>
1547</li>
1548<li>
1549<p>
1550C: copy of a file into a new one
1551</p>
1552</li>
1553<li>
1554<p>
1555D: deletion of a file
1556</p>
1557</li>
1558<li>
1559<p>
1560M: modification of the contents or mode of a file
1561</p>
1562</li>
1563<li>
1564<p>
1565R: renaming of a file
1566</p>
1567</li>
1568<li>
1569<p>
1570T: change in the type of the file
1571</p>
1572</li>
1573<li>
1574<p>
1575U: file is unmerged (you must complete the merge before it can
1576be committed)
1577</p>
1578</li>
1579<li>
1580<p>
1581X: "unknown" change type (most probably a bug, please report it)
1582</p>
1583</li>
1584</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591585<div class="paragraph"><p>Status letters C and R are always followed by a score (denoting the
Junio C Hamanoaa17c7c2008-11-03 04:36:581586percentage of similarity between the source and target of the move or
1587copy), and are the only ones to be so.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591588<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:311589and it is out of sync with the index.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591590<div class="paragraph"><p>Example:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231591<div class="listingblock">
1592<div class="content">
1593<pre><tt>:100644 100644 5be4a4...... 000000...... M file.c</tt></pre>
1594</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591595<div class="paragraph"><p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
Junio C Hamano1a4e8412005-12-27 08:17:231596in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
Junio C Hamanoba4b9282008-07-06 05:20:311597respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231598</div>
Junio C Hamanoba4b9282008-07-06 05:20:311599<h2 id="_diff_format_for_merges">diff format for merges</h2>
Junio C Hamano67fad6d2007-05-06 08:53:121600<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591601<div class="paragraph"><p>"git-diff-tree", "git-diff-files" and "git-diff --raw"
Junio C Hamano7ae0ab22007-11-03 02:46:461602can take <em>-c</em> or <em>--cc</em> option
Junio C Hamano67fad6d2007-05-06 08:53:121603to generate diff output also for merge commits. The output differs
Junio C Hamanoba4b9282008-07-06 05:20:311604from the format described above in the following way:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591605<div class="olist arabic"><ol class="arabic">
Junio C Hamano67fad6d2007-05-06 08:53:121606<li>
1607<p>
1608there is a colon for each parent
1609</p>
1610</li>
1611<li>
1612<p>
1613there are more "src" modes and "src" sha1
1614</p>
1615</li>
1616<li>
1617<p>
1618status is concatenated status characters for each parent
1619</p>
1620</li>
1621<li>
1622<p>
1623no optional "score" number
1624</p>
1625</li>
1626<li>
1627<p>
1628single path, only for "dst"
1629</p>
1630</li>
Junio C Hamanoba4b9282008-07-06 05:20:311631</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591632<div class="paragraph"><p>Example:</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121633<div class="listingblock">
1634<div class="content">
1635<pre><tt>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c</tt></pre>
1636</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591637<div class="paragraph"><p>Note that <em>combined diff</em> lists only files which were modified from
Junio C Hamanoba4b9282008-07-06 05:20:311638all parents.</p></div>
Junio C Hamano67fad6d2007-05-06 08:53:121639</div>
Junio C Hamanoba4b9282008-07-06 05:20:311640<h2 id="_generating_patches_with_p">Generating patches with -p</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231641<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591642<div class="paragraph"><p>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
Junio C Hamano00b8b632007-12-07 09:50:491643with a <em>-p</em> option, "git diff" without the <em>--raw</em> option, or
1644"git log" with the "-p" option, they
Junio C Hamano7ae0ab22007-11-03 02:46:461645do not produce the output described above; instead they produce a
1646patch file. You can customize the creation of such patches via the
Junio C Hamanoba4b9282008-07-06 05:20:311647GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591648<div class="paragraph"><p>What the -p option produces is slightly different from the traditional
Junio C Hamano7f9fa862010-10-19 23:51:141649diff format:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591650<div class="olist arabic"><ol class="arabic">
Junio C Hamano1a4e8412005-12-27 08:17:231651<li>
1652<p>
Junio C Hamano7f9fa862010-10-19 23:51:141653It is preceded with a "git diff" header that looks like this:
Junio C Hamano1a4e8412005-12-27 08:17:231654</p>
1655<div class="literalblock">
1656<div class="content">
1657<pre><tt>diff --git a/file1 b/file2</tt></pre>
1658</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591659<div class="paragraph"><p>The <tt>a/</tt> and <tt>b/</tt> filenames are the same unless rename/copy is
Junio C Hamano1a4e8412005-12-27 08:17:231660involved. Especially, even for a creation or a deletion,
Junio C Hamano68cf15a2010-11-06 01:01:591661<tt>/dev/null</tt> is <em>not</em> used in place of the <tt>a/</tt> or <tt>b/</tt> filenames.</p></div>
1662<div class="paragraph"><p>When rename/copy is involved, <tt>file1</tt> and <tt>file2</tt> show the
Junio C Hamano1a4e8412005-12-27 08:17:231663name of the source file of the rename/copy and the name of
Junio C Hamanoba4b9282008-07-06 05:20:311664the file that rename/copy produces, respectively.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231665</li>
1666<li>
1667<p>
1668It is followed by one or more extended header lines:
1669</p>
1670<div class="literalblock">
1671<div class="content">
1672<pre><tt>old mode &lt;mode&gt;
1673new mode &lt;mode&gt;
1674deleted file mode &lt;mode&gt;
1675new file mode &lt;mode&gt;
1676copy from &lt;path&gt;
1677copy to &lt;path&gt;
1678rename from &lt;path&gt;
1679rename to &lt;path&gt;
1680similarity index &lt;number&gt;
1681dissimilarity index &lt;number&gt;
1682index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</tt></pre>
1683</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591684<div class="paragraph"><p>File modes are printed as 6-digit octal numbers including the file type
Junio C Hamano7f9fa862010-10-19 23:51:141685and file permission bits.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591686<div class="paragraph"><p>Path names in extended headers do not include the <tt>a/</tt> and <tt>b/</tt> prefixes.</p></div>
1687<div class="paragraph"><p>The similarity index is the percentage of unchanged lines, and
Junio C Hamano7f9fa862010-10-19 23:51:141688the dissimilarity index is the percentage of changed lines. It
1689is a rounded down integer, followed by a percent sign. The
1690similarity index value of 100% is thus reserved for two equal
1691files, while 100% dissimilarity means that no line from the old
1692file made it into the new one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591693<div class="paragraph"><p>The index line includes the SHA-1 checksum before and after the change.
Junio C Hamano7f9fa862010-10-19 23:51:141694The &lt;mode&gt; is included if the file mode does not change; otherwise,
1695separate lines indicate the old and the new mode.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231696</li>
1697<li>
1698<p>
Junio C Hamanoa053d542006-10-27 09:29:131699TAB, LF, double quote and backslash characters in pathnames
1700 are represented as <tt>\t</tt>, <tt>\n</tt>, <tt>\"</tt> and <tt>\\</tt>, respectively.
1701 If there is need for such substitution then the whole
1702 pathname is put in double quotes.
Junio C Hamano1a4e8412005-12-27 08:17:231703</p>
1704</li>
Junio C Hamano7f9fa862010-10-19 23:51:141705<li>
1706<p>
1707All the <tt>file1</tt> files in the output refer to files before the
1708 commit, and all the <tt>file2</tt> files refer to files after the commit.
1709 It is incorrect to apply each change to each file sequentially. For
1710 example, this patch will swap a and b:
1711</p>
1712<div class="literalblock">
1713<div class="content">
1714<pre><tt>diff --git a/a b/b
1715rename from a
1716rename to b
1717diff --git a/b b/a
1718rename from b
1719rename to a</tt></pre>
1720</div></div>
1721</li>
Junio C Hamanoba4b9282008-07-06 05:20:311722</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:231723</div>
Junio C Hamanoba4b9282008-07-06 05:20:311724<h2 id="_combined_diff_format">combined diff format</h2>
Junio C Hamanofb56a962006-01-28 10:38:191725<div class="sectionbody">
Junio C Hamanoc5be4cc2011-03-09 07:20:431726<div class="paragraph"><p>Any diff-generating command can take the &#8216;-c` or <tt>--cc</tt> option to
1727produce a <em>combined diff</em> when showing a merge. This is the default
Junio C Hamanoa28a9202012-06-21 07:08:231728format when showing merges with <a href="git-diff.html">git-diff(1)</a> or
1729<a href="git-show.html">git-show(1)</a>. Note also that you can give the `-m&#8217; option to any
Junio C Hamanoc5be4cc2011-03-09 07:20:431730of these commands to force generation of diffs with individual parents
1731of a merge.</p></div>
1732<div class="paragraph"><p>A <em>combined diff</em> format looks like this:</p></div>
Junio C Hamanofb56a962006-01-28 10:38:191733<div class="listingblock">
1734<div class="content">
1735<pre><tt>diff --combined describe.c
Junio C Hamano29f14312006-10-26 08:47:291736index fabadb8,cc95eb0..4866510
1737--- a/describe.c
1738+++ b/describe.c
1739@@@ -98,20 -98,12 +98,20 @@@
1740 return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;
Junio C Hamanofb56a962006-01-28 10:38:191741 }
1742
1743- static void describe(char *arg)
1744 -static void describe(struct commit *cmit, int last_one)
1745++static void describe(char *arg, int last_one)
1746 {
Junio C Hamano29f14312006-10-26 08:47:291747 + unsigned char sha1[20];
1748 + struct commit *cmit;
1749 struct commit_list *list;
1750 static int initialized = 0;
1751 struct commit_name *n;
1752
1753 + if (get_sha1(arg, sha1) &lt; 0)
1754 + usage(describe_usage);
1755 + cmit = lookup_commit_reference(sha1);
1756 + if (!cmit)
1757 + usage(describe_usage);
1758 +
1759 if (!initialized) {
1760 initialized = 1;
1761 for_each_ref(get_name);</tt></pre>
Junio C Hamanofb56a962006-01-28 10:38:191762</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591763<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:291764<li>
1765<p>
1766It is preceded with a "git diff" header, that looks like
1767 this (when <em>-c</em> option is used):
1768</p>
1769<div class="literalblock">
1770<div class="content">
1771<pre><tt>diff --combined file</tt></pre>
1772</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591773<div class="paragraph"><p>or like this (when <em>--cc</em> option is used):</p></div>
Junio C Hamano29f14312006-10-26 08:47:291774<div class="literalblock">
1775<div class="content">
Junio C Hamano0868a302008-07-22 09:20:441776<pre><tt>diff --cc file</tt></pre>
Junio C Hamano29f14312006-10-26 08:47:291777</div></div>
1778</li>
1779<li>
1780<p>
1781It is followed by one or more extended header lines
1782 (this example shows a merge with two parents):
1783</p>
1784<div class="literalblock">
1785<div class="content">
1786<pre><tt>index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;
1787mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;
1788new file mode &lt;mode&gt;
1789deleted file mode &lt;mode&gt;,&lt;mode&gt;</tt></pre>
1790</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591791<div class="paragraph"><p>The <tt>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</tt> line appears only if at least one of
Junio C Hamanoee1e4282007-02-04 08:32:041792the &lt;mode&gt; is different from the rest. Extended headers with
Junio C Hamano29f14312006-10-26 08:47:291793information about detected contents movement (renames and
1794copying detection) are designed to work with diff of two
Junio C Hamanoba4b9282008-07-06 05:20:311795&lt;tree-ish&gt; and are not used by combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291796</li>
1797<li>
1798<p>
1799It is followed by two-line from-file/to-file header
1800</p>
1801<div class="literalblock">
1802<div class="content">
1803<pre><tt>--- a/file
1804+++ b/file</tt></pre>
1805</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591806<div class="paragraph"><p>Similar to two-line header for traditional <em>unified</em> diff
Junio C Hamano29f14312006-10-26 08:47:291807format, <tt>/dev/null</tt> is used to signal created or deleted
Junio C Hamanoba4b9282008-07-06 05:20:311808files.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291809</li>
1810<li>
1811<p>
1812Chunk header format is modified to prevent people from
1813 accidentally feeding it to <tt>patch -p1</tt>. Combined diff format
1814 was created for review of merge commit changes, and was not
1815 meant for apply. The change is similar to the change in the
1816 extended <em>index</em> header:
1817</p>
1818<div class="literalblock">
1819<div class="content">
1820<pre><tt>@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</tt></pre>
1821</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591822<div class="paragraph"><p>There are (number of parents + 1) <tt>@</tt> characters in the chunk
Junio C Hamanoba4b9282008-07-06 05:20:311823header for combined diff format.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291824</li>
Junio C Hamanoba4b9282008-07-06 05:20:311825</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591826<div class="paragraph"><p>Unlike the traditional <em>unified</em> diff format, which shows two
1827files A and B with a single column that has <tt>-</tt> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <tt>+</tt> (plus&#8201;&#8212;&#8201;missing in A but
1828added to B), or <tt>" "</tt> (space&#8201;&#8212;&#8201;unchanged) prefix, this format
Junio C Hamanofb56a962006-01-28 10:38:191829compares two or more files file1, file2,&#8230; with one file X, and
1830shows how X differs from each of fileN. One column for each of
Junio C Hamano68cf15a2010-11-06 01:01:591831fileN is prepended to the output line to note how X&#8217;s line is
Junio C Hamanoba4b9282008-07-06 05:20:311832different from it.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591833<div class="paragraph"><p>A <tt>-</tt> character in the column N means that the line appears in
Junio C Hamano29f14312006-10-26 08:47:291834fileN but it does not appear in the result. A <tt>+</tt> character
Junio C Hamano54bf1e22008-12-20 06:30:111835in the column N means that the line appears in the result,
Junio C Hamano29f14312006-10-26 08:47:291836and fileN does not have that line (in other words, the line was
Junio C Hamanoba4b9282008-07-06 05:20:311837added, from the point of view of that parent).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591838<div class="paragraph"><p>In the above example output, the function signature was changed
Junio C Hamanofb56a962006-01-28 10:38:191839from both files (hence two <tt>-</tt> removals from both file1 and
Junio C Hamano4604fe52008-09-19 06:37:101840file2, plus <tt>++</tt> to mean one line that was added does not appear
Junio C Hamano54bf1e22008-12-20 06:30:111841in either file1 nor file2). Also eight other lines are the same
Junio C Hamanob76a6862012-05-02 22:02:461842from file1 but do not appear in file2 (hence prefixed with <tt>+</tt>).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591843<div class="paragraph"><p>When shown by <tt>git diff-tree -c</tt>, it compares the parents of a
Junio C Hamanofb56a962006-01-28 10:38:191844merge commit with the merge result (i.e. file1..fileN are the
1845parents). When shown by <tt>git diff-files -c</tt>, it compares the
1846two unresolved merge parents with the working tree file
1847(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
Junio C Hamanoba4b9282008-07-06 05:20:311848"their version").</p></div>
Junio C Hamanofb56a962006-01-28 10:38:191849</div>
Junio C Hamanoba4b9282008-07-06 05:20:311850<h2 id="_other_diff_formats">other diff formats</h2>
Junio C Hamano3a702342007-12-12 21:34:021851<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591852<div class="paragraph"><p>The <tt>--summary</tt> option describes newly added, deleted, renamed and
Junio C Hamano3a702342007-12-12 21:34:021853copied files. The <tt>--stat</tt> option adds diffstat(1) graph to the
1854output. These options can be combined with other options, such as
Junio C Hamanoba4b9282008-07-06 05:20:311855<tt>-p</tt>, and are meant for human consumption.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591856<div class="paragraph"><p>When showing a change that involves a rename or a copy, <tt>--stat</tt> output
Junio C Hamano3a702342007-12-12 21:34:021857formats the pathnames compactly by combining common prefix and suffix of
1858the pathnames. For example, a change that moves <tt>arch/i386/Makefile</tt> to
Junio C Hamanoba4b9282008-07-06 05:20:311859<tt>arch/x86/Makefile</tt> while modifying 4 lines will be shown like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:021860<div class="listingblock">
1861<div class="content">
1862<pre><tt>arch/{i386 =&gt; x86}/Makefile | 4 +--</tt></pre>
1863</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591864<div class="paragraph"><p>The <tt>--numstat</tt> option gives the diffstat(1) information but is designed
Junio C Hamano3a702342007-12-12 21:34:021865for easier machine consumption. An entry in <tt>--numstat</tt> output looks
Junio C Hamanoba4b9282008-07-06 05:20:311866like this:</p></div>
Junio C Hamano3a702342007-12-12 21:34:021867<div class="listingblock">
1868<div class="content">
1869<pre><tt>1 2 README
18703 1 arch/{i386 =&gt; x86}/Makefile</tt></pre>
1871</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591872<div class="paragraph"><p>That is, from left to right:</p></div>
1873<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:021874<li>
1875<p>
1876the number of added lines;
1877</p>
1878</li>
1879<li>
1880<p>
1881a tab;
1882</p>
1883</li>
1884<li>
1885<p>
1886the number of deleted lines;
1887</p>
1888</li>
1889<li>
1890<p>
1891a tab;
1892</p>
1893</li>
1894<li>
1895<p>
1896pathname (possibly with rename/copy information);
1897</p>
1898</li>
1899<li>
1900<p>
1901a newline.
1902</p>
1903</li>
Junio C Hamanoba4b9282008-07-06 05:20:311904</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591905<div class="paragraph"><p>When <tt>-z</tt> output option is in effect, the output is formatted this way:</p></div>
Junio C Hamano3a702342007-12-12 21:34:021906<div class="listingblock">
1907<div class="content">
1908<pre><tt>1 2 README NUL
19093 1 NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</tt></pre>
1910</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591911<div class="paragraph"><p>That is:</p></div>
1912<div class="olist arabic"><ol class="arabic">
Junio C Hamano3a702342007-12-12 21:34:021913<li>
1914<p>
1915the number of added lines;
1916</p>
1917</li>
1918<li>
1919<p>
1920a tab;
1921</p>
1922</li>
1923<li>
1924<p>
1925the number of deleted lines;
1926</p>
1927</li>
1928<li>
1929<p>
1930a tab;
1931</p>
1932</li>
1933<li>
1934<p>
1935a NUL (only exists if renamed/copied);
1936</p>
1937</li>
1938<li>
1939<p>
1940pathname in preimage;
1941</p>
1942</li>
1943<li>
1944<p>
1945a NUL (only exists if renamed/copied);
1946</p>
1947</li>
1948<li>
1949<p>
1950pathname in postimage (only exists if renamed/copied);
1951</p>
1952</li>
1953<li>
1954<p>
1955a NUL.
1956</p>
1957</li>
Junio C Hamanoba4b9282008-07-06 05:20:311958</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591959<div class="paragraph"><p>The extra <tt>NUL</tt> before the preimage path in renamed case is to allow
Junio C Hamano3a702342007-12-12 21:34:021960scripts that read the output to tell if the current record being read is
1961a single-path record or a rename/copy record without reading ahead.
1962After reading added and deleted lines, reading up to <tt>NUL</tt> would yield
Junio C Hamanoba4b9282008-07-06 05:20:311963the pathname, but if that is <tt>NUL</tt>, the record will show two paths.</p></div>
Junio C Hamano3a702342007-12-12 21:34:021964</div>
Junio C Hamanoba4b9282008-07-06 05:20:311965<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231966<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231967<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231968</div>
Junio C Hamano7bd050f2011-09-22 06:32:221969</div>
1970<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231971<div id="footer">
1972<div id="footer-text">
Junio C Hamano02194af2011-11-17 20:33:591973Last updated 2011-11-15 13:45:02 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231974</div>
1975</div>
1976</body>
1977</html>