@matheusbsbs / matheus-bagliano / commits / 803f498c03
Fork 0

Documentation: diff examples.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Dec 13, 2005 at 01:54 UTC 803f498c03b47b1da88cf8f14ba2c374f0fc16d3
2 files changed +71
Documentation/git-diff.txt
+62
@@ -40,6 +40,68 @@ OPTIONS
40 commands.
41
42
43 +EXAMPLES
44 +--------
45 +
46 +Various ways to check your working tree::
47 ++
48 +------------
49 +$ git diff <1>
50 +$ git diff --cached <2>
51 +$ git diff HEAD <3>
52 +
53 +<1> changes in the working tree since your last git-update-index.
54 +<2> changes between the index and your last commit; what you
55 +would be committing if you run "git commit" without "-a" option.
56 +<3> changes in the working tree since your last commit; what you
57 +would be committing if you run "git commit -a"
58 +------------
59 +
60 +Comparing with arbitrary commits::
61 ++
62 +------------
63 +$ git diff test <1>
64 +$ git diff HEAD -- ./test <2>
65 +$ git diff HEAD^ HEAD <3>
66 +
67 +<1> instead of using the tip of the current branch, compare with the
68 +tip of "test" branch.
69 +<2> instead of comparing with the tip of "test" branch, compare with
70 +the tip of the curren branch, but limit the comparison to the
71 +file "test".
72 +<3> compare the version before the last commit and the last commit.
73 +------------
74 +
75 +
76 +Limiting the diff output::
77 ++
78 +------------
79 +$ git diff --diff-filter=MRC <1>
80 +$ git diff --name-status -r <2>
81 +$ git diff arch/i386 include/asm-i386 <3>
82 +
83 +<1> show only modification, rename and copy, but not addition
84 +nor deletion.
85 +<2> show only names and the nature of change, but not actual
86 +diff output. --name-status disables usual patch generation
87 +which in turn also disables recursive behaviour, so without -r
88 +you would only see the directory name if there is a change in a
89 +file in a subdirectory.
90 +<3> limit diff output to named subtrees.
91 +------------
92 +
93 +Munging the diff output::
94 ++
95 +------------
96 +$ git diff --find-copies-harder -B -C <1>
97 +$ git diff -R <2>
98 +
99 +<1> spend extra cycles to find renames, copies and complete
100 +rewrites (very expensive).
101 +<2> output diff in reverse.
102 +------------
103 +
104 +
105 Author
106 ------
107 Written by Linus Torvalds <torvalds@osdl.org>
Documentation/git-format-patch.txt
+9
@@ -84,6 +84,15 @@ git-format-patch origin::
84 pulled from origin the last time in a patch form for
85 e-mail submission.
86
87 +git-format-patch -M -B origin::
88 + The same as the previous one, except detect and handle
89 + renames and complete rewrites intelligently to produce
90 + renaming patch. A renaming patch reduces the amount of
91 + text output, and generally makes it easier to review
92 + it. Note that the "patch" program does not understand
93 + renaming patch well, so use it only when you know the
94 + recipient uses git to apply your patch.
95 +
96
97 See Also
98 --------