OSDN Git Service

merge original branch.
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-diff.html.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-diff(1)">\r
5 <articleinfo>\r
6     <title>git-diff(1)</title>\r
7         <indexterm>\r
8                 <primary>git-diff(1)</primary>\r
9         </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-diff - Show changes between commits, commit and working tree, etc</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <simpara><emphasis>git diff</emphasis> [&lt;common diff options&gt;] &lt;commit&gt;{0,2} [--] [&lt;path&gt;&#8230;]</simpara>\r
18 </simplesect>\r
19 <simplesect id="_description">\r
20 <title>DESCRIPTION</title>\r
21 <simpara>Show changes between two trees, a tree and the working tree, a\r
22 tree and the index file, or the index file and the working tree.</simpara>\r
23 <variablelist>\r
24 <varlistentry>\r
25 <term>\r
26 <emphasis>git diff</emphasis> [--options] [--] [&lt;path&gt;&#8230;]\r
27 </term>\r
28 <listitem>\r
29 <simpara>\r
30         This form is to view the changes you made relative to\r
31         the index (staging area for the next commit).  In other\r
32         words, the differences are what you <emphasis>could</emphasis> tell git to\r
33         further add to the index but you still haven&#8217;t.  You can\r
34         stage these changes by using <xref linkend="git-add(1)"/>.\r
35 </simpara>\r
36 <simpara>If exactly two paths are given, and at least one is untracked,\r
37 compare the two files / directories. This behavior can be\r
38 forced by --no-index.</simpara>\r
39 </listitem>\r
40 </varlistentry>\r
41 <varlistentry>\r
42 <term>\r
43 <emphasis>git diff</emphasis> [--options] --cached [&lt;commit&gt;] [--] [&lt;path&gt;&#8230;]\r
44 </term>\r
45 <listitem>\r
46 <simpara>\r
47         This form is to view the changes you staged for the next\r
48         commit relative to the named &lt;commit&gt;.  Typically you\r
49         would want comparison with the latest commit, so if you\r
50         do not give &lt;commit&gt;, it defaults to HEAD.\r
51         --staged is a synonym of --cached.\r
52 </simpara>\r
53 </listitem>\r
54 </varlistentry>\r
55 <varlistentry>\r
56 <term>\r
57 <emphasis>git diff</emphasis> [--options] &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
58 </term>\r
59 <listitem>\r
60 <simpara>\r
61         This form is to view the changes you have in your\r
62         working tree relative to the named &lt;commit&gt;.  You can\r
63         use HEAD to compare it with the latest commit, or a\r
64         branch name to compare with the tip of a different\r
65         branch.\r
66 </simpara>\r
67 </listitem>\r
68 </varlistentry>\r
69 <varlistentry>\r
70 <term>\r
71 <emphasis>git diff</emphasis> [--options] &lt;commit&gt; &lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
72 </term>\r
73 <listitem>\r
74 <simpara>\r
75         This is to view the changes between two arbitrary\r
76         &lt;commit&gt;.\r
77 </simpara>\r
78 </listitem>\r
79 </varlistentry>\r
80 <varlistentry>\r
81 <term>\r
82 <emphasis>git diff</emphasis> [--options] &lt;commit&gt;..&lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
83 </term>\r
84 <listitem>\r
85 <simpara>\r
86         This is synonymous to the previous form.  If &lt;commit&gt; on\r
87         one side is omitted, it will have the same effect as\r
88         using HEAD instead.\r
89 </simpara>\r
90 </listitem>\r
91 </varlistentry>\r
92 <varlistentry>\r
93 <term>\r
94 <emphasis>git diff</emphasis> [--options] &lt;commit&gt;...&lt;commit&gt; [--] [&lt;path&gt;&#8230;]\r
95 </term>\r
96 <listitem>\r
97 <simpara>\r
98         This form is to view the changes on the branch containing\r
99         and up to the second &lt;commit&gt;, starting at a common ancestor\r
100         of both &lt;commit&gt;.  "git diff A...B" is equivalent to\r
101         "git diff $(git-merge-base A B) B".  You can omit any one\r
102         of &lt;commit&gt;, which has the same effect as using HEAD instead.\r
103 </simpara>\r
104 </listitem>\r
105 </varlistentry>\r
106 </variablelist>\r
107 <simpara>Just in case if you are doing something exotic, it should be\r
108 noted that all of the &lt;commit&gt; in the above description, except\r
109 for the last two forms that use ".." notations, can be any\r
110 &lt;tree-ish&gt;.</simpara>\r
111 <simpara>For a more complete list of ways to spell &lt;commit&gt;, see\r
112 "SPECIFYING REVISIONS" section in <xref linkend="git-rev-parse(1)"/>.\r
113 However, "diff" is about comparing two <emphasis>endpoints</emphasis>, not ranges,\r
114 and the range notations ("&lt;commit&gt;..&lt;commit&gt;" and\r
115 "&lt;commit&gt;...&lt;commit&gt;") do not mean a range as defined in the\r
116 "SPECIFYING RANGES" section in <xref linkend="git-rev-parse(1)"/>.</simpara>\r
117 </simplesect>\r
118 <simplesect id="_options">\r
119 <title>OPTIONS</title>\r
120 <variablelist>\r
121 <varlistentry>\r
122 <term>\r
123 -p\r
124 </term>\r
125 <term>\r
126 -u\r
127 </term>\r
128 <listitem>\r
129 <simpara>\r
130         Generate patch (see section on generating patches).\r
131          This is the default.\r
132 </simpara>\r
133 </listitem>\r
134 </varlistentry>\r
135 <varlistentry>\r
136 <term>\r
137 -U&lt;n&gt;\r
138 </term>\r
139 <term>\r
140 --unified=&lt;n&gt;\r
141 </term>\r
142 <listitem>\r
143 <simpara>\r
144         Generate diffs with &lt;n&gt; lines of context instead of\r
145         the usual three. Implies "-p".\r
146 </simpara>\r
147 </listitem>\r
148 </varlistentry>\r
149 <varlistentry>\r
150 <term>\r
151 --raw\r
152 </term>\r
153 <listitem>\r
154 <simpara>\r
155         Generate the raw format.\r
156         \r
157 </simpara>\r
158 </listitem>\r
159 </varlistentry>\r
160 <varlistentry>\r
161 <term>\r
162 --patch-with-raw\r
163 </term>\r
164 <listitem>\r
165 <simpara>\r
166         Synonym for "-p --raw".\r
167 </simpara>\r
168 </listitem>\r
169 </varlistentry>\r
170 <varlistentry>\r
171 <term>\r
172 --patience\r
173 </term>\r
174 <listitem>\r
175 <simpara>\r
176         Generate a diff using the "patience diff" algorithm.\r
177 </simpara>\r
178 </listitem>\r
179 </varlistentry>\r
180 <varlistentry>\r
181 <term>\r
182 --stat[=width[,name-width]]\r
183 </term>\r
184 <listitem>\r
185 <simpara>\r
186         Generate a diffstat.  You can override the default\r
187         output width for 80-column terminal by "--stat=width".\r
188         The width of the filename part can be controlled by\r
189         giving another width to it separated by a comma.\r
190 </simpara>\r
191 </listitem>\r
192 </varlistentry>\r
193 <varlistentry>\r
194 <term>\r
195 --numstat\r
196 </term>\r
197 <listitem>\r
198 <simpara>\r
199         Similar to --stat, but shows number of added and\r
200         deleted lines in decimal notation and pathname without\r
201         abbreviation, to make it more machine friendly.  For\r
202         binary files, outputs two <literal>-</literal> instead of saying\r
203         <literal>0 0</literal>.\r
204 </simpara>\r
205 </listitem>\r
206 </varlistentry>\r
207 <varlistentry>\r
208 <term>\r
209 --shortstat\r
210 </term>\r
211 <listitem>\r
212 <simpara>\r
213         Output only the last line of the --stat format containing total\r
214         number of modified files, as well as number of added and deleted\r
215         lines.\r
216 </simpara>\r
217 </listitem>\r
218 </varlistentry>\r
219 <varlistentry>\r
220 <term>\r
221 --dirstat[=limit]\r
222 </term>\r
223 <listitem>\r
224 <simpara>\r
225         Output the distribution of relative amount of changes (number of lines added or\r
226         removed) for each sub-directory. Directories with changes below\r
227         a cut-off percent (3% by default) are not shown. The cut-off percent\r
228         can be set with "--dirstat=limit". Changes in a child directory is not\r
229         counted for the parent directory, unless "--cumulative" is used.\r
230 </simpara>\r
231 </listitem>\r
232 </varlistentry>\r
233 <varlistentry>\r
234 <term>\r
235 --dirstat-by-file[=limit]\r
236 </term>\r
237 <listitem>\r
238 <simpara>\r
239         Same as --dirstat, but counts changed files instead of lines.\r
240 </simpara>\r
241 </listitem>\r
242 </varlistentry>\r
243 <varlistentry>\r
244 <term>\r
245 --summary\r
246 </term>\r
247 <listitem>\r
248 <simpara>\r
249         Output a condensed summary of extended header information\r
250         such as creations, renames and mode changes.\r
251 </simpara>\r
252 </listitem>\r
253 </varlistentry>\r
254 <varlistentry>\r
255 <term>\r
256 --patch-with-stat\r
257 </term>\r
258 <listitem>\r
259 <simpara>\r
260         Synonym for "-p --stat".\r
261         \r
262 </simpara>\r
263 </listitem>\r
264 </varlistentry>\r
265 <varlistentry>\r
266 <term>\r
267 -z\r
268 </term>\r
269 <listitem>\r
270 <simpara>\r
271         NUL-line termination on output.  This affects the --raw\r
272         output field terminator.  Also output from commands such\r
273         as "git-log" will be delimited with NUL between commits.\r
274 </simpara>\r
275 </listitem>\r
276 </varlistentry>\r
277 <varlistentry>\r
278 <term>\r
279 --name-only\r
280 </term>\r
281 <listitem>\r
282 <simpara>\r
283         Show only names of changed files.\r
284 </simpara>\r
285 </listitem>\r
286 </varlistentry>\r
287 <varlistentry>\r
288 <term>\r
289 --name-status\r
290 </term>\r
291 <listitem>\r
292 <simpara>\r
293         Show only names and status of changed files. See the description\r
294         of the <literal>--diff-filter</literal> option on what the status letters mean.\r
295 </simpara>\r
296 </listitem>\r
297 </varlistentry>\r
298 <varlistentry>\r
299 <term>\r
300 --color\r
301 </term>\r
302 <listitem>\r
303 <simpara>\r
304         Show colored diff.\r
305 </simpara>\r
306 </listitem>\r
307 </varlistentry>\r
308 <varlistentry>\r
309 <term>\r
310 --no-color\r
311 </term>\r
312 <listitem>\r
313 <simpara>\r
314         Turn off colored diff, even when the configuration file\r
315         gives the default to color output.\r
316 </simpara>\r
317 </listitem>\r
318 </varlistentry>\r
319 <varlistentry>\r
320 <term>\r
321 --color-words[=&lt;regex&gt;]\r
322 </term>\r
323 <listitem>\r
324 <simpara>\r
325         Show colored word diff, i.e., color words which have changed.\r
326         By default, words are separated by whitespace.\r
327 </simpara>\r
328 <simpara>When a &lt;regex&gt; is specified, every non-overlapping match of the\r
329 &lt;regex&gt; is considered a word.  Anything between these matches is\r
330 considered whitespace and ignored(!) for the purposes of finding\r
331 differences.  You may want to append <literal>|[^[:space:]]</literal> to your regular\r
332 expression to make sure that it matches all non-whitespace characters.\r
333 A match that contains a newline is silently truncated(!) at the\r
334 newline.</simpara>\r
335 <simpara>The regex can also be set via a diff driver or configuration option, see\r
336 <xref linkend="gitattributes(1)"/> or <xref linkend="git-config(1)"/>.  Giving it explicitly\r
337 overrides any diff driver or configuration setting.  Diff drivers\r
338 override configuration settings.</simpara>\r
339 </listitem>\r
340 </varlistentry>\r
341 <varlistentry>\r
342 <term>\r
343 --no-renames\r
344 </term>\r
345 <listitem>\r
346 <simpara>\r
347         Turn off rename detection, even when the configuration\r
348         file gives the default to do so.\r
349 </simpara>\r
350 </listitem>\r
351 </varlistentry>\r
352 <varlistentry>\r
353 <term>\r
354 --check\r
355 </term>\r
356 <listitem>\r
357 <simpara>\r
358         Warn if changes introduce trailing whitespace\r
359         or an indent that uses a space before a tab. Exits with\r
360         non-zero status if problems are found. Not compatible with\r
361         --exit-code.\r
362 </simpara>\r
363 </listitem>\r
364 </varlistentry>\r
365 <varlistentry>\r
366 <term>\r
367 --full-index\r
368 </term>\r
369 <listitem>\r
370 <simpara>\r
371         Instead of the first handful of characters, show the full\r
372         pre- and post-image blob object names on the "index"\r
373         line when generating patch format output.\r
374 </simpara>\r
375 </listitem>\r
376 </varlistentry>\r
377 <varlistentry>\r
378 <term>\r
379 --binary\r
380 </term>\r
381 <listitem>\r
382 <simpara>\r
383         In addition to --full-index, output "binary diff" that\r
384         can be applied with "git apply".\r
385 </simpara>\r
386 </listitem>\r
387 </varlistentry>\r
388 <varlistentry>\r
389 <term>\r
390 --abbrev[=&lt;n&gt;]\r
391 </term>\r
392 <listitem>\r
393 <simpara>\r
394         Instead of showing the full 40-byte hexadecimal object\r
395         name in diff-raw format output and diff-tree header\r
396         lines, show only a partial prefix.  This is\r
397         independent of --full-index option above, which controls\r
398         the diff-patch output format.  Non default number of\r
399         digits can be specified with --abbrev=&lt;n&gt;.\r
400 </simpara>\r
401 </listitem>\r
402 </varlistentry>\r
403 <varlistentry>\r
404 <term>\r
405 -B\r
406 </term>\r
407 <listitem>\r
408 <simpara>\r
409         Break complete rewrite changes into pairs of delete and create.\r
410 </simpara>\r
411 </listitem>\r
412 </varlistentry>\r
413 <varlistentry>\r
414 <term>\r
415 -M\r
416 </term>\r
417 <listitem>\r
418 <simpara>\r
419         Detect renames.\r
420 </simpara>\r
421 </listitem>\r
422 </varlistentry>\r
423 <varlistentry>\r
424 <term>\r
425 -C\r
426 </term>\r
427 <listitem>\r
428 <simpara>\r
429         Detect copies as well as renames.  See also <literal>--find-copies-harder</literal>.\r
430 </simpara>\r
431 </listitem>\r
432 </varlistentry>\r
433 <varlistentry>\r
434 <term>\r
435 --diff-filter=[ACDMRTUXB*]\r
436 </term>\r
437 <listitem>\r
438 <simpara>\r
439         Select only files that are Added (<literal>A</literal>), Copied (<literal>C</literal>),\r
440         Deleted (<literal>D</literal>), Modified (<literal>M</literal>), Renamed (<literal>R</literal>), have their\r
441         type (i.e. regular file, symlink, submodule, &#8230;) changed (<literal>T</literal>),\r
442         are Unmerged (<literal>U</literal>), are\r
443         Unknown (<literal>X</literal>), or have had their pairing Broken (<literal>B</literal>).\r
444         Any combination of the filter characters may be used.\r
445         When <literal>*</literal> (All-or-none) is added to the combination, all\r
446         paths are selected if there is any file that matches\r
447         other criteria in the comparison; if there is no file\r
448         that matches other criteria, nothing is selected.\r
449 </simpara>\r
450 </listitem>\r
451 </varlistentry>\r
452 <varlistentry>\r
453 <term>\r
454 --find-copies-harder\r
455 </term>\r
456 <listitem>\r
457 <simpara>\r
458         For performance reasons, by default, <literal>-C</literal> option finds copies only\r
459         if the original file of the copy was modified in the same\r
460         changeset.  This flag makes the command\r
461         inspect unmodified files as candidates for the source of\r
462         copy.  This is a very expensive operation for large\r
463         projects, so use it with caution.  Giving more than one\r
464         <literal>-C</literal> option has the same effect.\r
465 </simpara>\r
466 </listitem>\r
467 </varlistentry>\r
468 <varlistentry>\r
469 <term>\r
470 -l&lt;num&gt;\r
471 </term>\r
472 <listitem>\r
473 <simpara>\r
474         -M and -C options require O(n^2) processing time where n\r
475         is the number of potential rename/copy targets.  This\r
476         option prevents rename/copy detection from running if\r
477         the number of rename/copy targets exceeds the specified\r
478         number.\r
479 </simpara>\r
480 </listitem>\r
481 </varlistentry>\r
482 <varlistentry>\r
483 <term>\r
484 -S&lt;string&gt;\r
485 </term>\r
486 <listitem>\r
487 <simpara>\r
488         Look for differences that contain the change in &lt;string&gt;.\r
489 </simpara>\r
490 </listitem>\r
491 </varlistentry>\r
492 <varlistentry>\r
493 <term>\r
494 --pickaxe-all\r
495 </term>\r
496 <listitem>\r
497 <simpara>\r
498         When -S finds a change, show all the changes in that\r
499         changeset, not just the files that contain the change\r
500         in &lt;string&gt;.\r
501 </simpara>\r
502 </listitem>\r
503 </varlistentry>\r
504 <varlistentry>\r
505 <term>\r
506 --pickaxe-regex\r
507 </term>\r
508 <listitem>\r
509 <simpara>\r
510         Make the &lt;string&gt; not a plain string but an extended POSIX\r
511         regex to match.\r
512 </simpara>\r
513 </listitem>\r
514 </varlistentry>\r
515 <varlistentry>\r
516 <term>\r
517 -O&lt;orderfile&gt;\r
518 </term>\r
519 <listitem>\r
520 <simpara>\r
521         Output the patch in the order specified in the\r
522         &lt;orderfile&gt;, which has one shell glob pattern per line.\r
523 </simpara>\r
524 </listitem>\r
525 </varlistentry>\r
526 <varlistentry>\r
527 <term>\r
528 -R\r
529 </term>\r
530 <listitem>\r
531 <simpara>\r
532         Swap two inputs; that is, show differences from index or\r
533         on-disk file to tree contents.\r
534 </simpara>\r
535 </listitem>\r
536 </varlistentry>\r
537 <varlistentry>\r
538 <term>\r
539 --relative[=&lt;path&gt;]\r
540 </term>\r
541 <listitem>\r
542 <simpara>\r
543         When run from a subdirectory of the project, it can be\r
544         told to exclude changes outside the directory and show\r
545         pathnames relative to it with this option.  When you are\r
546         not in a subdirectory (e.g. in a bare repository), you\r
547         can name which subdirectory to make the output relative\r
548         to by giving a &lt;path&gt; as an argument.\r
549 </simpara>\r
550 </listitem>\r
551 </varlistentry>\r
552 <varlistentry>\r
553 <term>\r
554 -a\r
555 </term>\r
556 <term>\r
557 --text\r
558 </term>\r
559 <listitem>\r
560 <simpara>\r
561         Treat all files as text.\r
562 </simpara>\r
563 </listitem>\r
564 </varlistentry>\r
565 <varlistentry>\r
566 <term>\r
567 --ignore-space-at-eol\r
568 </term>\r
569 <listitem>\r
570 <simpara>\r
571         Ignore changes in whitespace at EOL.\r
572 </simpara>\r
573 </listitem>\r
574 </varlistentry>\r
575 <varlistentry>\r
576 <term>\r
577 -b\r
578 </term>\r
579 <term>\r
580 --ignore-space-change\r
581 </term>\r
582 <listitem>\r
583 <simpara>\r
584         Ignore changes in amount of whitespace.  This ignores whitespace\r
585         at line end, and considers all other sequences of one or\r
586         more whitespace characters to be equivalent.\r
587 </simpara>\r
588 </listitem>\r
589 </varlistentry>\r
590 <varlistentry>\r
591 <term>\r
592 -w\r
593 </term>\r
594 <term>\r
595 --ignore-all-space\r
596 </term>\r
597 <listitem>\r
598 <simpara>\r
599         Ignore whitespace when comparing lines.  This ignores\r
600         differences even if one line has whitespace where the other\r
601         line has none.\r
602 </simpara>\r
603 </listitem>\r
604 </varlistentry>\r
605 <varlistentry>\r
606 <term>\r
607 --inter-hunk-context=&lt;lines&gt;\r
608 </term>\r
609 <listitem>\r
610 <simpara>\r
611         Show the context between diff hunks, up to the specified number\r
612         of lines, thereby fusing hunks that are close to each other.\r
613 </simpara>\r
614 </listitem>\r
615 </varlistentry>\r
616 <varlistentry>\r
617 <term>\r
618 --exit-code\r
619 </term>\r
620 <listitem>\r
621 <simpara>\r
622         Make the program exit with codes similar to diff(1).\r
623         That is, it exits with 1 if there were differences and\r
624         0 means no differences.\r
625 </simpara>\r
626 </listitem>\r
627 </varlistentry>\r
628 <varlistentry>\r
629 <term>\r
630 --quiet\r
631 </term>\r
632 <listitem>\r
633 <simpara>\r
634         Disable all output of the program. Implies --exit-code.\r
635 </simpara>\r
636 </listitem>\r
637 </varlistentry>\r
638 <varlistentry>\r
639 <term>\r
640 --ext-diff\r
641 </term>\r
642 <listitem>\r
643 <simpara>\r
644         Allow an external diff helper to be executed. If you set an\r
645         external diff driver with <xref linkend="gitattributes(5)"/>, you need\r
646         to use this option with <xref linkend="git-log(1)"/> and friends.\r
647 </simpara>\r
648 </listitem>\r
649 </varlistentry>\r
650 <varlistentry>\r
651 <term>\r
652 --no-ext-diff\r
653 </term>\r
654 <listitem>\r
655 <simpara>\r
656         Disallow external diff drivers.\r
657 </simpara>\r
658 </listitem>\r
659 </varlistentry>\r
660 <varlistentry>\r
661 <term>\r
662 --ignore-submodules\r
663 </term>\r
664 <listitem>\r
665 <simpara>\r
666         Ignore changes to submodules in the diff generation.\r
667 </simpara>\r
668 </listitem>\r
669 </varlistentry>\r
670 <varlistentry>\r
671 <term>\r
672 --src-prefix=&lt;prefix&gt;\r
673 </term>\r
674 <listitem>\r
675 <simpara>\r
676         Show the given source prefix instead of "a/".\r
677 </simpara>\r
678 </listitem>\r
679 </varlistentry>\r
680 <varlistentry>\r
681 <term>\r
682 --dst-prefix=&lt;prefix&gt;\r
683 </term>\r
684 <listitem>\r
685 <simpara>\r
686         Show the given destination prefix instead of "b/".\r
687 </simpara>\r
688 </listitem>\r
689 </varlistentry>\r
690 <varlistentry>\r
691 <term>\r
692 --no-prefix\r
693 </term>\r
694 <listitem>\r
695 <simpara>\r
696         Do not show any source or destination prefix.\r
697 </simpara>\r
698 </listitem>\r
699 </varlistentry>\r
700 </variablelist>\r
701 <simpara>For more detailed explanation on these common options, see also\r
702 <xref linkend="gitdiffcore(7)"/>.</simpara>\r
703 <variablelist>\r
704 <varlistentry>\r
705 <term>\r
706 &lt;path&gt;&#8230;\r
707 </term>\r
708 <listitem>\r
709 <simpara>\r
710         The &lt;paths&gt; parameters, when given, are used to limit\r
711         the diff to the named paths (you can give directory\r
712         names and get diff for all files under them).\r
713 </simpara>\r
714 </listitem>\r
715 </varlistentry>\r
716 </variablelist>\r
717 </simplesect>\r
718 <simplesect id="_output_format">\r
719 <title>Output format</title>\r
720 <simpara>The output format from "git-diff-index", "git-diff-tree",\r
721 "git-diff-files" and "git diff --raw" are very similar.</simpara>\r
722 <simpara>These commands all compare two sets of things; what is\r
723 compared differs:</simpara>\r
724 <variablelist>\r
725 <varlistentry>\r
726 <term>\r
727 git-diff-index &lt;tree-ish&gt;\r
728 </term>\r
729 <listitem>\r
730 <simpara>\r
731         compares the &lt;tree-ish&gt; and the files on the filesystem.\r
732 </simpara>\r
733 </listitem>\r
734 </varlistentry>\r
735 <varlistentry>\r
736 <term>\r
737 git-diff-index --cached &lt;tree-ish&gt;\r
738 </term>\r
739 <listitem>\r
740 <simpara>\r
741         compares the &lt;tree-ish&gt; and the index.\r
742 </simpara>\r
743 </listitem>\r
744 </varlistentry>\r
745 <varlistentry>\r
746 <term>\r
747 git-diff-tree [-r] &lt;tree-ish-1&gt; &lt;tree-ish-2&gt; [&lt;pattern&gt;&#8230;]\r
748 </term>\r
749 <listitem>\r
750 <simpara>\r
751         compares the trees named by the two arguments.\r
752 </simpara>\r
753 </listitem>\r
754 </varlistentry>\r
755 <varlistentry>\r
756 <term>\r
757 git-diff-files [&lt;pattern&gt;&#8230;]\r
758 </term>\r
759 <listitem>\r
760 <simpara>\r
761         compares the index and the files on the filesystem.\r
762 </simpara>\r
763 </listitem>\r
764 </varlistentry>\r
765 </variablelist>\r
766 <simpara>An output line is formatted this way:</simpara>\r
767 <literallayout>in-place edit  :100644 100644 bcd1234... 0123456... M file0\r
768 copy-edit      :100644 100644 abcd123... 1234567... C68 file1 file2\r
769 rename-edit    :100644 100644 abcd123... 1234567... R86 file1 file3\r
770 create         :000000 100644 0000000... 1234567... A file4\r
771 delete         :100644 000000 1234567... 0000000... D file5\r
772 unmerged       :000000 000000 0000000... 0000000... U file6</literallayout>\r
773 <simpara>That is, from the left to the right:</simpara>\r
774 <orderedlist numeration="arabic">\r
775 <listitem>\r
776 <simpara>\r
777 a colon.\r
778 </simpara>\r
779 </listitem>\r
780 <listitem>\r
781 <simpara>\r
782 mode for "src"; 000000 if creation or unmerged.\r
783 </simpara>\r
784 </listitem>\r
785 <listitem>\r
786 <simpara>\r
787 a space.\r
788 </simpara>\r
789 </listitem>\r
790 <listitem>\r
791 <simpara>\r
792 mode for "dst"; 000000 if deletion or unmerged.\r
793 </simpara>\r
794 </listitem>\r
795 <listitem>\r
796 <simpara>\r
797 a space.\r
798 </simpara>\r
799 </listitem>\r
800 <listitem>\r
801 <simpara>\r
802 sha1 for "src"; 0{40} if creation or unmerged.\r
803 </simpara>\r
804 </listitem>\r
805 <listitem>\r
806 <simpara>\r
807 a space.\r
808 </simpara>\r
809 </listitem>\r
810 <listitem>\r
811 <simpara>\r
812 sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".\r
813 </simpara>\r
814 </listitem>\r
815 <listitem>\r
816 <simpara>\r
817 a space.\r
818 </simpara>\r
819 </listitem>\r
820 <listitem>\r
821 <simpara>\r
822 status, followed by optional "score" number.\r
823 </simpara>\r
824 </listitem>\r
825 <listitem>\r
826 <simpara>\r
827 a tab or a NUL when <emphasis>-z</emphasis> option is used.\r
828 </simpara>\r
829 </listitem>\r
830 <listitem>\r
831 <simpara>\r
832 path for "src"\r
833 </simpara>\r
834 </listitem>\r
835 <listitem>\r
836 <simpara>\r
837 a tab or a NUL when <emphasis>-z</emphasis> option is used; only exists for C or R.\r
838 </simpara>\r
839 </listitem>\r
840 <listitem>\r
841 <simpara>\r
842 path for "dst"; only exists for C or R.\r
843 </simpara>\r
844 </listitem>\r
845 <listitem>\r
846 <simpara>\r
847 an LF or a NUL when <emphasis>-z</emphasis> option is used, to terminate the record.\r
848 </simpara>\r
849 </listitem>\r
850 </orderedlist>\r
851 <simpara>Possible status letters are:</simpara>\r
852 <itemizedlist>\r
853 <listitem>\r
854 <simpara>\r
855 A: addition of a file\r
856 </simpara>\r
857 </listitem>\r
858 <listitem>\r
859 <simpara>\r
860 C: copy of a file into a new one\r
861 </simpara>\r
862 </listitem>\r
863 <listitem>\r
864 <simpara>\r
865 D: deletion of a file\r
866 </simpara>\r
867 </listitem>\r
868 <listitem>\r
869 <simpara>\r
870 M: modification of the contents or mode of a file\r
871 </simpara>\r
872 </listitem>\r
873 <listitem>\r
874 <simpara>\r
875 R: renaming of a file\r
876 </simpara>\r
877 </listitem>\r
878 <listitem>\r
879 <simpara>\r
880 T: change in the type of the file\r
881 </simpara>\r
882 </listitem>\r
883 <listitem>\r
884 <simpara>\r
885 U: file is unmerged (you must complete the merge before it can\r
886 be committed)\r
887 </simpara>\r
888 </listitem>\r
889 <listitem>\r
890 <simpara>\r
891 X: "unknown" change type (most probably a bug, please report it)\r
892 </simpara>\r
893 </listitem>\r
894 </itemizedlist>\r
895 <simpara>Status letters C and R are always followed by a score (denoting the\r
896 percentage of similarity between the source and target of the move or\r
897 copy), and are the only ones to be so.</simpara>\r
898 <simpara>&lt;sha1&gt; is shown as all 0&#8217;s if a file is new on the filesystem\r
899 and it is out of sync with the index.</simpara>\r
900 <simpara>Example:</simpara>\r
901 <literallayout>:100644 100644 5be4a4...... 000000...... M file.c</literallayout>\r
902 <simpara>When <literal>-z</literal> option is not used, TAB, LF, and backslash characters\r
903 in pathnames are represented as <literal>\t</literal>, <literal>\n</literal>, and <literal>\\</literal>,\r
904 respectively.</simpara>\r
905 </simplesect>\r
906 <simplesect id="_diff_format_for_merges">\r
907 <title>diff format for merges</title>\r
908 <simpara>"git-diff-tree", "git-diff-files" and "git-diff --raw"\r
909 can take <emphasis>-c</emphasis> or <emphasis>--cc</emphasis> option\r
910 to generate diff output also for merge commits.  The output differs\r
911 from the format described above in the following way:</simpara>\r
912 <orderedlist numeration="arabic">\r
913 <listitem>\r
914 <simpara>\r
915 there is a colon for each parent\r
916 </simpara>\r
917 </listitem>\r
918 <listitem>\r
919 <simpara>\r
920 there are more "src" modes and "src" sha1\r
921 </simpara>\r
922 </listitem>\r
923 <listitem>\r
924 <simpara>\r
925 status is concatenated status characters for each parent\r
926 </simpara>\r
927 </listitem>\r
928 <listitem>\r
929 <simpara>\r
930 no optional "score" number\r
931 </simpara>\r
932 </listitem>\r
933 <listitem>\r
934 <simpara>\r
935 single path, only for "dst"\r
936 </simpara>\r
937 </listitem>\r
938 </orderedlist>\r
939 <simpara>Example:</simpara>\r
940 <literallayout>::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c</literallayout>\r
941 <simpara>Note that <emphasis>combined diff</emphasis> lists only files which were modified from\r
942 all parents.</simpara>\r
943 </simplesect>\r
944 <simplesect id="_generating_patches_with_p">\r
945 <title>Generating patches with -p</title>\r
946 <simpara>When "git-diff-index", "git-diff-tree", or "git-diff-files" are run\r
947 with a <emphasis>-p</emphasis> option, "git diff" without the <emphasis>--raw</emphasis> option, or\r
948 "git log" with the "-p" option, they\r
949 do not produce the output described above; instead they produce a\r
950 patch file.  You can customize the creation of such patches via the\r
951 GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables.</simpara>\r
952 <simpara>What the -p option produces is slightly different from the traditional\r
953 diff format.</simpara>\r
954 <orderedlist numeration="arabic">\r
955 <listitem>\r
956 <simpara>\r
957 It is preceded with a "git diff" header, that looks like\r
958      this:\r
959 </simpara>\r
960 <literallayout class="monospaced">diff --git a/file1 b/file2</literallayout>\r
961 <simpara>The <literal>a/</literal> and <literal>b/</literal> filenames are the same unless rename/copy is\r
962 involved.  Especially, even for a creation or a deletion,\r
963 <literal>/dev/null</literal> is <emphasis>not</emphasis> used in place of <literal>a/</literal> or <literal>b/</literal> filenames.</simpara>\r
964 <simpara>When rename/copy is involved, <literal>file1</literal> and <literal>file2</literal> show the\r
965 name of the source file of the rename/copy and the name of\r
966 the file that rename/copy produces, respectively.</simpara>\r
967 </listitem>\r
968 <listitem>\r
969 <simpara>\r
970 It is followed by one or more extended header lines:\r
971 </simpara>\r
972 <literallayout class="monospaced">old mode &lt;mode&gt;\r
973 new mode &lt;mode&gt;\r
974 deleted file mode &lt;mode&gt;\r
975 new file mode &lt;mode&gt;\r
976 copy from &lt;path&gt;\r
977 copy to &lt;path&gt;\r
978 rename from &lt;path&gt;\r
979 rename to &lt;path&gt;\r
980 similarity index &lt;number&gt;\r
981 dissimilarity index &lt;number&gt;\r
982 index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;</literallayout>\r
983 </listitem>\r
984 <listitem>\r
985 <simpara>\r
986 TAB, LF, double quote and backslash characters in pathnames\r
987     are represented as <literal>\t</literal>, <literal>\n</literal>, <literal>\"</literal> and <literal>\\</literal>, respectively.\r
988     If there is need for such substitution then the whole\r
989     pathname is put in double quotes.\r
990 </simpara>\r
991 </listitem>\r
992 </orderedlist>\r
993 <simpara>The similarity index is the percentage of unchanged lines, and\r
994 the dissimilarity index is the percentage of changed lines.  It\r
995 is a rounded down integer, followed by a percent sign.  The\r
996 similarity index value of 100% is thus reserved for two equal\r
997 files, while 100% dissimilarity means that no line from the old\r
998 file made it into the new one.</simpara>\r
999 </simplesect>\r
1000 <simplesect id="_combined_diff_format">\r
1001 <title>combined diff format</title>\r
1002 <simpara>"git-diff-tree", "git-diff-files" and "git-diff" can take <emphasis>-c</emphasis> or\r
1003 <emphasis>--cc</emphasis> option to produce <emphasis>combined diff</emphasis>.  For showing a merge commit\r
1004 with "git log -p", this is the default format.\r
1005 A <emphasis>combined diff</emphasis> format looks like this:</simpara>\r
1006 <literallayout>diff --combined describe.c\r
1007 index fabadb8,cc95eb0..4866510\r
1008 --- a/describe.c\r
1009 +++ b/describe.c\r
1010 @@@ -98,20 -98,12 +98,20 @@@\r
1011         return (a_date &gt; b_date) ? -1 : (a_date == b_date) ? 0 : 1;\r
1012   }\r
1013 \r
1014 - static void describe(char *arg)\r
1015  -static void describe(struct commit *cmit, int last_one)\r
1016 ++static void describe(char *arg, int last_one)\r
1017   {\r
1018  +      unsigned char sha1[20];\r
1019  +      struct commit *cmit;\r
1020         struct commit_list *list;\r
1021         static int initialized = 0;\r
1022         struct commit_name *n;\r
1023 \r
1024  +      if (get_sha1(arg, sha1) &lt; 0)\r
1025  +              usage(describe_usage);\r
1026  +      cmit = lookup_commit_reference(sha1);\r
1027  +      if (!cmit)\r
1028  +              usage(describe_usage);\r
1029  +\r
1030         if (!initialized) {\r
1031                 initialized = 1;\r
1032                 for_each_ref(get_name);</literallayout>\r
1033 <orderedlist numeration="arabic">\r
1034 <listitem>\r
1035 <simpara>\r
1036 It is preceded with a "git diff" header, that looks like\r
1037      this (when <emphasis>-c</emphasis> option is used):\r
1038 </simpara>\r
1039 <literallayout class="monospaced">diff --combined file</literallayout>\r
1040 <simpara>or like this (when <emphasis>--cc</emphasis> option is used):</simpara>\r
1041 <literallayout class="monospaced">diff --cc file</literallayout>\r
1042 </listitem>\r
1043 <listitem>\r
1044 <simpara>\r
1045 It is followed by one or more extended header lines\r
1046      (this example shows a merge with two parents):\r
1047 </simpara>\r
1048 <literallayout class="monospaced">index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;\r
1049 mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;\r
1050 new file mode &lt;mode&gt;\r
1051 deleted file mode &lt;mode&gt;,&lt;mode&gt;</literallayout>\r
1052 <simpara>The <literal>mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;</literal> line appears only if at least one of\r
1053 the &lt;mode&gt; is different from the rest. Extended headers with\r
1054 information about detected contents movement (renames and\r
1055 copying detection) are designed to work with diff of two\r
1056 &lt;tree-ish&gt; and are not used by combined diff format.</simpara>\r
1057 </listitem>\r
1058 <listitem>\r
1059 <simpara>\r
1060 It is followed by two-line from-file/to-file header\r
1061 </simpara>\r
1062 <literallayout class="monospaced">--- a/file\r
1063 +++ b/file</literallayout>\r
1064 <simpara>Similar to two-line header for traditional <emphasis>unified</emphasis> diff\r
1065 format, <literal>/dev/null</literal> is used to signal created or deleted\r
1066 files.</simpara>\r
1067 </listitem>\r
1068 <listitem>\r
1069 <simpara>\r
1070 Chunk header format is modified to prevent people from\r
1071      accidentally feeding it to <literal>patch -p1</literal>. Combined diff format\r
1072      was created for review of merge commit changes, and was not\r
1073      meant for apply. The change is similar to the change in the\r
1074      extended <emphasis>index</emphasis> header:\r
1075 </simpara>\r
1076 <literallayout class="monospaced">@@@ &lt;from-file-range&gt; &lt;from-file-range&gt; &lt;to-file-range&gt; @@@</literallayout>\r
1077 <simpara>There are (number of parents + 1) <literal>@</literal> characters in the chunk\r
1078 header for combined diff format.</simpara>\r
1079 </listitem>\r
1080 </orderedlist>\r
1081 <simpara>Unlike the traditional <emphasis>unified</emphasis> diff format, which shows two\r
1082 files A and B with a single column that has <literal>-</literal> (minus&#8201;&#8212;&#8201;appears in A but removed in B), <literal>+</literal> (plus&#8201;&#8212;&#8201;missing in A but\r
1083 added to B), or <literal>" "</literal> (space&#8201;&#8212;&#8201;unchanged) prefix, this format\r
1084 compares two or more files file1, file2,&#8230; with one file X, and\r
1085 shows how X differs from each of fileN.  One column for each of\r
1086 fileN is prepended to the output line to note how X&#8217;s line is\r
1087 different from it.</simpara>\r
1088 <simpara>A <literal>-</literal> character in the column N means that the line appears in\r
1089 fileN but it does not appear in the result.  A <literal>+</literal> character\r
1090 in the column N means that the line appears in the result,\r
1091 and fileN does not have that line (in other words, the line was\r
1092 added, from the point of view of that parent).</simpara>\r
1093 <simpara>In the above example output, the function signature was changed\r
1094 from both files (hence two <literal>-</literal> removals from both file1 and\r
1095 file2, plus <literal>++</literal> to mean one line that was added does not appear\r
1096 in either file1 nor file2).  Also eight other lines are the same\r
1097 from file1 but do not appear in file2 (hence prefixed with <literal>&#43;</literal>).</simpara>\r
1098 <simpara>When shown by <literal>git diff-tree -c</literal>, it compares the parents of a\r
1099 merge commit with the merge result (i.e. file1..fileN are the\r
1100 parents).  When shown by <literal>git diff-files -c</literal>, it compares the\r
1101 two unresolved merge parents with the working tree file\r
1102 (i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka\r
1103 "their version").</simpara>\r
1104 </simplesect>\r
1105 <simplesect id="_other_diff_formats">\r
1106 <title>other diff formats</title>\r
1107 <simpara>The <literal>--summary</literal> option describes newly added, deleted, renamed and\r
1108 copied files.  The <literal>--stat</literal> option adds diffstat(1) graph to the\r
1109 output.  These options can be combined with other options, such as\r
1110 <literal>-p</literal>, and are meant for human consumption.</simpara>\r
1111 <simpara>When showing a change that involves a rename or a copy, <literal>--stat</literal> output\r
1112 formats the pathnames compactly by combining common prefix and suffix of\r
1113 the pathnames.  For example, a change that moves <literal>arch/i386/Makefile</literal> to\r
1114 <literal>arch/x86/Makefile</literal> while modifying 4 lines will be shown like this:</simpara>\r
1115 <literallayout>arch/{i386 =&gt; x86}/Makefile    |   4 +--</literallayout>\r
1116 <simpara>The <literal>--numstat</literal> option gives the diffstat(1) information but is designed\r
1117 for easier machine consumption.  An entry in <literal>--numstat</literal> output looks\r
1118 like this:</simpara>\r
1119 <literallayout>1       2       README\r
1120 3       1       arch/{i386 =&gt; x86}/Makefile</literallayout>\r
1121 <simpara>That is, from left to right:</simpara>\r
1122 <orderedlist numeration="arabic">\r
1123 <listitem>\r
1124 <simpara>\r
1125 the number of added lines;\r
1126 </simpara>\r
1127 </listitem>\r
1128 <listitem>\r
1129 <simpara>\r
1130 a tab;\r
1131 </simpara>\r
1132 </listitem>\r
1133 <listitem>\r
1134 <simpara>\r
1135 the number of deleted lines;\r
1136 </simpara>\r
1137 </listitem>\r
1138 <listitem>\r
1139 <simpara>\r
1140 a tab;\r
1141 </simpara>\r
1142 </listitem>\r
1143 <listitem>\r
1144 <simpara>\r
1145 pathname (possibly with rename/copy information);\r
1146 </simpara>\r
1147 </listitem>\r
1148 <listitem>\r
1149 <simpara>\r
1150 a newline.\r
1151 </simpara>\r
1152 </listitem>\r
1153 </orderedlist>\r
1154 <simpara>When <literal>-z</literal> output option is in effect, the output is formatted this way:</simpara>\r
1155 <literallayout>1       2       README NUL\r
1156 3       1       NUL arch/i386/Makefile NUL arch/x86/Makefile NUL</literallayout>\r
1157 <simpara>That is:</simpara>\r
1158 <orderedlist numeration="arabic">\r
1159 <listitem>\r
1160 <simpara>\r
1161 the number of added lines;\r
1162 </simpara>\r
1163 </listitem>\r
1164 <listitem>\r
1165 <simpara>\r
1166 a tab;\r
1167 </simpara>\r
1168 </listitem>\r
1169 <listitem>\r
1170 <simpara>\r
1171 the number of deleted lines;\r
1172 </simpara>\r
1173 </listitem>\r
1174 <listitem>\r
1175 <simpara>\r
1176 a tab;\r
1177 </simpara>\r
1178 </listitem>\r
1179 <listitem>\r
1180 <simpara>\r
1181 a NUL (only exists if renamed/copied);\r
1182 </simpara>\r
1183 </listitem>\r
1184 <listitem>\r
1185 <simpara>\r
1186 pathname in preimage;\r
1187 </simpara>\r
1188 </listitem>\r
1189 <listitem>\r
1190 <simpara>\r
1191 a NUL (only exists if renamed/copied);\r
1192 </simpara>\r
1193 </listitem>\r
1194 <listitem>\r
1195 <simpara>\r
1196 pathname in postimage (only exists if renamed/copied);\r
1197 </simpara>\r
1198 </listitem>\r
1199 <listitem>\r
1200 <simpara>\r
1201 a NUL.\r
1202 </simpara>\r
1203 </listitem>\r
1204 </orderedlist>\r
1205 <simpara>The extra <literal>NUL</literal> before the preimage path in renamed case is to allow\r
1206 scripts that read the output to tell if the current record being read is\r
1207 a single-path record or a rename/copy record without reading ahead.\r
1208 After reading added and deleted lines, reading up to <literal>NUL</literal> would yield\r
1209 the pathname, but if that is <literal>NUL</literal>, the record will show two paths.</simpara>\r
1210 </simplesect>\r
1211 <simplesect id="_examples">\r
1212 <title>EXAMPLES</title>\r
1213 <variablelist>\r
1214 <varlistentry>\r
1215 <term>\r
1216 Various ways to check your working tree\r
1217 </term>\r
1218 <listitem>\r
1219 <literallayout>$ git diff            <co id="CO1-1"/>\r
1220 $ git diff --cached   <co id="CO1-2"/>\r
1221 $ git diff HEAD       <co id="CO1-3"/></literallayout>\r
1222 <calloutlist>\r
1223 <callout arearefs="CO1-1">\r
1224 <simpara>\r
1225 Changes in the working tree not yet staged for the next commit.\r
1226 </simpara>\r
1227 </callout>\r
1228 <callout arearefs="CO1-2">\r
1229 <simpara>\r
1230 Changes between the index and your last commit; what you\r
1231 would be committing if you run "git commit" without "-a" option.\r
1232 </simpara>\r
1233 </callout>\r
1234 <callout arearefs="CO1-3">\r
1235 <simpara>\r
1236 Changes in the working tree since your last commit; what you\r
1237 would be committing if you run "git commit -a"\r
1238 </simpara>\r
1239 </callout>\r
1240 </calloutlist>\r
1241 </listitem>\r
1242 </varlistentry>\r
1243 <varlistentry>\r
1244 <term>\r
1245 Comparing with arbitrary commits\r
1246 </term>\r
1247 <listitem>\r
1248 <literallayout>$ git diff test            <co id="CO2-1"/>\r
1249 $ git diff HEAD -- ./test  <co id="CO2-2"/>\r
1250 $ git diff HEAD^ HEAD      <co id="CO2-3"/></literallayout>\r
1251 <calloutlist>\r
1252 <callout arearefs="CO2-1">\r
1253 <simpara>\r
1254 Instead of using the tip of the current branch, compare with the\r
1255 tip of "test" branch.\r
1256 </simpara>\r
1257 </callout>\r
1258 <callout arearefs="CO2-2">\r
1259 <simpara>\r
1260 Instead of comparing with the tip of "test" branch, compare with\r
1261 the tip of the current branch, but limit the comparison to the\r
1262 file "test".\r
1263 </simpara>\r
1264 </callout>\r
1265 <callout arearefs="CO2-3">\r
1266 <simpara>\r
1267 Compare the version before the last commit and the last commit.\r
1268 </simpara>\r
1269 </callout>\r
1270 </calloutlist>\r
1271 </listitem>\r
1272 </varlistentry>\r
1273 <varlistentry>\r
1274 <term>\r
1275 Comparing branches\r
1276 </term>\r
1277 <listitem>\r
1278 <literallayout>$ git diff topic master    <co id="CO3-1"/>\r
1279 $ git diff topic..master   <co id="CO3-2"/>\r
1280 $ git diff topic...master  <co id="CO3-3"/></literallayout>\r
1281 <calloutlist>\r
1282 <callout arearefs="CO3-1">\r
1283 <simpara>\r
1284 Changes between the tips of the topic and the master branches.\r
1285 </simpara>\r
1286 </callout>\r
1287 <callout arearefs="CO3-2">\r
1288 <simpara>\r
1289 Same as above.\r
1290 </simpara>\r
1291 </callout>\r
1292 <callout arearefs="CO3-3">\r
1293 <simpara>\r
1294 Changes that occurred on the master branch since when the topic\r
1295 branch was started off it.\r
1296 </simpara>\r
1297 </callout>\r
1298 </calloutlist>\r
1299 </listitem>\r
1300 </varlistentry>\r
1301 <varlistentry>\r
1302 <term>\r
1303 Limiting the diff output\r
1304 </term>\r
1305 <listitem>\r
1306 <literallayout>$ git diff --diff-filter=MRC            <co id="CO4-1"/>\r
1307 $ git diff --name-status                <co id="CO4-2"/>\r
1308 $ git diff arch/i386 include/asm-i386   <co id="CO4-3"/></literallayout>\r
1309 <calloutlist>\r
1310 <callout arearefs="CO4-1">\r
1311 <simpara>\r
1312 Show only modification, rename and copy, but not addition\r
1313 nor deletion.\r
1314 </simpara>\r
1315 </callout>\r
1316 <callout arearefs="CO4-2">\r
1317 <simpara>\r
1318 Show only names and the nature of change, but not actual\r
1319 diff output.\r
1320 </simpara>\r
1321 </callout>\r
1322 <callout arearefs="CO4-3">\r
1323 <simpara>\r
1324 Limit diff output to named subtrees.\r
1325 </simpara>\r
1326 </callout>\r
1327 </calloutlist>\r
1328 </listitem>\r
1329 </varlistentry>\r
1330 <varlistentry>\r
1331 <term>\r
1332 Munging the diff output\r
1333 </term>\r
1334 <listitem>\r
1335 <literallayout>$ git diff --find-copies-harder -B -C  <co id="CO5-1"/>\r
1336 $ git diff -R                          <co id="CO5-2"/></literallayout>\r
1337 <calloutlist>\r
1338 <callout arearefs="CO5-1">\r
1339 <simpara>\r
1340 Spend extra cycles to find renames, copies and complete\r
1341 rewrites (very expensive).\r
1342 </simpara>\r
1343 </callout>\r
1344 <callout arearefs="CO5-2">\r
1345 <simpara>\r
1346 Output diff in reverse.\r
1347 </simpara>\r
1348 </callout>\r
1349 </calloutlist>\r
1350 </listitem>\r
1351 </varlistentry>\r
1352 </variablelist>\r
1353 </simplesect>\r
1354 <simplesect id="_author">\r
1355 <title>Author</title>\r
1356 <simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>\r
1357 </simplesect>\r
1358 <simplesect id="_documentation">\r
1359 <title>Documentation</title>\r
1360 <simpara>Documentation by Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
1361 </simplesect>\r
1362 <simplesect id="_git">\r
1363 <title>GIT</title>\r
1364 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
1365 </simplesect>\r
1366 </article>\r