X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgit-diff.txt;h=11c4216c4a5c705c6af55b1367cae96b13c20251;hb=4356736571c6845cb446e4a7c9d645868e558ca0;hp=b36e705dd0cc97ca73cb041a3552c8441846f1b8;hpb=434e6ef89d73dcc812b3a44dfaff0ca8204a206e;p=git.git diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt index b36e705dd..11c4216c4 100644 --- a/Documentation/git-diff.txt +++ b/Documentation/git-diff.txt @@ -22,10 +22,10 @@ tree and the index file, or the index file and the working tree. words, the differences are what you _could_ tell git to further add to the index but you still haven't. You can stage these changes by using gitlink:git-add[1]. - - If exactly two paths are given, and at least one is untracked, - compare the two files / directories. This behavior can be - forced by --no-index. ++ +If exactly two paths are given, and at least one is untracked, +compare the two files / directories. This behavior can be +forced by --no-index. 'git-diff' [--options] --cached [] [--] [...]:: @@ -44,16 +44,34 @@ tree and the index file, or the index file and the working tree. 'git-diff' [--options] [--] [...]:: - This form is to view the changes between two , - for example, tips of two branches. + This is to view the changes between two arbitrary + . + +'git-diff' [--options] .. [--] [...]:: + + This is synonymous to the previous form. If on + one side is omitted, it will have the same effect as + using HEAD instead. + +'git-diff' [--options] \... [--] [...]:: + + This form is to view the changes on the branch containing + and up to the second , starting at a common ancestor + of both . "git-diff A\...B" is equivalent to + "git-diff $(git-merge-base A B) B". You can omit any one + of , which has the same effect as using HEAD instead. Just in case if you are doing something exotic, it should be -noted that all of the in the above description can be -any . +noted that all of the in the above description, except +for the last two forms that use ".." notations, can be any +. For a more complete list of ways to spell , see "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1]. - +However, "diff" is about comparing two _endpoints_, not ranges, +and the range notations (".." and +"\...") do not mean a range as defined in the +"SPECIFYING RANGES" section in gitlink:git-rev-parse[1]. OPTIONS ------- @@ -64,6 +82,9 @@ include::diff-options.txt[] the diff to the named paths (you can give directory names and get diff for all files under them). +Output format +------------- +include::diff-format.txt[] EXAMPLES -------- @@ -97,6 +118,18 @@ the tip of the current branch, but limit the comparison to the file "test". <3> Compare the version before the last commit and the last commit. +Comparing branches:: ++ +------------ +$ git diff topic master <1> +$ git diff topic..master <2> +$ git diff topic...master <3> +------------ ++ +<1> Changes between the tips of the topic and the master branches. +<2> Same as above. +<3> Changes that occurred on the master branch since when the topic +branch was started off it. Limiting the diff output:: +