Skip to content

Commit 286bc12

Browse files
committed
diff --no-index: describe in a separate paragraph
The documentation for "diff-files" mode of "git diff" primarily talks about how changes in the files in the working tree are shown relative to the contents previously added to that index, and tucks explanation on how "--no-index" mode, which works in a quite different way, may be implicitly used instead. Instead, add a separate paragraph to explain what "--no-index" mode does, and also mention when "--no-index" can be omitted from the command line (essentially, when it is obvious from the context). Signed-off-by: Junio C Hamano <[email protected]>
1 parent b214edd commit 286bc12

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Documentation/git-diff.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ two blob objects, or changes between two files on disk.
2828
words, the differences are what you _could_ tell Git to
2929
further add to the index but you still haven't. You can
3030
stage these changes by using linkgit:git-add[1].
31-
+
32-
If exactly two paths are given and at least one points outside
33-
the current repository, 'git diff' will compare the two files /
34-
directories. This behavior can be forced by --no-index or by
35-
executing 'git diff' outside of a working tree.
31+
32+
'git diff' --no-index [--options] [--] [<path>...]::
33+
34+
This form is to compare the given two paths on the
35+
filesystem. You can omit the `--no-index` option when
36+
running the command in a working tree controlled by Git and
37+
at least one of the paths points outside the working tree,
38+
or when running the command outside a working tree
39+
controlled by Git.
3640

3741
'git diff' [--options] --cached [<commit>] [--] [<path>...]::
3842

0 commit comments

Comments
 (0)