Update git documentation
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-diff.xml
blob453dd774273082ecb4c0f8736aa9d0094cb6e835
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-diff(1)">\r
5     <title>git-diff(1)</title>\r
6 <indexterm>\r
7 <primary>git-diff(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-diff(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-diff - Show changes between commits, commit and working tree, etc</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-diff(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git diff</emphasis> [options] [&lt;commit&gt;] [--] [&lt;path&gt;&#8230;]\r
17 <emphasis>git diff</emphasis> [options] --cached [&lt;commit&gt;] [--] [&lt;path&gt;&#8230;]\r
18 <emphasis>git diff</emphasis> [options] &lt;commit&gt; &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
19 <emphasis>git diff</emphasis> [options] &lt;blob&gt; &lt;blob&gt;\r
20 <emphasis>git diff</emphasis> [options] [--no-index] [--] &lt;path&gt; &lt;path&gt;</literallayout>\r
21 </blockquote>\r
22 </simplesect>\r
23 <simplesect id="git-diff(1)__description">\r
24 <title>DESCRIPTION</title>\r
25 <simpara>Show changes between the working tree and the index or a tree, changes\r
26 between the index and a tree, changes between two trees, changes between\r
27 two blob objects, or changes between two files on disk.</simpara>\r
28 <variablelist>\r
29 <varlistentry>\r
30 <term>\r
31 <emphasis>git diff</emphasis> [--options] [--] [&lt;path&gt;&#8230;]\r
32 </term>\r
33 <listitem>\r
34 <simpara>\r
35         This form is to view the changes you made relative to\r
36         the index (staging area for the next commit).  In other\r
37         words, the differences are what you <emphasis>could</emphasis> tell Git to\r
38         further add to the index but you still haven't.  You can\r
39         stage these changes by using <xref linkend="git-add(1)" />.\r
40 </simpara>\r
41 </listitem>\r
42 </varlistentry>\r
43 <varlistentry>\r
44 <term>\r
45 <emphasis>git diff</emphasis> --no-index [--options] [--] [&lt;path&gt;&#8230;]\r
46 </term>\r
47 <listitem>\r
48 <simpara>\r
49         This form is to compare the given two paths on the\r
50         filesystem.  You can omit the <emphasis>--no-index</emphasis> option when\r
51         running the command in a working tree controlled by Git and\r
52         at least one of the paths points outside the working tree,\r
53         or when running the command outside a working tree\r
54         controlled by Git.\r
55 </simpara>\r
56 </listitem>\r
57 </varlistentry>\r
58 <varlistentry>\r
59 <term>\r
60 <emphasis>git diff</emphasis> [--options] --cached [&lt;commit&gt;] [--] [&lt;path&gt;&#8230;]\r
61 </term>\r
62 <listitem>\r
63 <simpara>\r
64         This form is to view the changes you staged for the next\r
65         commit relative to the named &lt;commit&gt;.  Typically you\r
66         would want comparison with the latest commit, so if you\r
67         do not give &lt;commit&gt;, it defaults to HEAD.\r
68         If HEAD does not exist (e.g. unborn branches) and\r
69         &lt;commit&gt; is not given, it shows all staged changes.\r
70         --staged is a synonym of --cached.\r
71 </simpara>\r
72 </listitem>\r
73 </varlistentry>\r
74 <varlistentry>\r
75 <term>\r
76 <emphasis>git diff</emphasis> [--options] &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
77 </term>\r
78 <listitem>\r
79 <simpara>\r
80         This form is to view the changes you have in your\r
81         working tree relative to the named &lt;commit&gt;.  You can\r
82         use HEAD to compare it with the latest commit, or a\r
83         branch name to compare with the tip of a different\r
84         branch.\r
85 </simpara>\r
86 </listitem>\r
87 </varlistentry>\r
88 <varlistentry>\r
89 <term>\r
90 <emphasis>git diff</emphasis> [--options] &lt;commit&gt; &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
91 </term>\r
92 <listitem>\r
93 <simpara>\r
94         This is to view the changes between two arbitrary\r
95         &lt;commit&gt;.\r
96 </simpara>\r
97 </listitem>\r
98 </varlistentry>\r
99 <varlistentry>\r
100 <term>\r
101 <emphasis>git diff</emphasis> [--options] &lt;commit&gt;..&lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
102 </term>\r
103 <listitem>\r
104 <simpara>\r
105         This is synonymous to the previous form.  If &lt;commit&gt; on\r
106         one side is omitted, it will have the same effect as\r
107         using HEAD instead.\r
108 </simpara>\r
109 </listitem>\r
110 </varlistentry>\r
111 <varlistentry>\r
112 <term>\r
113 <emphasis>git diff</emphasis> [--options] &lt;commit&gt;...&lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
114 </term>\r
115 <listitem>\r
116 <simpara>\r
117         This form is to view the changes on the branch containing\r
118         and up to the second &lt;commit&gt;, starting at a common ancestor\r
119         of both &lt;commit&gt;.  "git diff A...B" is equivalent to\r
120         "git diff $(git-merge-base A B) B".  You can omit any one\r
121         of &lt;commit&gt;, which has the same effect as using HEAD instead.\r
122 </simpara>\r
123 </listitem>\r
124 </varlistentry>\r
125 </variablelist>\r
126 <simpara>Just in case if you are doing something exotic, it should be\r
127 noted that all of the &lt;commit&gt; in the above description, except\r
128 in the last two forms that use ".." notations, can be any\r
129 &lt;tree&gt;.</simpara>\r
130 <simpara>For a more complete list of ways to spell &lt;commit&gt;, see\r
131 "SPECIFYING REVISIONS" section in <xref linkend="gitrevisions(7)" />.\r
132 However, "diff" is about comparing two <emphasis>endpoints</emphasis>, not ranges,\r
133 and the range notations ("&lt;commit&gt;..&lt;commit&gt;" and\r
134 "&lt;commit&gt;...&lt;commit&gt;") do not mean a range as defined in the\r
135 "SPECIFYING RANGES" section in <xref linkend="gitrevisions(7)" />.</simpara>\r
136 <variablelist>\r
137 <varlistentry>\r
138 <term>\r
139 <emphasis>git diff</emphasis> [options] &lt;blob&gt; &lt;blob&gt;\r
140 </term>\r
141 <listitem>\r
142 <simpara>\r
143         This form is to view the differences between the raw\r
144         contents of two blob objects.\r
145 </simpara>\r
146 </listitem>\r
147 </varlistentry>\r
148 </variablelist>\r
149 </simplesect>\r
150 <simplesect id="git-diff(1)__options">\r
151 <title>OPTIONS</title>\r
152 <variablelist>\r
153 <varlistentry>\r
154 <term>\r
155 -p\r
156 </term>\r
157 <term>\r
158 -u\r
159 </term>\r
160 <term>\r
161 --patch\r
162 </term>\r
163 <listitem>\r
164 <simpara>\r
165         Generate patch (see section on generating patches).\r
166         This is the default.\r
167 </simpara>\r
168 </listitem>\r
169 </varlistentry>\r
170 <varlistentry>\r
171 <term>\r
172 -s\r
173 </term>\r
174 <term>\r
175 --no-patch\r
176 </term>\r
177 <listitem>\r
178 <simpara>\r
179         Suppress diff output. Useful for commands like <emphasis>git show</emphasis> that\r
180         show the patch by default, or to cancel the effect of <emphasis>--patch</emphasis>.\r
181 </simpara>\r
182 </listitem>\r
183 </varlistentry>\r
184 <varlistentry>\r
185 <term>\r
186 -U&lt;n&gt;\r
187 </term>\r
188 <term>\r
189 --unified=&lt;n&gt;\r
190 </term>\r
191 <listitem>\r
192 <simpara>\r
193         Generate diffs with &lt;n&gt; lines of context instead of\r
194         the usual three.\r
195         Implies <emphasis>-p</emphasis>.\r
196 </simpara>\r
197 </listitem>\r
198 </varlistentry>\r
199 <varlistentry>\r
200 <term>\r
201 --raw\r
202 </term>\r
203 <listitem>\r
204 <simpara>\r
205         Generate the diff in raw format.\r
206 </simpara>\r
207 </listitem>\r
208 </varlistentry>\r
209 <varlistentry>\r
210 <term>\r
211 --patch-with-raw\r
212 </term>\r
213 <listitem>\r
214 <simpara>\r
215         Synonym for <emphasis>-p --raw</emphasis>.\r
216 </simpara>\r
217 </listitem>\r
218 </varlistentry>\r
219 <varlistentry>\r
220 <term>\r
221 --minimal\r
222 </term>\r
223 <listitem>\r
224 <simpara>\r
225         Spend extra time to make sure the smallest possible\r
226         diff is produced.\r
227 </simpara>\r
228 </listitem>\r
229 </varlistentry>\r
230 <varlistentry>\r
231 <term>\r
232 --patience\r
233 </term>\r
234 <listitem>\r
235 <simpara>\r
236         Generate a diff using the "patience diff" algorithm.\r
237 </simpara>\r
238 </listitem>\r
239 </varlistentry>\r
240 <varlistentry>\r
241 <term>\r
242 --histogram\r
243 </term>\r
244 <listitem>\r
245 <simpara>\r
246         Generate a diff using the "histogram diff" algorithm.\r
247 </simpara>\r
248 </listitem>\r
249 </varlistentry>\r
250 <varlistentry>\r
251 <term>\r
252 --diff-algorithm={patience|minimal|histogram|myers}\r
253 </term>\r
254 <listitem>\r
255 <simpara>\r
256         Choose a diff algorithm. The variants are as follows:\r
257 </simpara>\r
258 <variablelist>\r
259 <varlistentry>\r
260 <term>\r
261 <emphasis>default</emphasis>, <emphasis>myers</emphasis>\r
262 </term>\r
263 <listitem>\r
264 <simpara>\r
265         The basic greedy diff algorithm. Currently, this is the default.\r
266 </simpara>\r
267 </listitem>\r
268 </varlistentry>\r
269 <varlistentry>\r
270 <term>\r
271 <emphasis>minimal</emphasis>\r
272 </term>\r
273 <listitem>\r
274 <simpara>\r
275         Spend extra time to make sure the smallest possible diff is\r
276         produced.\r
277 </simpara>\r
278 </listitem>\r
279 </varlistentry>\r
280 <varlistentry>\r
281 <term>\r
282 <emphasis>patience</emphasis>\r
283 </term>\r
284 <listitem>\r
285 <simpara>\r
286         Use "patience diff" algorithm when generating patches.\r
287 </simpara>\r
288 </listitem>\r
289 </varlistentry>\r
290 <varlistentry>\r
291 <term>\r
292 <emphasis>histogram</emphasis>\r
293 </term>\r
294 <listitem>\r
295 <simpara>\r
296         This algorithm extends the patience algorithm to "support\r
297         low-occurrence common elements".\r
298 </simpara>\r
299 </listitem>\r
300 </varlistentry>\r
301 </variablelist>\r
302 <simpara>For instance, if you configured diff.algorithm variable to a\r
303 non-default value and want to use the default one, then you\r
304 have to use <emphasis>--diff-algorithm=default</emphasis> option.</simpara>\r
305 </listitem>\r
306 </varlistentry>\r
307 <varlistentry>\r
308 <term>\r
309 --stat[=&lt;width&gt;[,&lt;name-width&gt;[,&lt;count&gt;]]]\r
310 </term>\r
311 <listitem>\r
312 <simpara>\r
313         Generate a diffstat. By default, as much space as necessary\r
314         will be used for the filename part, and the rest for the graph\r
315         part. Maximum width defaults to terminal width, or 80 columns\r
316         if not connected to a terminal, and can be overridden by\r
317         <emphasis>&lt;width&gt;</emphasis>. The width of the filename part can be limited by\r
318         giving another width <emphasis>&lt;name-width&gt;</emphasis> after a comma. The width\r
319         of the graph part can be limited by using\r
320         <emphasis>--stat-graph-width=&lt;width&gt;</emphasis> (affects all commands generating\r
321         a stat graph) or by setting <emphasis>diff.statGraphWidth=&lt;width&gt;</emphasis>\r
322         (does not affect <emphasis>git format-patch</emphasis>).\r
323         By giving a third parameter <emphasis>&lt;count&gt;</emphasis>, you can limit the\r
324         output to the first <emphasis>&lt;count&gt;</emphasis> lines, followed by <emphasis>...</emphasis> if\r
325         there are more.\r
326 </simpara>\r
327 <simpara>These parameters can also be set individually with <emphasis>--stat-width=&lt;width&gt;</emphasis>,\r
328 <emphasis>--stat-name-width=&lt;name-width&gt;</emphasis> and <emphasis>--stat-count=&lt;count&gt;</emphasis>.</simpara>\r
329 </listitem>\r
330 </varlistentry>\r
331 <varlistentry>\r
332 <term>\r
333 --numstat\r
334 </term>\r
335 <listitem>\r
336 <simpara>\r
337         Similar to <emphasis>--stat</emphasis>, but shows number of added and\r
338         deleted lines in decimal notation and pathname without\r
339         abbreviation, to make it more machine friendly.  For\r
340         binary files, outputs two <emphasis>-</emphasis> instead of saying\r
341         <emphasis>0 0</emphasis>.\r
342 </simpara>\r
343 </listitem>\r
344 </varlistentry>\r
345 <varlistentry>\r
346 <term>\r
347 --shortstat\r
348 </term>\r
349 <listitem>\r
350 <simpara>\r
351         Output only the last line of the <emphasis>--stat</emphasis> format containing total\r
352         number of modified files, as well as number of added and deleted\r
353         lines.\r
354 </simpara>\r
355 </listitem>\r
356 </varlistentry>\r
357 <varlistentry>\r
358 <term>\r
359 --dirstat[=&lt;param1,param2,&#8230;&gt;]\r
360 </term>\r
361 <listitem>\r
362 <simpara>\r
363         Output the distribution of relative amount of changes for each\r
364         sub-directory. The behavior of <emphasis>--dirstat</emphasis> can be customized by\r
365         passing it a comma separated list of parameters.\r
366         The defaults are controlled by the <emphasis>diff.dirstat</emphasis> configuration\r
367         variable (see <xref linkend="git-config(1)" />).\r
368         The following parameters are available:\r
369 </simpara>\r
370 <variablelist>\r
371 <varlistentry>\r
372 <term>\r
373 <emphasis>changes</emphasis>\r
374 </term>\r
375 <listitem>\r
376 <simpara>\r
377         Compute the dirstat numbers by counting the lines that have been\r
378         removed from the source, or added to the destination. This ignores\r
379         the amount of pure code movements within a file.  In other words,\r
380         rearranging lines in a file is not counted as much as other changes.\r
381         This is the default behavior when no parameter is given.\r
382 </simpara>\r
383 </listitem>\r
384 </varlistentry>\r
385 <varlistentry>\r
386 <term>\r
387 <emphasis>lines</emphasis>\r
388 </term>\r
389 <listitem>\r
390 <simpara>\r
391         Compute the dirstat numbers by doing the regular line-based diff\r
392         analysis, and summing the removed/added line counts. (For binary\r
393         files, count 64-byte chunks instead, since binary files have no\r
394         natural concept of lines). This is a more expensive <emphasis>--dirstat</emphasis>\r
395         behavior than the <emphasis>changes</emphasis> behavior, but it does count rearranged\r
396         lines within a file as much as other changes. The resulting output\r
397         is consistent with what you get from the other <emphasis>--*stat</emphasis> options.\r
398 </simpara>\r
399 </listitem>\r
400 </varlistentry>\r
401 <varlistentry>\r
402 <term>\r
403 <emphasis>files</emphasis>\r
404 </term>\r
405 <listitem>\r
406 <simpara>\r
407         Compute the dirstat numbers by counting the number of files changed.\r
408         Each changed file counts equally in the dirstat analysis. This is\r
409         the computationally cheapest <emphasis>--dirstat</emphasis> behavior, since it does\r
410         not have to look at the file contents at all.\r
411 </simpara>\r
412 </listitem>\r
413 </varlistentry>\r
414 <varlistentry>\r
415 <term>\r
416 <emphasis>cumulative</emphasis>\r
417 </term>\r
418 <listitem>\r
419 <simpara>\r
420         Count changes in a child directory for the parent directory as well.\r
421         Note that when using <emphasis>cumulative</emphasis>, the sum of the percentages\r
422         reported may exceed 100%. The default (non-cumulative) behavior can\r
423         be specified with the <emphasis>noncumulative</emphasis> parameter.\r
424 </simpara>\r
425 </listitem>\r
426 </varlistentry>\r
427 <varlistentry>\r
428 <term>\r
429 &lt;limit&gt;\r
430 </term>\r
431 <listitem>\r
432 <simpara>\r
433         An integer parameter specifies a cut-off percent (3% by default).\r
434         Directories contributing less than this percentage of the changes\r
435         are not shown in the output.\r
436 </simpara>\r
437 </listitem>\r
438 </varlistentry>\r
439 </variablelist>\r
440 <simpara>Example: The following will count changed files, while ignoring\r
441 directories with less than 10% of the total amount of changed files,\r
442 and accumulating child directory counts in the parent directories:\r
443 <emphasis>--dirstat=files,10,cumulative</emphasis>.</simpara>\r
444 </listitem>\r
445 </varlistentry>\r
446 <varlistentry>\r
447 <term>\r
448 --summary\r
449 </term>\r
450 <listitem>\r
451 <simpara>\r
452         Output a condensed summary of extended header information\r
453         such as creations, renames and mode changes.\r
454 </simpara>\r
455 </listitem>\r
456 </varlistentry>\r
457 <varlistentry>\r
458 <term>\r
459 --patch-with-stat\r
460 </term>\r
461 <listitem>\r
462 <simpara>\r
463         Synonym for <emphasis>-p --stat</emphasis>.\r
464 </simpara>\r
465 </listitem>\r
466 </varlistentry>\r
467 <varlistentry>\r
468 <term>\r
469 -z\r
470 </term>\r
471 <listitem>\r
472 <simpara>\r
473         When <emphasis>--raw</emphasis>, <emphasis>--numstat</emphasis>, <emphasis>--name-only</emphasis> or <emphasis>--name-status</emphasis> has been\r
474         given, do not munge pathnames and use NULs as output field terminators.\r
475 </simpara>\r
476 <simpara>Without this option, each pathname output will have TAB, LF, double quotes,\r
477 and backslash characters replaced with <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, <emphasis>\"</emphasis>, and <emphasis>\\</emphasis>,\r
478 respectively, and the pathname will be enclosed in double quotes if\r
479 any of those replacements occurred.</simpara>\r
480 </listitem>\r
481 </varlistentry>\r
482 <varlistentry>\r
483 <term>\r
484 --name-only\r
485 </term>\r
486 <listitem>\r
487 <simpara>\r
488         Show only names of changed files.\r
489 </simpara>\r
490 </listitem>\r
491 </varlistentry>\r
492 <varlistentry>\r
493 <term>\r
494 --name-status\r
495 </term>\r
496 <listitem>\r
497 <simpara>\r
498         Show only names and status of changed files. See the description\r
499         of the <emphasis>--diff-filter</emphasis> option on what the status letters mean.\r
500 </simpara>\r
501 </listitem>\r
502 </varlistentry>\r
503 <varlistentry>\r
504 <term>\r
505 --submodule[=&lt;format&gt;]\r
506 </term>\r
507 <listitem>\r
508 <simpara>\r
509         Specify how differences in submodules are shown.  When <emphasis>--submodule</emphasis>\r
510         or <emphasis>--submodule=log</emphasis> is given, the <emphasis>log</emphasis> format is used.  This format lists\r
511         the commits in the range like <xref linkend="git-submodule(1)" /> <emphasis>summary</emphasis> does.\r
512         Omitting the <emphasis>--submodule</emphasis> option or specifying <emphasis>--submodule=short</emphasis>,\r
513         uses the <emphasis>short</emphasis> format. This format just shows the names of the commits\r
514         at the beginning and end of the range.  Can be tweaked via the\r
515         <emphasis>diff.submodule</emphasis> configuration variable.\r
516 </simpara>\r
517 </listitem>\r
518 </varlistentry>\r
519 <varlistentry>\r
520 <term>\r
521 --color[=&lt;when&gt;]\r
522 </term>\r
523 <listitem>\r
524 <simpara>\r
525         Show colored diff.\r
526         <emphasis>--color</emphasis> (i.e. without <emphasis>=&lt;when&gt;</emphasis>) is the same as <emphasis>--color=always</emphasis>.\r
527         <emphasis>&lt;when&gt;</emphasis> can be one of <emphasis>always</emphasis>, <emphasis>never</emphasis>, or <emphasis>auto</emphasis>.\r
528         It can be changed by the <emphasis>color.ui</emphasis> and <emphasis>color.diff</emphasis>\r
529         configuration settings.\r
530 </simpara>\r
531 </listitem>\r
532 </varlistentry>\r
533 <varlistentry>\r
534 <term>\r
535 --no-color\r
536 </term>\r
537 <listitem>\r
538 <simpara>\r
539         Turn off colored diff.\r
540         This can be used to override configuration settings.\r
541         It is the same as <emphasis>--color=never</emphasis>.\r
542 </simpara>\r
543 </listitem>\r
544 </varlistentry>\r
545 <varlistentry>\r
546 <term>\r
547 --word-diff[=&lt;mode&gt;]\r
548 </term>\r
549 <listitem>\r
550 <simpara>\r
551         Show a word diff, using the &lt;mode&gt; to delimit changed words.\r
552         By default, words are delimited by whitespace; see\r
553         <emphasis>--word-diff-regex</emphasis> below.  The &lt;mode&gt; defaults to <emphasis>plain</emphasis>, and\r
554         must be one of:\r
555 </simpara>\r
556 <variablelist>\r
557 <varlistentry>\r
558 <term>\r
559 color\r
560 </term>\r
561 <listitem>\r
562 <simpara>\r
563         Highlight changed words using only colors.  Implies <emphasis>--color</emphasis>.\r
564 </simpara>\r
565 </listitem>\r
566 </varlistentry>\r
567 <varlistentry>\r
568 <term>\r
569 plain\r
570 </term>\r
571 <listitem>\r
572 <simpara>\r
573         Show words as <emphasis>[-removed-]</emphasis> and <emphasis>{+added+}</emphasis>.  Makes no\r
574         attempts to escape the delimiters if they appear in the input,\r
575         so the output may be ambiguous.\r
576 </simpara>\r
577 </listitem>\r
578 </varlistentry>\r
579 <varlistentry>\r
580 <term>\r
581 porcelain\r
582 </term>\r
583 <listitem>\r
584 <simpara>\r
585         Use a special line-based format intended for script\r
586         consumption.  Added/removed/unchanged runs are printed in the\r
587         usual unified diff format, starting with a <emphasis>+</emphasis>/<emphasis>-</emphasis>/` `\r
588         character at the beginning of the line and extending to the\r
589         end of the line.  Newlines in the input are represented by a\r
590         tilde <emphasis>~</emphasis> on a line of its own.\r
591 </simpara>\r
592 </listitem>\r
593 </varlistentry>\r
594 <varlistentry>\r
595 <term>\r
596 none\r
597 </term>\r
598 <listitem>\r
599 <simpara>\r
600         Disable word diff again.\r
601 </simpara>\r
602 </listitem>\r
603 </varlistentry>\r
604 </variablelist>\r
605 <simpara>Note that despite the name of the first mode, color is used to\r
606 highlight the changed parts in all modes if enabled.</simpara>\r
607 </listitem>\r
608 </varlistentry>\r
609 <varlistentry>\r
610 <term>\r
611 --word-diff-regex=&lt;regex&gt;\r
612 </term>\r
613 <listitem>\r
614 <simpara>\r
615         Use &lt;regex&gt; to decide what a word is, instead of considering\r
616         runs of non-whitespace to be a word.  Also implies\r
617         <emphasis>--word-diff</emphasis> unless it was already enabled.\r
618 </simpara>\r
619 <simpara>Every non-overlapping match of the\r
620 &lt;regex&gt; is considered a word.  Anything between these matches is\r
621 considered whitespace and ignored(!) for the purposes of finding\r
622 differences.  You may want to append <emphasis>|[^[:space:]]</emphasis> to your regular\r
623 expression to make sure that it matches all non-whitespace characters.\r
624 A match that contains a newline is silently truncated(!) at the\r
625 newline.</simpara>\r
626 <simpara>For example, <emphasis>--word-diff-regex=.</emphasis> will treat each character as a word\r
627 and, correspondingly, show differences character by character.</simpara>\r
628 <simpara>The regex can also be set via a diff driver or configuration option, see\r
629 <xref linkend="gitattributes(1)" /> or <xref linkend="git-config(1)" />.  Giving it explicitly\r
630 overrides any diff driver or configuration setting.  Diff drivers\r
631 override configuration settings.</simpara>\r
632 </listitem>\r
633 </varlistentry>\r
634 <varlistentry>\r
635 <term>\r
636 --color-words[=&lt;regex&gt;]\r
637 </term>\r
638 <listitem>\r
639 <simpara>\r
640         Equivalent to <emphasis>--word-diff=color</emphasis> plus (if a regex was\r
641         specified) <emphasis>--word-diff-regex=&lt;regex&gt;</emphasis>.\r
642 </simpara>\r
643 </listitem>\r
644 </varlistentry>\r
645 <varlistentry>\r
646 <term>\r
647 --no-renames\r
648 </term>\r
649 <listitem>\r
650 <simpara>\r
651         Turn off rename detection, even when the configuration\r
652         file gives the default to do so.\r
653 </simpara>\r
654 </listitem>\r
655 </varlistentry>\r
656 <varlistentry>\r
657 <term>\r
658 --check\r
659 </term>\r
660 <listitem>\r
661 <simpara>\r
662         Warn if changes introduce conflict markers or whitespace errors.\r
663         What are considered whitespace errors is controlled by <emphasis>core.whitespace</emphasis>\r
664         configuration.  By default, trailing whitespaces (including\r
665         lines that solely consist of whitespaces) and a space character\r
666         that is immediately followed by a tab character inside the\r
667         initial indent of the line are considered whitespace errors.\r
668         Exits with non-zero status if problems are found. Not compatible\r
669         with --exit-code.\r
670 </simpara>\r
671 </listitem>\r
672 </varlistentry>\r
673 <varlistentry>\r
674 <term>\r
675 --ws-error-highlight=&lt;kind&gt;\r
676 </term>\r
677 <listitem>\r
678 <simpara>\r
679         Highlight whitespace errors on lines specified by &lt;kind&gt;\r
680         in the color specified by <emphasis>color.diff.whitespace</emphasis>.  &lt;kind&gt;\r
681         is a comma separated list of <emphasis>old</emphasis>, <emphasis>new</emphasis>, <emphasis>context</emphasis>.  When\r
682         this option is not given, only whitespace errors in <emphasis>new</emphasis>\r
683         lines are highlighted.  E.g. <emphasis>--ws-error-highlight=new,old</emphasis>\r
684         highlights whitespace errors on both deleted and added lines.\r
685         <emphasis>all</emphasis> can be used as a short-hand for <emphasis>old,new,context</emphasis>.\r
686 </simpara>\r
687 </listitem>\r
688 </varlistentry>\r
689 <varlistentry>\r
690 <term>\r
691 --full-index\r
692 </term>\r
693 <listitem>\r
694 <simpara>\r
695         Instead of the first handful of characters, show the full\r
696         pre- and post-image blob object names on the "index"\r
697         line when generating patch format output.\r
698 </simpara>\r
699 </listitem>\r
700 </varlistentry>\r
701 <varlistentry>\r
702 <term>\r
703 --binary\r
704 </term>\r
705 <listitem>\r
706 <simpara>\r
707         In addition to <emphasis>--full-index</emphasis>, output a binary diff that\r
708         can be applied with <emphasis>git-apply</emphasis>.\r
709 </simpara>\r
710 </listitem>\r
711 </varlistentry>\r
712 <varlistentry>\r
713 <term>\r
714 --abbrev[=&lt;n&gt;]\r
715 </term>\r
716 <listitem>\r
717 <simpara>\r
718         Instead of showing the full 40-byte hexadecimal object\r
719         name in diff-raw format output and diff-tree header\r
720         lines, show only a partial prefix.  This is\r
721         independent of the <emphasis>--full-index</emphasis> option above, which controls\r
722         the diff-patch output format.  Non default number of\r
723         digits can be specified with <emphasis>--abbrev=&lt;n&gt;</emphasis>.\r
724 </simpara>\r
725 </listitem>\r
726 </varlistentry>\r
727 <varlistentry>\r
728 <term>\r
729 -B[&lt;n&gt;][/&lt;m&gt;]\r
730 </term>\r
731 <term>\r
732 --break-rewrites[=[&lt;n&gt;][/&lt;m&gt;]]\r
733 </term>\r
734 <listitem>\r
735 <simpara>\r
736         Break complete rewrite changes into pairs of delete and\r
737         create. This serves two purposes:\r
738 </simpara>\r
739 <simpara>It affects the way a change that amounts to a total rewrite of a file\r
740 not as a series of deletion and insertion mixed together with a very\r
741 few lines that happen to match textually as the context, but as a\r
742 single deletion of everything old followed by a single insertion of\r
743 everything new, and the number <emphasis>m</emphasis> controls this aspect of the -B\r
744 option (defaults to 60%). <emphasis>-B/70%</emphasis> specifies that less than 30% of the\r
745 original should remain in the result for Git to consider it a total\r
746 rewrite (i.e. otherwise the resulting patch will be a series of\r
747 deletion and insertion mixed together with context lines).</simpara>\r
748 <simpara>When used with -M, a totally-rewritten file is also considered as the\r
749 source of a rename (usually -M only considers a file that disappeared\r
750 as the source of a rename), and the number <emphasis>n</emphasis> controls this aspect of\r
751 the -B option (defaults to 50%). <emphasis>-B20%</emphasis> specifies that a change with\r
752 addition and deletion compared to 20% or more of the file's size are\r
753 eligible for being picked up as a possible source of a rename to\r
754 another file.</simpara>\r
755 </listitem>\r
756 </varlistentry>\r
757 <varlistentry>\r
758 <term>\r
759 -M[&lt;n&gt;]\r
760 </term>\r
761 <term>\r
762 --find-renames[=&lt;n&gt;]\r
763 </term>\r
764 <listitem>\r
765 <simpara>\r
766         Detect renames.\r
767         If <emphasis>n</emphasis> is specified, it is a threshold on the similarity\r
768         index (i.e. amount of addition/deletions compared to the\r
769         file's size). For example, <emphasis>-M90%</emphasis> means Git should consider a\r
770         delete/add pair to be a rename if more than 90% of the file\r
771         hasn't changed.  Without a <emphasis>%</emphasis> sign, the number is to be read as\r
772         a fraction, with a decimal point before it.  I.e., <emphasis>-M5</emphasis> becomes\r
773         0.5, and is thus the same as <emphasis>-M50%</emphasis>.  Similarly, <emphasis>-M05</emphasis> is\r
774         the same as <emphasis>-M5%</emphasis>.  To limit detection to exact renames, use\r
775         <emphasis>-M100%</emphasis>.  The default similarity index is 50%.\r
776 </simpara>\r
777 </listitem>\r
778 </varlistentry>\r
779 <varlistentry>\r
780 <term>\r
781 -C[&lt;n&gt;]\r
782 </term>\r
783 <term>\r
784 --find-copies[=&lt;n&gt;]\r
785 </term>\r
786 <listitem>\r
787 <simpara>\r
788         Detect copies as well as renames.  See also <emphasis>--find-copies-harder</emphasis>.\r
789         If <emphasis>n</emphasis> is specified, it has the same meaning as for <emphasis>-M&lt;n&gt;</emphasis>.\r
790 </simpara>\r
791 </listitem>\r
792 </varlistentry>\r
793 <varlistentry>\r
794 <term>\r
795 --find-copies-harder\r
796 </term>\r
797 <listitem>\r
798 <simpara>\r
799         For performance reasons, by default, <emphasis>-C</emphasis> option finds copies only\r
800         if the original file of the copy was modified in the same\r
801         changeset.  This flag makes the command\r
802         inspect unmodified files as candidates for the source of\r
803         copy.  This is a very expensive operation for large\r
804         projects, so use it with caution.  Giving more than one\r
805         <emphasis>-C</emphasis> option has the same effect.\r
806 </simpara>\r
807 </listitem>\r
808 </varlistentry>\r
809 <varlistentry>\r
810 <term>\r
811 -D\r
812 </term>\r
813 <term>\r
814 --irreversible-delete\r
815 </term>\r
816 <listitem>\r
817 <simpara>\r
818         Omit the preimage for deletes, i.e. print only the header but not\r
819         the diff between the preimage and <emphasis>/dev/null</emphasis>. The resulting patch\r
820         is not meant to be applied with <emphasis>patch</emphasis> or <emphasis>git apply</emphasis>; this is\r
821         solely for people who want to just concentrate on reviewing the\r
822         text after the change. In addition, the output obviously lack\r
823         enough information to apply such a patch in reverse, even manually,\r
824         hence the name of the option.\r
825 </simpara>\r
826 <simpara>When used together with <emphasis>-B</emphasis>, omit also the preimage in the deletion part\r
827 of a delete/create pair.</simpara>\r
828 </listitem>\r
829 </varlistentry>\r
830 <varlistentry>\r
831 <term>\r
832 -l&lt;num&gt;\r
833 </term>\r
834 <listitem>\r
835 <simpara>\r
836         The <emphasis>-M</emphasis> and <emphasis>-C</emphasis> options require O(n^2) processing time where n\r
837         is the number of potential rename/copy targets.  This\r
838         option prevents rename/copy detection from running if\r
839         the number of rename/copy targets exceeds the specified\r
840         number.\r
841 </simpara>\r
842 </listitem>\r
843 </varlistentry>\r
844 <varlistentry>\r
845 <term>\r
846 --diff-filter=[(A|C|D|M|R|T|U|X|B)&#8230;[*]]\r
847 </term>\r
848 <listitem>\r
849 <simpara>\r
850         Select only files that are Added (<emphasis>A</emphasis>), Copied (<emphasis>C</emphasis>),\r
851         Deleted (<emphasis>D</emphasis>), Modified (<emphasis>M</emphasis>), Renamed (<emphasis>R</emphasis>), have their\r
852         type (i.e. regular file, symlink, submodule, &#8230;) changed (<emphasis>T</emphasis>),\r
853         are Unmerged (<emphasis>U</emphasis>), are\r
854         Unknown (<emphasis>X</emphasis>), or have had their pairing Broken (<emphasis>B</emphasis>).\r
855         Any combination of the filter characters (including none) can be used.\r
856         When <emphasis>*</emphasis> (All-or-none) is added to the combination, all\r
857         paths are selected if there is any file that matches\r
858         other criteria in the comparison; if there is no file\r
859         that matches other criteria, nothing is selected.\r
860 </simpara>\r
861 </listitem>\r
862 </varlistentry>\r
863 <varlistentry>\r
864 <term>\r
865 -S&lt;string&gt;\r
866 </term>\r
867 <listitem>\r
868 <simpara>\r
869         Look for differences that change the number of occurrences of\r
870         the specified string (i.e. addition/deletion) in a file.\r
871         Intended for the scripter's use.\r
872 </simpara>\r
873 <simpara>It is useful when you're looking for an exact block of code (like a\r
874 struct), and want to know the history of that block since it first\r
875 came into being: use the feature iteratively to feed the interesting\r
876 block in the preimage back into <emphasis>-S</emphasis>, and keep going until you get the\r
877 very first version of the block.</simpara>\r
878 </listitem>\r
879 </varlistentry>\r
880 <varlistentry>\r
881 <term>\r
882 -G&lt;regex&gt;\r
883 </term>\r
884 <listitem>\r
885 <simpara>\r
886         Look for differences whose patch text contains added/removed\r
887         lines that match &lt;regex&gt;.\r
888 </simpara>\r
889 <simpara>To illustrate the difference between <emphasis>-S&lt;regex&gt; --pickaxe-regex</emphasis> and\r
890 <emphasis>-G&lt;regex&gt;</emphasis>, consider a commit with the following diff in the same\r
891 file:</simpara>\r
892 <screen>+    return !regexec(regexp, two-&gt;ptr, 1, &amp;regmatch, 0);\r
893 ...\r
894 -    hit = !regexec(regexp, mf2.ptr, 1, &amp;regmatch, 0);</screen>\r
895 <simpara>While <emphasis>git log -G"regexec\(regexp"</emphasis> will show this commit, <emphasis>git log\r
896 -S"regexec\(regexp" --pickaxe-regex</emphasis> will not (because the number of\r
897 occurrences of that string did not change).</simpara>\r
898 <simpara>See the <emphasis>pickaxe</emphasis> entry in <xref linkend="gitdiffcore(7)" /> for more\r
899 information.</simpara>\r
900 </listitem>\r
901 </varlistentry>\r
902 <varlistentry>\r
903 <term>\r
904 --pickaxe-all\r
905 </term>\r
906 <listitem>\r
907 <simpara>\r
908         When <emphasis>-S</emphasis> or <emphasis>-G</emphasis> finds a change, show all the changes in that\r
909         changeset, not just the files that contain the change\r
910         in &lt;string&gt;.\r
911 </simpara>\r
912 </listitem>\r
913 </varlistentry>\r
914 <varlistentry>\r
915 <term>\r
916 --pickaxe-regex\r
917 </term>\r
918 <listitem>\r
919 <simpara>\r
920         Treat the &lt;string&gt; given to <emphasis>-S</emphasis> as an extended POSIX regular\r
921         expression to match.\r
922 </simpara>\r
923 </listitem>\r
924 </varlistentry>\r
925 <varlistentry>\r
926 <term>\r
927 -O&lt;orderfile&gt;\r
928 </term>\r
929 <listitem>\r
930 <simpara>\r
931         Output the patch in the order specified in the\r
932         &lt;orderfile&gt;, which has one shell glob pattern per line.\r
933         This overrides the <emphasis>diff.orderFile</emphasis> configuration variable\r
934         (see <xref linkend="git-config(1)" />).  To cancel <emphasis>diff.orderFile</emphasis>,\r
935         use <emphasis>-O/dev/null</emphasis>.\r
936 </simpara>\r
937 </listitem>\r
938 </varlistentry>\r
939 <varlistentry>\r
940 <term>\r
941 -R\r
942 </term>\r
943 <listitem>\r
944 <simpara>\r
945         Swap two inputs; that is, show differences from index or\r
946         on-disk file to tree contents.\r
947 </simpara>\r
948 </listitem>\r
949 </varlistentry>\r
950 <varlistentry>\r
951 <term>\r
952 --relative[=&lt;path&gt;]\r
953 </term>\r
954 <listitem>\r
955 <simpara>\r
956         When run from a subdirectory of the project, it can be\r
957         told to exclude changes outside the directory and show\r
958         pathnames relative to it with this option.  When you are\r
959         not in a subdirectory (e.g. in a bare repository), you\r
960         can name which subdirectory to make the output relative\r
961         to by giving a &lt;path&gt; as an argument.\r
962 </simpara>\r
963 </listitem>\r
964 </varlistentry>\r
965 <varlistentry>\r
966 <term>\r
967 -a\r
968 </term>\r
969 <term>\r
970 --text\r
971 </term>\r
972 <listitem>\r
973 <simpara>\r
974         Treat all files as text.\r
975 </simpara>\r
976 </listitem>\r
977 </varlistentry>\r
978 <varlistentry>\r
979 <term>\r
980 --ignore-space-at-eol\r
981 </term>\r
982 <listitem>\r
983 <simpara>\r
984         Ignore changes in whitespace at EOL.\r
985 </simpara>\r
986 </listitem>\r
987 </varlistentry>\r
988 <varlistentry>\r
989 <term>\r
990 -b\r
991 </term>\r
992 <term>\r
993 --ignore-space-change\r
994 </term>\r
995 <listitem>\r
996 <simpara>\r
997         Ignore changes in amount of whitespace.  This ignores whitespace\r
998         at line end, and considers all other sequences of one or\r
999         more whitespace characters to be equivalent.\r
1000 </simpara>\r
1001 </listitem>\r
1002 </varlistentry>\r
1003 <varlistentry>\r
1004 <term>\r
1005 -w\r
1006 </term>\r
1007 <term>\r
1008 --ignore-all-space\r
1009 </term>\r
1010 <listitem>\r
1011 <simpara>\r
1012         Ignore whitespace when comparing lines.  This ignores\r
1013         differences even if one line has whitespace where the other\r
1014         line has none.\r
1015 </simpara>\r
1016 </listitem>\r
1017 </varlistentry>\r
1018 <varlistentry>\r
1019 <term>\r
1020 --ignore-blank-lines\r
1021 </term>\r
1022 <listitem>\r
1023 <simpara>\r
1024         Ignore changes whose lines are all blank.\r
1025 </simpara>\r
1026 </listitem>\r
1027 </varlistentry>\r
1028 <varlistentry>\r
1029 <term>\r
1030 --inter-hunk-context=&lt;lines&gt;\r
1031 </term>\r
1032 <listitem>\r
1033 <simpara>\r
1034         Show the context between diff hunks, up to the specified number\r
1035         of lines, thereby fusing hunks that are close to each other.\r
1036 </simpara>\r
1037 </listitem>\r
1038 </varlistentry>\r
1039 <varlistentry>\r
1040 <term>\r
1041 -W\r
1042 </term>\r
1043 <term>\r
1044 --function-context\r
1045 </term>\r
1046 <listitem>\r
1047 <simpara>\r
1048         Show whole surrounding functions of changes.\r
1049 </simpara>\r
1050 </listitem>\r
1051 </varlistentry>\r
1052 <varlistentry>\r
1053 <term>\r
1054 --exit-code\r
1055 </term>\r
1056 <listitem>\r
1057 <simpara>\r
1058         Make the program exit with codes similar to diff(1).\r
1059         That is, it exits with 1 if there were differences and\r
1060         0 means no differences.\r
1061 </simpara>\r
1062 </listitem>\r
1063 </varlistentry>\r
1064 <varlistentry>\r
1065 <term>\r
1066 --quiet\r
1067 </term>\r
1068 <listitem>\r
1069 <simpara>\r
1070         Disable all output of the program. Implies <emphasis>--exit-code</emphasis>.\r
1071 </simpara>\r
1072 </listitem>\r
1073 </varlistentry>\r
1074 <varlistentry>\r
1075 <term>\r
1076 --ext-diff\r
1077 </term>\r
1078 <listitem>\r
1079 <simpara>\r
1080         Allow an external diff helper to be executed. If you set an\r
1081         external diff driver with <xref linkend="gitattributes(5)" />, you need\r
1082         to use this option with <xref linkend="git-log(1)" /> and friends.\r
1083 </simpara>\r
1084 </listitem>\r
1085 </varlistentry>\r
1086 <varlistentry>\r
1087 <term>\r
1088 --no-ext-diff\r
1089 </term>\r
1090 <listitem>\r
1091 <simpara>\r
1092         Disallow external diff drivers.\r
1093 </simpara>\r
1094 </listitem>\r
1095 </varlistentry>\r
1096 <varlistentry>\r
1097 <term>\r
1098 --textconv\r
1099 </term>\r
1100 <term>\r
1101 --no-textconv\r
1102 </term>\r
1103 <listitem>\r
1104 <simpara>\r
1105         Allow (or disallow) external text conversion filters to be run\r
1106         when comparing binary files. See <xref linkend="gitattributes(5)" /> for\r
1107         details. Because textconv filters are typically a one-way\r
1108         conversion, the resulting diff is suitable for human\r
1109         consumption, but cannot be applied. For this reason, textconv\r
1110         filters are enabled by default only for <xref linkend="git-diff(1)" /> and\r
1111         <xref linkend="git-log(1)" />, but not for <xref linkend="git-format-patch(1)" /> or\r
1112         diff plumbing commands.\r
1113 </simpara>\r
1114 </listitem>\r
1115 </varlistentry>\r
1116 <varlistentry>\r
1117 <term>\r
1118 --ignore-submodules[=&lt;when&gt;]\r
1119 </term>\r
1120 <listitem>\r
1121 <simpara>\r
1122         Ignore changes to submodules in the diff generation. &lt;when&gt; can be\r
1123         either "none", "untracked", "dirty" or "all", which is the default.\r
1124         Using "none" will consider the submodule modified when it either contains\r
1125         untracked or modified files or its HEAD differs from the commit recorded\r
1126         in the superproject and can be used to override any settings of the\r
1127         <emphasis>ignore</emphasis> option in <xref linkend="git-config(1)" /> or <xref linkend="gitmodules(5)" />. When\r
1128         "untracked" is used submodules are not considered dirty when they only\r
1129         contain untracked content (but they are still scanned for modified\r
1130         content). Using "dirty" ignores all changes to the work tree of submodules,\r
1131         only changes to the commits stored in the superproject are shown (this was\r
1132         the behavior until 1.7.0). Using "all" hides all changes to submodules.\r
1133 </simpara>\r
1134 </listitem>\r
1135 </varlistentry>\r
1136 <varlistentry>\r
1137 <term>\r
1138 --src-prefix=&lt;prefix&gt;\r
1139 </term>\r
1140 <listitem>\r
1141 <simpara>\r
1142         Show the given source prefix instead of "a/".\r
1143 </simpara>\r
1144 </listitem>\r
1145 </varlistentry>\r
1146 <varlistentry>\r
1147 <term>\r
1148 --dst-prefix=&lt;prefix&gt;\r
1149 </term>\r
1150 <listitem>\r
1151 <simpara>\r
1152         Show the given destination prefix instead of "b/".\r
1153 </simpara>\r
1154 </listitem>\r
1155 </varlistentry>\r
1156 <varlistentry>\r
1157 <term>\r
1158 --no-prefix\r
1159 </term>\r
1160 <listitem>\r
1161 <simpara>\r
1162         Do not show any source or destination prefix.\r
1163 </simpara>\r
1164 </listitem>\r
1165 </varlistentry>\r
1166 </variablelist>\r
1167 <simpara>For more detailed explanation on these common options, see also\r
1168 <xref linkend="gitdiffcore(7)" />.</simpara>\r
1169 <variablelist>\r
1170 <varlistentry>\r
1171 <term>\r
1172 &lt;path&gt;&#8230;\r
1173 </term>\r
1174 <listitem>\r
1175 <simpara>\r
1176         The &lt;paths&gt; parameters, when given, are used to limit\r
1177         the diff to the named paths (you can give directory\r
1178         names and get diff for all files under them).\r
1179 </simpara>\r
1180 </listitem>\r
1181 </varlistentry>\r
1182 </variablelist>\r
1183 </simplesect>\r
1184 <simplesect id="git-diff(1)__raw_output_format">\r
1185 <title>Raw output format</title>\r
1186 <simpara>The raw output format from "git-diff-index", "git-diff-tree",\r
1187 "git-diff-files" and "git diff --raw" are very similar.</simpara>\r
1188 <simpara>These commands all compare two sets of things; what is\r
1189 compared differs:</simpara>\r
1190 <variablelist>\r
1191 <varlistentry>\r
1192 <term>\r
1193 git-diff-index &lt;tree-ish&gt;\r
1194 </term>\r
1195 <listitem>\r
1196 <simpara>\r
1197         compares the &lt;tree-ish&gt; and the files on the filesystem.\r
1198 </simpara>\r
1199 </listitem>\r
1200 </varlistentry>\r
1201 <varlistentry>\r
1202 <term>\r
1203 git-diff-index --cached &lt;tree-ish&gt;\r
1204 </term>\r
1205 <listitem>\r
1206 <simpara>\r
1207         compares the &lt;tree-ish&gt; and the index.\r
1208 </simpara>\r
1209 </listitem>\r
1210 </varlistentry>\r
1211 <varlistentry>\r
1212 <term>\r
1213 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]\r
1214 </term>\r
1215 <listitem>\r
1216 <simpara>\r
1217         compares the trees named by the two arguments.\r
1218 </simpara>\r
1219 </listitem>\r
1220 </varlistentry>\r
1221 <varlistentry>\r
1222 <term>\r
1223 git-diff-files [&lt;pattern&gt;&#8230;]\r
1224 </term>\r
1225 <listitem>\r
1226 <simpara>\r
1227         compares the index and the files on the filesystem.\r
1228 </simpara>\r
1229 </listitem>\r
1230 </varlistentry>\r
1231 </variablelist>\r
1232 <simpara>The "git-diff-tree" command begins its output by printing the hash of\r
1233 what is being compared. After that, all the commands print one output\r
1234 line per changed file.</simpara>\r
1235 <simpara>An output line is formatted this way:</simpara>\r
1236 <screen>in-place edit  :100644 100644 bcd1234... 0123456... M file0\r
1237 copy-edit      :100644 100644 abcd123... 1234567... C68 file1 file2\r
1238 rename-edit    :100644 100644 abcd123... 1234567... R86 file1 file3\r
1239 create         :000000 100644 0000000... 1234567... A file4\r
1240 delete         :100644 000000 1234567... 0000000... D file5\r
1241 unmerged       :000000 000000 0000000... 0000000... U file6</screen>\r
1242 <simpara>That is, from the left to the right:</simpara>\r
1243 <orderedlist numeration="arabic">\r
1244 <listitem>\r
1245 <simpara>\r
1246 a colon.\r
1247 </simpara>\r
1248 </listitem>\r
1249 <listitem>\r
1250 <simpara>\r
1251 mode for "src"; 000000 if creation or unmerged.\r
1252 </simpara>\r
1253 </listitem>\r
1254 <listitem>\r
1255 <simpara>\r
1256 a space.\r
1257 </simpara>\r
1258 </listitem>\r
1259 <listitem>\r
1260 <simpara>\r
1261 mode for "dst"; 000000 if deletion or unmerged.\r
1262 </simpara>\r
1263 </listitem>\r
1264 <listitem>\r
1265 <simpara>\r
1266 a space.\r
1267 </simpara>\r
1268 </listitem>\r
1269 <listitem>\r
1270 <simpara>\r
1271 sha1 for "src"; 0{40} if creation or unmerged.\r
1272 </simpara>\r
1273 </listitem>\r
1274 <listitem>\r
1275 <simpara>\r
1276 a space.\r
1277 </simpara>\r
1278 </listitem>\r
1279 <listitem>\r
1280 <simpara>\r
1281 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".\r
1282 </simpara>\r
1283 </listitem>\r
1284 <listitem>\r
1285 <simpara>\r
1286 a space.\r
1287 </simpara>\r
1288 </listitem>\r
1289 <listitem>\r
1290 <simpara>\r
1291 status, followed by optional "score" number.\r
1292 </simpara>\r
1293 </listitem>\r
1294 <listitem>\r
1295 <simpara>\r
1296 a tab or a NUL when <emphasis>-z</emphasis> option is used.\r
1297 </simpara>\r
1298 </listitem>\r
1299 <listitem>\r
1300 <simpara>\r
1301 path for "src"\r
1302 </simpara>\r
1303 </listitem>\r
1304 <listitem>\r
1305 <simpara>\r
1306 a tab or a NUL when <emphasis>-z</emphasis> option is used; only exists for C or R.\r
1307 </simpara>\r
1308 </listitem>\r
1309 <listitem>\r
1310 <simpara>\r
1311 path for "dst"; only exists for C or R.\r
1312 </simpara>\r
1313 </listitem>\r
1314 <listitem>\r
1315 <simpara>\r
1316 an LF or a NUL when <emphasis>-z</emphasis> option is used, to terminate the record.\r
1317 </simpara>\r
1318 </listitem>\r
1319 </orderedlist>\r
1320 <simpara>Possible status letters are:</simpara>\r
1321 <itemizedlist>\r
1322 <listitem>\r
1323 <simpara>\r
1324 A: addition of a file\r
1325 </simpara>\r
1326 </listitem>\r
1327 <listitem>\r
1328 <simpara>\r
1329 C: copy of a file into a new one\r
1330 </simpara>\r
1331 </listitem>\r
1332 <listitem>\r
1333 <simpara>\r
1334 D: deletion of a file\r
1335 </simpara>\r
1336 </listitem>\r
1337 <listitem>\r
1338 <simpara>\r
1339 M: modification of the contents or mode of a file\r
1340 </simpara>\r
1341 </listitem>\r
1342 <listitem>\r
1343 <simpara>\r
1344 R: renaming of a file\r
1345 </simpara>\r
1346 </listitem>\r
1347 <listitem>\r
1348 <simpara>\r
1349 T: change in the type of the file\r
1350 </simpara>\r
1351 </listitem>\r
1352 <listitem>\r
1353 <simpara>\r
1354 U: file is unmerged (you must complete the merge before it can\r
1355 be committed)\r
1356 </simpara>\r
1357 </listitem>\r
1358 <listitem>\r
1359 <simpara>\r
1360 X: "unknown" change type (most probably a bug, please report it)\r
1361 </simpara>\r
1362 </listitem>\r
1363 </itemizedlist>\r
1364 <simpara>Status letters C and R are always followed by a score (denoting the\r
1365 percentage of similarity between the source and target of the move or\r
1366 copy).  Status letter M may be followed by a score (denoting the\r
1367 percentage of dissimilarity) for file rewrites.</simpara>\r
1368 <simpara>&lt;sha1&gt; is shown as all 0's if a file is new on the filesystem\r
1369 and it is out of sync with the index.</simpara>\r
1370 <simpara>Example:</simpara>\r
1371 <screen>:100644 100644 5be4a4...... 000000...... M file.c</screen>\r
1372 <simpara>When <emphasis>-z</emphasis> option is not used, TAB, LF, and backslash characters\r
1373 in pathnames are represented as <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, and <emphasis>\\</emphasis>,\r
1374 respectively.</simpara>\r
1375 </simplesect>\r
1376 <simplesect id="git-diff(1)__diff_format_for_merges">\r
1377 <title>diff format for merges</title>\r
1378 <simpara>"git-diff-tree", "git-diff-files" and "git-diff --raw"\r
1379 can take <emphasis>-c</emphasis> or <emphasis>--cc</emphasis> option\r
1380 to generate diff output also for merge commits.  The output differs\r
1381 from the format described above in the following way:</simpara>\r
1382 <orderedlist numeration="arabic">\r
1383 <listitem>\r
1384 <simpara>\r
1385 there is a colon for each parent\r
1386 </simpara>\r
1387 </listitem>\r
1388 <listitem>\r
1389 <simpara>\r
1390 there are more "src" modes and "src" sha1\r
1391 </simpara>\r
1392 </listitem>\r
1393 <listitem>\r
1394 <simpara>\r
1395 status is concatenated status characters for each parent\r
1396 </simpara>\r
1397 </listitem>\r
1398 <listitem>\r
1399 <simpara>\r
1400 no optional "score" number\r
1401 </simpara>\r
1402 </listitem>\r
1403 <listitem>\r
1404 <simpara>\r
1405 single path, only for "dst"\r
1406 </simpara>\r
1407 </listitem>\r
1408 </orderedlist>\r
1409 <simpara>Example:</simpara>\r
1410 <screen>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c</screen>\r
1411 <simpara>Note that <emphasis>combined diff</emphasis> lists only files which were modified from\r
1412 all parents.</simpara>\r
1413 </simplesect>\r
1414 <simplesect id="git-diff(1)__generating_patches_with_p">\r
1415 <title>Generating patches with -p</title>\r
1416 <simpara>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run\r
1417 with a <emphasis>-p</emphasis> option, "git diff" without the <emphasis>--raw</emphasis> option, or\r
1418 "git log" with the "-p" option, they\r
1419 do not produce the output described above; instead they produce a\r
1420 patch file.  You can customize the creation of such patches via the\r
1421 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</simpara>\r
1422 <simpara>What the -p option produces is slightly different from the traditional\r
1423 diff format:</simpara>\r
1424 <orderedlist numeration="arabic">\r
1425 <listitem>\r
1426 <simpara>\r
1427 It is preceded with a "git diff" header that looks like this:\r
1428 </simpara>\r
1429 <literallayout class="monospaced">diff --git a/file1 b/file2</literallayout>\r
1430 <simpara>The <emphasis>a/</emphasis> and <emphasis>b/</emphasis> filenames are the same unless rename/copy is\r
1431 involved.  Especially, even for a creation or a deletion,\r
1432 <emphasis>/dev/null</emphasis> is <emphasis>not</emphasis> used in place of the <emphasis>a/</emphasis> or <emphasis>b/</emphasis> filenames.</simpara>\r
1433 <simpara>When rename/copy is involved, <emphasis>file1</emphasis> and <emphasis>file2</emphasis> show the\r
1434 name of the source file of the rename/copy and the name of\r
1435 the file that rename/copy produces, respectively.</simpara>\r
1436 </listitem>\r
1437 <listitem>\r
1438 <simpara>\r
1439 It is followed by one or more extended header lines:\r
1440 </simpara>\r
1441 <literallayout class="monospaced">old mode &lt;mode&gt;\r
1442 new mode &lt;mode&gt;\r
1443 deleted file mode &lt;mode&gt;\r
1444 new file mode &lt;mode&gt;\r
1445 copy from &lt;path&gt;\r
1446 copy to &lt;path&gt;\r
1447 rename from &lt;path&gt;\r
1448 rename to &lt;path&gt;\r
1449 similarity index &lt;number&gt;\r
1450 dissimilarity index &lt;number&gt;\r
1451 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</literallayout>\r
1452 <simpara>File modes are printed as 6-digit octal numbers including the file type\r
1453 and file permission bits.</simpara>\r
1454 <simpara>Path names in extended headers do not include the <emphasis>a/</emphasis> and <emphasis>b/</emphasis> prefixes.</simpara>\r
1455 <simpara>The similarity index is the percentage of unchanged lines, and\r
1456 the dissimilarity index is the percentage of changed lines.  It\r
1457 is a rounded down integer, followed by a percent sign.  The\r
1458 similarity index value of 100% is thus reserved for two equal\r
1459 files, while 100% dissimilarity means that no line from the old\r
1460 file made it into the new one.</simpara>\r
1461 <simpara>The index line includes the SHA-1 checksum before and after the change.\r
1462 The &lt;mode&gt; is included if the file mode does not change; otherwise,\r
1463 separate lines indicate the old and the new mode.</simpara>\r
1464 </listitem>\r
1465 <listitem>\r
1466 <simpara>\r
1467 TAB, LF, double quote and backslash characters in pathnames\r
1468     are represented as <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, <emphasis>\"</emphasis> and <emphasis>\\</emphasis>, respectively.\r
1469     If there is need for such substitution then the whole\r
1470     pathname is put in double quotes.\r
1471 </simpara>\r
1472 </listitem>\r
1473 <listitem>\r
1474 <simpara>\r
1475 All the <emphasis>file1</emphasis> files in the output refer to files before the\r
1476     commit, and all the <emphasis>file2</emphasis> files refer to files after the commit.\r
1477     It is incorrect to apply each change to each file sequentially.  For\r
1478     example, this patch will swap a and b:\r
1479 </simpara>\r
1480 <literallayout class="monospaced">diff --git a/a b/b\r
1481 rename from a\r
1482 rename to b\r
1483 diff --git a/b b/a\r
1484 rename from b\r
1485 rename to a</literallayout>\r
1486 </listitem>\r
1487 </orderedlist>\r
1488 </simplesect>\r
1489 <simplesect id="git-diff(1)__combined_diff_format">\r
1490 <title>combined diff format</title>\r
1491 <simpara>Any diff-generating command can take the <emphasis>-c</emphasis> or <emphasis>--cc</emphasis> option to\r
1492 produce a <emphasis>combined diff</emphasis> when showing a merge. This is the default\r
1493 format when showing merges with <xref linkend="git-diff(1)" /> or\r
1494 <xref linkend="git-show(1)" />. Note also that you can give the <emphasis>-m</emphasis> option to any\r
1495 of these commands to force generation of diffs with individual parents\r
1496 of a merge.</simpara>\r
1497 <simpara>A <emphasis>combined diff</emphasis> format looks like this:</simpara>\r
1498 <screen>diff --combined describe.c\r
1499 index fabadb8,cc95eb0..4866510\r
1500 --- a/describe.c\r
1501 +++ b/describe.c\r
1502 @@@ -98,20 -98,12 +98,20 @@@\r
1503         return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;\r
1504   }\r
1506 - static void describe(char *arg)\r
1507  -static void describe(struct commit *cmit, int last_one)\r
1508 ++static void describe(char *arg, int last_one)\r
1509   {\r
1510  +      unsigned char sha1[20];\r
1511  +      struct commit *cmit;\r
1512         struct commit_list *list;\r
1513         static int initialized = 0;\r
1514         struct commit_name *n;\r
1516  +      if (get_sha1(arg, sha1) &lt; 0)\r
1517  +              usage(describe_usage);\r
1518  +      cmit = lookup_commit_reference(sha1);\r
1519  +      if (!cmit)\r
1520  +              usage(describe_usage);\r
1521  +\r
1522         if (!initialized) {\r
1523                 initialized = 1;\r
1524                 for_each_ref(get_name);</screen>\r
1525 <orderedlist numeration="arabic">\r
1526 <listitem>\r
1527 <simpara>\r
1528 It is preceded with a "git diff" header, that looks like\r
1529      this (when <emphasis>-c</emphasis> option is used):\r
1530 </simpara>\r
1531 <literallayout class="monospaced">diff --combined file</literallayout>\r
1532 <simpara>or like this (when <emphasis>--cc</emphasis> option is used):</simpara>\r
1533 <literallayout class="monospaced">diff --cc file</literallayout>\r
1534 </listitem>\r
1535 <listitem>\r
1536 <simpara>\r
1537 It is followed by one or more extended header lines\r
1538      (this example shows a merge with two parents):\r
1539 </simpara>\r
1540 <literallayout class="monospaced">index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;\r
1541 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;\r
1542 new file mode &lt;mode&gt;\r
1543 deleted file mode &lt;mode&gt;,&lt;mode&gt;</literallayout>\r
1544 <simpara>The <emphasis>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</emphasis> line appears only if at least one of\r
1545 the &lt;mode&gt; is different from the rest. Extended headers with\r
1546 information about detected contents movement (renames and\r
1547 copying detection) are designed to work with diff of two\r
1548 &lt;tree-ish&gt; and are not used by combined diff format.</simpara>\r
1549 </listitem>\r
1550 <listitem>\r
1551 <simpara>\r
1552 It is followed by two-line from-file/to-file header\r
1553 </simpara>\r
1554 <literallayout class="monospaced">--- a/file\r
1555 +++ b/file</literallayout>\r
1556 <simpara>Similar to two-line header for traditional <emphasis>unified</emphasis> diff\r
1557 format, <emphasis>/dev/null</emphasis> is used to signal created or deleted\r
1558 files.</simpara>\r
1559 </listitem>\r
1560 <listitem>\r
1561 <simpara>\r
1562 Chunk header format is modified to prevent people from\r
1563      accidentally feeding it to <emphasis>patch -p1</emphasis>. Combined diff format\r
1564      was created for review of merge commit changes, and was not\r
1565      meant for apply. The change is similar to the change in the\r
1566      extended <emphasis>index</emphasis> header:\r
1567 </simpara>\r
1568 <literallayout class="monospaced">@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</literallayout>\r
1569 <simpara>There are (number of parents + 1) <emphasis>@</emphasis> characters in the chunk\r
1570 header for combined diff format.</simpara>\r
1571 </listitem>\r
1572 </orderedlist>\r
1573 <simpara>Unlike the traditional <emphasis>unified</emphasis> diff format, which shows two\r
1574 files A and B with a single column that has <emphasis>-</emphasis> (minus --\r
1575 appears in A but removed in B), <emphasis>+</emphasis> (plus -- missing in A but\r
1576 added to B), or <emphasis>" "</emphasis> (space -- unchanged) prefix, this format\r
1577 compares two or more files file1, file2,&#8230; with one file X, and\r
1578 shows how X differs from each of fileN.  One column for each of\r
1579 fileN is prepended to the output line to note how X's line is\r
1580 different from it.</simpara>\r
1581 <simpara>A <emphasis>-</emphasis> character in the column N means that the line appears in\r
1582 fileN but it does not appear in the result.  A <emphasis>+</emphasis> character\r
1583 in the column N means that the line appears in the result,\r
1584 and fileN does not have that line (in other words, the line was\r
1585 added, from the point of view of that parent).</simpara>\r
1586 <simpara>In the above example output, the function signature was changed\r
1587 from both files (hence two <emphasis>-</emphasis> removals from both file1 and\r
1588 file2, plus <emphasis>++</emphasis> to mean one line that was added does not appear\r
1589 in either file1 or file2).  Also eight other lines are the same\r
1590 from file1 but do not appear in file2 (hence prefixed with <emphasis>+</emphasis>).</simpara>\r
1591 <simpara>When shown by <emphasis>git diff-tree -c</emphasis>, it compares the parents of a\r
1592 merge commit with the merge result (i.e. file1..fileN are the\r
1593 parents).  When shown by <emphasis>git diff-files -c</emphasis>, it compares the\r
1594 two unresolved merge parents with the working tree file\r
1595 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka\r
1596 "their version").</simpara>\r
1597 </simplesect>\r
1598 <simplesect id="git-diff(1)__other_diff_formats">\r
1599 <title>other diff formats</title>\r
1600 <simpara>The <emphasis>--summary</emphasis> option describes newly added, deleted, renamed and\r
1601 copied files.  The <emphasis>--stat</emphasis> option adds diffstat(1) graph to the\r
1602 output.  These options can be combined with other options, such as\r
1603 <emphasis>-p</emphasis>, and are meant for human consumption.</simpara>\r
1604 <simpara>When showing a change that involves a rename or a copy, <emphasis>--stat</emphasis> output\r
1605 formats the pathnames compactly by combining common prefix and suffix of\r
1606 the pathnames.  For example, a change that moves <emphasis>arch/i386/Makefile</emphasis> to\r
1607 <emphasis>arch/x86/Makefile</emphasis> while modifying 4 lines will be shown like this:</simpara>\r
1608 <screen>arch/{i386 =&gt; x86}/Makefile    |   4 +--</screen>\r
1609 <simpara>The <emphasis>--numstat</emphasis> option gives the diffstat(1) information but is designed\r
1610 for easier machine consumption.  An entry in <emphasis>--numstat</emphasis> output looks\r
1611 like this:</simpara>\r
1612 <screen>1       2       README\r
1613 3       1       arch/{i386 =&gt; x86}/Makefile</screen>\r
1614 <simpara>That is, from left to right:</simpara>\r
1615 <orderedlist numeration="arabic">\r
1616 <listitem>\r
1617 <simpara>\r
1618 the number of added lines;\r
1619 </simpara>\r
1620 </listitem>\r
1621 <listitem>\r
1622 <simpara>\r
1623 a tab;\r
1624 </simpara>\r
1625 </listitem>\r
1626 <listitem>\r
1627 <simpara>\r
1628 the number of deleted lines;\r
1629 </simpara>\r
1630 </listitem>\r
1631 <listitem>\r
1632 <simpara>\r
1633 a tab;\r
1634 </simpara>\r
1635 </listitem>\r
1636 <listitem>\r
1637 <simpara>\r
1638 pathname (possibly with rename/copy information);\r
1639 </simpara>\r
1640 </listitem>\r
1641 <listitem>\r
1642 <simpara>\r
1643 a newline.\r
1644 </simpara>\r
1645 </listitem>\r
1646 </orderedlist>\r
1647 <simpara>When <emphasis>-z</emphasis> output option is in effect, the output is formatted this way:</simpara>\r
1648 <screen>1       2       README NUL\r
1649 3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</screen>\r
1650 <simpara>That is:</simpara>\r
1651 <orderedlist numeration="arabic">\r
1652 <listitem>\r
1653 <simpara>\r
1654 the number of added lines;\r
1655 </simpara>\r
1656 </listitem>\r
1657 <listitem>\r
1658 <simpara>\r
1659 a tab;\r
1660 </simpara>\r
1661 </listitem>\r
1662 <listitem>\r
1663 <simpara>\r
1664 the number of deleted lines;\r
1665 </simpara>\r
1666 </listitem>\r
1667 <listitem>\r
1668 <simpara>\r
1669 a tab;\r
1670 </simpara>\r
1671 </listitem>\r
1672 <listitem>\r
1673 <simpara>\r
1674 a NUL (only exists if renamed/copied);\r
1675 </simpara>\r
1676 </listitem>\r
1677 <listitem>\r
1678 <simpara>\r
1679 pathname in preimage;\r
1680 </simpara>\r
1681 </listitem>\r
1682 <listitem>\r
1683 <simpara>\r
1684 a NUL (only exists if renamed/copied);\r
1685 </simpara>\r
1686 </listitem>\r
1687 <listitem>\r
1688 <simpara>\r
1689 pathname in postimage (only exists if renamed/copied);\r
1690 </simpara>\r
1691 </listitem>\r
1692 <listitem>\r
1693 <simpara>\r
1694 a NUL.\r
1695 </simpara>\r
1696 </listitem>\r
1697 </orderedlist>\r
1698 <simpara>The extra <emphasis>NUL</emphasis> before the preimage path in renamed case is to allow\r
1699 scripts that read the output to tell if the current record being read is\r
1700 a single-path record or a rename/copy record without reading ahead.\r
1701 After reading added and deleted lines, reading up to <emphasis>NUL</emphasis> would yield\r
1702 the pathname, but if that is <emphasis>NUL</emphasis>, the record will show two paths.</simpara>\r
1703 </simplesect>\r
1704 <simplesect id="git-diff(1)__examples">\r
1705 <title>EXAMPLES</title>\r
1706 <variablelist>\r
1707 <varlistentry>\r
1708 <term>\r
1709 Various ways to check your working tree\r
1710 </term>\r
1711 <listitem>\r
1712 <screen>$ git diff            <co id="git-diff_CO1-1"/>\r
1713 $ git diff --cached   <co id="git-diff_CO1-2"/>\r
1714 $ git diff HEAD       <co id="git-diff_CO1-3"/></screen>\r
1715 <calloutlist>\r
1716 <callout arearefs="git-diff_CO1-1">\r
1717 <para>\r
1718 Changes in the working tree not yet staged for the next commit.\r
1719 </para>\r
1720 </callout>\r
1721 <callout arearefs="git-diff_CO1-2">\r
1722 <para>\r
1723 Changes between the index and your last commit; what you\r
1724 would be committing if you run "git commit" without "-a" option.\r
1725 </para>\r
1726 </callout>\r
1727 <callout arearefs="git-diff_CO1-3">\r
1728 <para>\r
1729 Changes in the working tree since your last commit; what you\r
1730 would be committing if you run "git commit -a"\r
1731 </para>\r
1732 </callout>\r
1733 </calloutlist>\r
1734 </listitem>\r
1735 </varlistentry>\r
1736 <varlistentry>\r
1737 <term>\r
1738 Comparing with arbitrary commits\r
1739 </term>\r
1740 <listitem>\r
1741 <screen>$ git diff test            <co id="git-diff_CO2-1"/>\r
1742 $ git diff HEAD -- ./test  <co id="git-diff_CO2-2"/>\r
1743 $ git diff HEAD^ HEAD      <co id="git-diff_CO2-3"/></screen>\r
1744 <calloutlist>\r
1745 <callout arearefs="git-diff_CO2-1">\r
1746 <para>\r
1747 Instead of using the tip of the current branch, compare with the\r
1748 tip of "test" branch.\r
1749 </para>\r
1750 </callout>\r
1751 <callout arearefs="git-diff_CO2-2">\r
1752 <para>\r
1753 Instead of comparing with the tip of "test" branch, compare with\r
1754 the tip of the current branch, but limit the comparison to the\r
1755 file "test".\r
1756 </para>\r
1757 </callout>\r
1758 <callout arearefs="git-diff_CO2-3">\r
1759 <para>\r
1760 Compare the version before the last commit and the last commit.\r
1761 </para>\r
1762 </callout>\r
1763 </calloutlist>\r
1764 </listitem>\r
1765 </varlistentry>\r
1766 <varlistentry>\r
1767 <term>\r
1768 Comparing branches\r
1769 </term>\r
1770 <listitem>\r
1771 <screen>$ git diff topic master    <co id="git-diff_CO3-1"/>\r
1772 $ git diff topic..master   <co id="git-diff_CO3-2"/>\r
1773 $ git diff topic...master  <co id="git-diff_CO3-3"/></screen>\r
1774 <calloutlist>\r
1775 <callout arearefs="git-diff_CO3-1">\r
1776 <para>\r
1777 Changes between the tips of the topic and the master branches.\r
1778 </para>\r
1779 </callout>\r
1780 <callout arearefs="git-diff_CO3-2">\r
1781 <para>\r
1782 Same as above.\r
1783 </para>\r
1784 </callout>\r
1785 <callout arearefs="git-diff_CO3-3">\r
1786 <para>\r
1787 Changes that occurred on the master branch since when the topic\r
1788 branch was started off it.\r
1789 </para>\r
1790 </callout>\r
1791 </calloutlist>\r
1792 </listitem>\r
1793 </varlistentry>\r
1794 <varlistentry>\r
1795 <term>\r
1796 Limiting the diff output\r
1797 </term>\r
1798 <listitem>\r
1799 <screen>$ git diff --diff-filter=MRC            <co id="git-diff_CO4-1"/>\r
1800 $ git diff --name-status                <co id="git-diff_CO4-2"/>\r
1801 $ git diff arch/i386 include/asm-i386   <co id="git-diff_CO4-3"/></screen>\r
1802 <calloutlist>\r
1803 <callout arearefs="git-diff_CO4-1">\r
1804 <para>\r
1805 Show only modification, rename, and copy, but not addition\r
1806 or deletion.\r
1807 </para>\r
1808 </callout>\r
1809 <callout arearefs="git-diff_CO4-2">\r
1810 <para>\r
1811 Show only names and the nature of change, but not actual\r
1812 diff output.\r
1813 </para>\r
1814 </callout>\r
1815 <callout arearefs="git-diff_CO4-3">\r
1816 <para>\r
1817 Limit diff output to named subtrees.\r
1818 </para>\r
1819 </callout>\r
1820 </calloutlist>\r
1821 </listitem>\r
1822 </varlistentry>\r
1823 <varlistentry>\r
1824 <term>\r
1825 Munging the diff output\r
1826 </term>\r
1827 <listitem>\r
1828 <screen>$ git diff --find-copies-harder -B -C  <co id="git-diff_CO5-1"/>\r
1829 $ git diff -R                          <co id="git-diff_CO5-2"/></screen>\r
1830 <calloutlist>\r
1831 <callout arearefs="git-diff_CO5-1">\r
1832 <para>\r
1833 Spend extra cycles to find renames, copies and complete\r
1834 rewrites (very expensive).\r
1835 </para>\r
1836 </callout>\r
1837 <callout arearefs="git-diff_CO5-2">\r
1838 <para>\r
1839 Output diff in reverse.\r
1840 </para>\r
1841 </callout>\r
1842 </calloutlist>\r
1843 </listitem>\r
1844 </varlistentry>\r
1845 </variablelist>\r
1846 </simplesect>\r
1847 <simplesect id="git-diff(1)__see_also">\r
1848 <title>SEE ALSO</title>\r
1849 <simpara>diff(1),\r
1850 <xref linkend="git-difftool(1)" />,\r
1851 <xref linkend="git-log(1)" />,\r
1852 <xref linkend="gitdiffcore(7)" />,\r
1853 <xref linkend="git-format-patch(1)" />,\r
1854 <xref linkend="git-apply(1)" /></simpara>\r
1855 </simplesect>\r
1856 <simplesect id="git-diff(1)__git">\r
1857 <title>GIT</title>\r
1858 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
1859 </simplesect>\r
1860 </sect2>\r