Merge branch 'en/ls-files-doc-update'

Doc update to ls-files.

* en/ls-files-doc-update:
  ls-files: guide folks to --exclude-standard over other --exclude* options
  ls-files: clarify descriptions of status tags for -t
  ls-files: clarify descriptions of file selection options
  ls-files: add missing documentation for --resolve-undo option
This commit is contained in:
Junio C Hamano
2023-02-03 16:08:22 -08:00

View File

@ -12,6 +12,7 @@ SYNOPSIS
'git ls-files' [-z] [-t] [-v] [-f] 'git ls-files' [-z] [-t] [-v] [-f]
[-c|--cached] [-d|--deleted] [-o|--others] [-i|--ignored] [-c|--cached] [-d|--deleted] [-o|--others] [-i|--ignored]
[-s|--stage] [-u|--unmerged] [-k|--killed] [-m|--modified] [-s|--stage] [-u|--unmerged] [-k|--killed] [-m|--modified]
[--resolve-undo]
[--directory [--no-empty-directory]] [--eol] [--directory [--no-empty-directory]] [--eol]
[--deduplicate] [--deduplicate]
[-x <pattern>|--exclude=<pattern>] [-x <pattern>|--exclude=<pattern>]
@ -28,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::
@ -50,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::
@ -63,19 +72,29 @@ 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::
Show files having resolve-undo information in the index
together with their resolve-undo information. (resolve-undo
information is what is used to implement "git checkout -m
$PATH", i.e. to recreate merge conflicts that were
accidentally resolved)
-z:: -z::
\0 line termination on output and do not quote filenames. \0 line termination on output and do not quote filenames.
@ -100,7 +119,8 @@ OPTIONS
--exclude-per-directory=<file>:: --exclude-per-directory=<file>::
Read additional exclude patterns that apply only to the Read additional exclude patterns that apply only to the
directory and its subdirectories in <file>. directory and its subdirectories in <file>. Deprecated; use
--exclude-standard instead.
--exclude-standard:: --exclude-standard::
Add the standard Git exclusions: .git/info/exclude, .gitignore Add the standard Git exclusions: .git/info/exclude, .gitignore
@ -118,24 +138,27 @@ OPTIONS
with `-s` or `-u` options does not make any sense. with `-s` or `-u` options does not make any sense.
-t:: -t::
This feature is semi-deprecated. For scripting purpose, Show status tags together with filenames. Note that for
linkgit:git-status[1] `--porcelain` and scripting purposes, linkgit:git-status[1] `--porcelain` and
linkgit:git-diff-files[1] `--name-status` are almost always linkgit:git-diff-files[1] `--name-status` are almost always
superior alternatives, and users should look at superior alternatives, and users should look at
linkgit:git-status[1] `--short` or linkgit:git-diff[1] linkgit:git-status[1] `--short` or linkgit:git-diff[1]
`--name-status` for more user-friendly alternatives. `--name-status` for more user-friendly alternatives.
+ +
-- --
This option identifies the file status with the following tags (followed by This option provides a reason for showing each filename, in the form
a space) at the start of each line: of a status tag (which is followed by a space and then the filename).
The status tags are all single characters from the following list:
H:: cached H:: tracked file that is not either unmerged or skip-worktree
S:: skip-worktree S:: tracked file that is skip-worktree
M:: unmerged M:: tracked file that is unmerged
R:: removed/deleted R:: tracked file with unstaged removal/deletion
C:: modified/changed C:: tracked file with unstaged modification/change
K:: to be killed K:: untracked paths which are part of file/directory conflicts
?:: other which prevent checking out tracked files
?:: untracked file
U:: file with resolve-undo information
-- --
-v:: -v::
@ -269,7 +292,9 @@ traversing the directory tree and finding files to show when the
flags --others or --ignored are specified. linkgit:gitignore[5] flags --others or --ignored are specified. linkgit:gitignore[5]
specifies the format of exclude patterns. specifies the format of exclude patterns.
These exclude patterns come from these places, in order: Generally, you should just use --exclude-standard, but for historical
reasons the exclude patterns can be specified from the following
places, in order:
1. The command-line flag --exclude=<pattern> specifies a 1. The command-line flag --exclude=<pattern> specifies a
single pattern. Patterns are ordered in the same order single pattern. Patterns are ordered in the same order