1 .\"Generated by db2man.xsl. Don't modify this, modify the source.
10 .de Sp \" Vertical space (when we can't use .PP)
16 .ie \\n(.$>=3 .ne \\$3
20 .TH "GIT-DIFF" 1 "" "" ""
22 git-diff \- Show changes between commits, commit and working tree, etc
26 \fIgit\-diff\fR [ \-\-diff\-options ] <ent>{0,2} [<path>...]
31 Show changes between two ents, an ent and the working tree, an ent and the index file, or the index file and the working tree\&. The combination of what is compared with what is determined by the number of ents given to the command\&.
35 When no <ent> is given, the working tree and the index file is compared, using git\-diff\-files\&.
38 When one <ent> is given, the working tree and the named tree is compared, using git\-diff\-index\&. The option \-\-cached can be given to compare the index file and the named tree\&.
41 When two <ent>s are given, these two trees are compared using git\-diff\-tree\&.
48 \fI\-\-diff\-options\fR are passed to the git\-diff\-files, git\-diff\-index, and git\-diff\-tree commands\&. See the documentation for these commands for description\&.
52 The <path> arguments are also passed to git\-diff\-* commands\&.
57 Various ways to check your working tree
61 $ git diff \-\-cached \fB(2)\fR
62 $ git diff HEAD \fB(3)\fR
65 \fB1. \fRchanges in the working tree since your last git\-update\-index\&.
67 \fB2. \fRchanges between the index and your last commit; what you would be committing if you run "git commit" without "\-a" option\&.
69 \fB3. \fRchanges in the working tree since your last commit; what you would be committing if you run "git commit \-a"
74 Comparing with arbitrary commits
77 $ git diff test \fB(1)\fR
78 $ git diff HEAD \-\- \&./test \fB(2)\fR
79 $ git diff HEAD^ HEAD \fB(3)\fR
82 \fB1. \fRinstead of using the tip of the current branch, compare with the tip of "test" branch\&.
84 \fB2. \fRinstead of comparing with the tip of "test" branch, compare with the tip of the current branch, but limit the comparison to the file "test"\&.
86 \fB3. \fRcompare the version before the last commit and the last commit\&.
91 Limiting the diff output
94 $ git diff \-\-diff\-filter=MRC \fB(1)\fR
95 $ git diff \-\-name\-status \-r \fB(2)\fR
96 $ git diff arch/i386 include/asm\-i386 \fB(3)\fR
99 \fB1. \fRshow only modification, rename and copy, but not addition nor deletion\&.
101 \fB2. \fRshow only names and the nature of change, but not actual diff output\&. \-\-name\-status disables usual patch generation which in turn also disables recursive behaviour, so without \-r you would only see the directory name if there is a change in a file in a subdirectory\&.
103 \fB3. \fRlimit diff output to named subtrees\&.
108 Munging the diff output
111 $ git diff \-\-find\-copies\-harder \-B \-C \fB(1)\fR
112 $ git diff \-R \fB(2)\fR
115 \fB1. \fRspend extra cycles to find renames, copies and complete rewrites (very expensive)\&.
117 \fB2. \fRoutput diff in reverse\&.
124 Written by Linus Torvalds <torvalds@osdl\&.org>
129 Documentation by Junio C Hamano and the git\-list <git@vger\&.kernel\&.org>\&.
134 Part of the \fBgit\fR(7) suite