ls-files: clarify descriptions of file selection options
The previous descriptions of the file selection options were very easy
to misunderstand. For example:
* "Show cached files in the output"
This could be interpreted as meaning "show files which have been
modified and git-add'ed, i.e. files which have cached changes
relative to HEAD".
* "Show deleted files"
This could be interpreted as meaning "for each `git rm $FILE` we
ran, show me $FILE"
* "Show modified files"
This could be interpreted as meaning "show files which have been
modified and git-add'ed" or as "show me files that differ from HEAD"
or as "show me undeleted files different from HEAD" (given that
--deleted is a separate option), none of which are correct.
Further, it's not very clear when some options only modify and/or
override other options, as was the case with --ignored, --directory, and
--unmerged (I've seen folks confused by each of them on the mailing
list, sometimes even fellow git developers.)
Tweak these definitions, and the one for --killed, to try to make them
all a bit more clear. Finally, also clarify early on that duplicate
reports for paths are often expected (both when (a) there are multiple
entries for the file in the index -- i.e. when there are conflicts, and
also (b) when the user specifies options that might pick the same file
multiple times, such as `git ls-files --cached --deleted --modified`
when there is a file with an unstaged deletion).
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
2a34b3181d
commit
2b02d2df2b
@ -29,21 +29,26 @@ This merges the file listing in the index with the actual working
|
|||||||
directory list, and shows different combinations of the two.
|
directory list, and shows different combinations of the two.
|
||||||
|
|
||||||
One or more of the options below may be used to determine the files
|
One or more of the options below may be used to determine the files
|
||||||
shown:
|
shown, and each file may be printed multiple times if there are
|
||||||
|
multiple entries in the index or multiple statuses are applicable for
|
||||||
|
the relevant file selection options.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
-c::
|
-c::
|
||||||
--cached::
|
--cached::
|
||||||
Show cached files in the output (default)
|
Show all files cached in Git's index, i.e. all tracked files.
|
||||||
|
(This is the default if no -c/-s/-d/-o/-u/-k/-m/--resolve-undo
|
||||||
|
options are specified.)
|
||||||
|
|
||||||
-d::
|
-d::
|
||||||
--deleted::
|
--deleted::
|
||||||
Show deleted files in the output
|
Show files with an unstaged deletion
|
||||||
|
|
||||||
-m::
|
-m::
|
||||||
--modified::
|
--modified::
|
||||||
Show modified files in the output
|
Show files with an unstaged modification (note that an unstaged
|
||||||
|
deletion also counts as an unstaged modification)
|
||||||
|
|
||||||
-o::
|
-o::
|
||||||
--others::
|
--others::
|
||||||
@ -51,11 +56,14 @@ OPTIONS
|
|||||||
|
|
||||||
-i::
|
-i::
|
||||||
--ignored::
|
--ignored::
|
||||||
Show only ignored files in the output. When showing files in the
|
Show only ignored files in the output. Must be used with
|
||||||
index, print only those matched by an exclude pattern. When
|
either an explicit '-c' or '-o'. When showing files in the
|
||||||
showing "other" files, show only those matched by an exclude
|
index (i.e. when used with '-c'), print only those files
|
||||||
pattern. Standard ignore rules are not automatically activated,
|
matching an exclude pattern. When showing "other" files
|
||||||
therefore at least one of the `--exclude*` options is required.
|
(i.e. when used with '-o'), show only those matched by an
|
||||||
|
exclude pattern. Standard ignore rules are not automatically
|
||||||
|
activated, therefore at least one of the `--exclude*` options
|
||||||
|
is required.
|
||||||
|
|
||||||
-s::
|
-s::
|
||||||
--stage::
|
--stage::
|
||||||
@ -64,19 +72,22 @@ OPTIONS
|
|||||||
--directory::
|
--directory::
|
||||||
If a whole directory is classified as "other", show just its
|
If a whole directory is classified as "other", show just its
|
||||||
name (with a trailing slash) and not its whole contents.
|
name (with a trailing slash) and not its whole contents.
|
||||||
|
Has no effect without -o/--others.
|
||||||
|
|
||||||
--no-empty-directory::
|
--no-empty-directory::
|
||||||
Do not list empty directories. Has no effect without --directory.
|
Do not list empty directories. Has no effect without --directory.
|
||||||
|
|
||||||
-u::
|
-u::
|
||||||
--unmerged::
|
--unmerged::
|
||||||
Show unmerged files in the output (forces --stage)
|
Show information about unmerged files in the output, but do
|
||||||
|
not show any other tracked files (forces --stage, overrides
|
||||||
|
--cached).
|
||||||
|
|
||||||
-k::
|
-k::
|
||||||
--killed::
|
--killed::
|
||||||
Show files on the filesystem that need to be removed due
|
Show untracked files on the filesystem that need to be removed
|
||||||
to file/directory conflicts for checkout-index to
|
due to file/directory conflicts for tracked files to be able to
|
||||||
succeed.
|
be written to the filesystem.
|
||||||
|
|
||||||
--resolve-undo::
|
--resolve-undo::
|
||||||
Show files having resolve-undo information in the index
|
Show files having resolve-undo information in the index
|
||||||
|
|||||||
Reference in New Issue
Block a user