Skip to content

Commit 3eda830

Browse files
committed
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
2 parents 2c6e5b3 + e750951 commit 3eda830

File tree

1 file changed

+52
-27
lines changed

1 file changed

+52
-27
lines changed

Documentation/git-ls-files.txt

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ SYNOPSIS
1212
'git ls-files' [-z] [-t] [-v] [-f]
1313
[-c|--cached] [-d|--deleted] [-o|--others] [-i|--ignored]
1414
[-s|--stage] [-u|--unmerged] [-k|--killed] [-m|--modified]
15+
[--resolve-undo]
1516
[--directory [--no-empty-directory]] [--eol]
1617
[--deduplicate]
1718
[-x <pattern>|--exclude=<pattern>]
@@ -28,33 +29,41 @@ This merges the file listing in the index with the actual working
2829
directory list, and shows different combinations of the two.
2930

3031
One or more of the options below may be used to determine the files
31-
shown:
32+
shown, and each file may be printed multiple times if there are
33+
multiple entries in the index or multiple statuses are applicable for
34+
the relevant file selection options.
3235

3336
OPTIONS
3437
-------
3538
-c::
3639
--cached::
37-
Show cached files in the output (default)
40+
Show all files cached in Git's index, i.e. all tracked files.
41+
(This is the default if no -c/-s/-d/-o/-u/-k/-m/--resolve-undo
42+
options are specified.)
3843

3944
-d::
4045
--deleted::
41-
Show deleted files in the output
46+
Show files with an unstaged deletion
4247

4348
-m::
4449
--modified::
45-
Show modified files in the output
50+
Show files with an unstaged modification (note that an unstaged
51+
deletion also counts as an unstaged modification)
4652

4753
-o::
4854
--others::
4955
Show other (i.e. untracked) files in the output
5056

5157
-i::
5258
--ignored::
53-
Show only ignored files in the output. When showing files in the
54-
index, print only those matched by an exclude pattern. When
55-
showing "other" files, show only those matched by an exclude
56-
pattern. Standard ignore rules are not automatically activated,
57-
therefore at least one of the `--exclude*` options is required.
59+
Show only ignored files in the output. Must be used with
60+
either an explicit '-c' or '-o'. When showing files in the
61+
index (i.e. when used with '-c'), print only those files
62+
matching an exclude pattern. When showing "other" files
63+
(i.e. when used with '-o'), show only those matched by an
64+
exclude pattern. Standard ignore rules are not automatically
65+
activated, therefore at least one of the `--exclude*` options
66+
is required.
5867

5968
-s::
6069
--stage::
@@ -63,19 +72,29 @@ OPTIONS
6372
--directory::
6473
If a whole directory is classified as "other", show just its
6574
name (with a trailing slash) and not its whole contents.
75+
Has no effect without -o/--others.
6676

6777
--no-empty-directory::
6878
Do not list empty directories. Has no effect without --directory.
6979

7080
-u::
7181
--unmerged::
72-
Show unmerged files in the output (forces --stage)
82+
Show information about unmerged files in the output, but do
83+
not show any other tracked files (forces --stage, overrides
84+
--cached).
7385

7486
-k::
7587
--killed::
76-
Show files on the filesystem that need to be removed due
77-
to file/directory conflicts for checkout-index to
78-
succeed.
88+
Show untracked files on the filesystem that need to be removed
89+
due to file/directory conflicts for tracked files to be able to
90+
be written to the filesystem.
91+
92+
--resolve-undo::
93+
Show files having resolve-undo information in the index
94+
together with their resolve-undo information. (resolve-undo
95+
information is what is used to implement "git checkout -m
96+
$PATH", i.e. to recreate merge conflicts that were
97+
accidentally resolved)
7998

8099
-z::
81100
\0 line termination on output and do not quote filenames.
@@ -100,7 +119,8 @@ OPTIONS
100119

101120
--exclude-per-directory=<file>::
102121
Read additional exclude patterns that apply only to the
103-
directory and its subdirectories in <file>.
122+
directory and its subdirectories in <file>. Deprecated; use
123+
--exclude-standard instead.
104124

105125
--exclude-standard::
106126
Add the standard Git exclusions: .git/info/exclude, .gitignore
@@ -118,24 +138,27 @@ OPTIONS
118138
with `-s` or `-u` options does not make any sense.
119139

120140
-t::
121-
This feature is semi-deprecated. For scripting purpose,
122-
linkgit:git-status[1] `--porcelain` and
141+
Show status tags together with filenames. Note that for
142+
scripting purposes, linkgit:git-status[1] `--porcelain` and
123143
linkgit:git-diff-files[1] `--name-status` are almost always
124144
superior alternatives, and users should look at
125145
linkgit:git-status[1] `--short` or linkgit:git-diff[1]
126146
`--name-status` for more user-friendly alternatives.
127147
+
128148
--
129-
This option identifies the file status with the following tags (followed by
130-
a space) at the start of each line:
131-
132-
H:: cached
133-
S:: skip-worktree
134-
M:: unmerged
135-
R:: removed/deleted
136-
C:: modified/changed
137-
K:: to be killed
138-
?:: other
149+
This option provides a reason for showing each filename, in the form
150+
of a status tag (which is followed by a space and then the filename).
151+
The status tags are all single characters from the following list:
152+
153+
H:: tracked file that is not either unmerged or skip-worktree
154+
S:: tracked file that is skip-worktree
155+
M:: tracked file that is unmerged
156+
R:: tracked file with unstaged removal/deletion
157+
C:: tracked file with unstaged modification/change
158+
K:: untracked paths which are part of file/directory conflicts
159+
which prevent checking out tracked files
160+
?:: untracked file
161+
U:: file with resolve-undo information
139162
--
140163

141164
-v::
@@ -269,7 +292,9 @@ traversing the directory tree and finding files to show when the
269292
flags --others or --ignored are specified. linkgit:gitignore[5]
270293
specifies the format of exclude patterns.
271294

272-
These exclude patterns come from these places, in order:
295+
Generally, you should just use --exclude-standard, but for historical
296+
reasons the exclude patterns can be specified from the following
297+
places, in order:
273298

274299
1. The command-line flag --exclude=<pattern> specifies a
275300
single pattern. Patterns are ordered in the same order

0 commit comments

Comments
 (0)