1GIT-LS-FILES(1)                   Git Manual                   GIT-LS-FILES(1)
2
3
4

NAME

6       git-ls-files - Show information about files in the index and the
7       working tree
8

SYNOPSIS

10       git ls-files [-z] [-t] [-v] [-f]
11                       (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*
12                       (-[c|d|o|i|s|u|k|m])*
13                       [--eol]
14                       [--deduplicate]
15                       [-x <pattern>|--exclude=<pattern>]
16                       [-X <file>|--exclude-from=<file>]
17                       [--exclude-per-directory=<file>]
18                       [--exclude-standard]
19                       [--error-unmatch] [--with-tree=<tree-ish>]
20                       [--full-name] [--recurse-submodules]
21                       [--abbrev[=<n>]] [--] [<file>...]
22

DESCRIPTION

24       This merges the file listing in the index with the actual working
25       directory list, and shows different combinations of the two.
26
27       One or more of the options below may be used to determine the files
28       shown:
29

OPTIONS

31       -c, --cached
32           Show cached files in the output (default)
33
34       -d, --deleted
35           Show deleted files in the output
36
37       -m, --modified
38           Show modified files in the output
39
40       -o, --others
41           Show other (i.e. untracked) files in the output
42
43       -i, --ignored
44           Show only ignored files in the output. When showing files in the
45           index, print only those matched by an exclude pattern. When showing
46           "other" files, show only those matched by an exclude pattern.
47           Standard ignore rules are not automatically activated, therefore at
48           least one of the --exclude* options is required.
49
50       -s, --stage
51           Show staged contents' mode bits, object name and stage number in
52           the output.
53
54       --directory
55           If a whole directory is classified as "other", show just its name
56           (with a trailing slash) and not its whole contents.
57
58       --no-empty-directory
59           Do not list empty directories. Has no effect without --directory.
60
61       -u, --unmerged
62           Show unmerged files in the output (forces --stage)
63
64       -k, --killed
65           Show files on the filesystem that need to be removed due to
66           file/directory conflicts for checkout-index to succeed.
67
68       -z
69           \0 line termination on output and do not quote filenames. See
70           OUTPUT below for more information.
71
72       --deduplicate
73           When only filenames are shown, suppress duplicates that may come
74           from having multiple stages during a merge, or giving --deleted and
75           --modified option at the same time. When any of the -t, --unmerged,
76           or --stage option is in use, this option has no effect.
77
78       -x <pattern>, --exclude=<pattern>
79           Skip untracked files matching pattern. Note that pattern is a shell
80           wildcard pattern. See EXCLUDE PATTERNS below for more information.
81
82       -X <file>, --exclude-from=<file>
83           Read exclude patterns from <file>; 1 per line.
84
85       --exclude-per-directory=<file>
86           Read additional exclude patterns that apply only to the directory
87           and its subdirectories in <file>.
88
89       --exclude-standard
90           Add the standard Git exclusions: .git/info/exclude, .gitignore in
91           each directory, and the user’s global exclusion file.
92
93       --error-unmatch
94           If any <file> does not appear in the index, treat this as an error
95           (return 1).
96
97       --with-tree=<tree-ish>
98           When using --error-unmatch to expand the user supplied <file> (i.e.
99           path pattern) arguments to paths, pretend that paths which were
100           removed in the index since the named <tree-ish> are still present.
101           Using this option with -s or -u options does not make any sense.
102
103       -t
104           This feature is semi-deprecated. For scripting purpose, git-
105           status(1) --porcelain and git-diff-files(1) --name-status are
106           almost always superior alternatives, and users should look at git-
107           status(1) --short or git-diff(1) --name-status for more
108           user-friendly alternatives.
109
110           This option identifies the file status with the following tags
111           (followed by a space) at the start of each line:
112
113           H
114               cached
115
116           S
117               skip-worktree
118
119           M
120               unmerged
121
122           R
123               removed/deleted
124
125           C
126               modified/changed
127
128           K
129               to be killed
130
131           ?
132               other
133
134       -v
135           Similar to -t, but use lowercase letters for files that are marked
136           as assume unchanged (see git-update-index(1)).
137
138       -f
139           Similar to -t, but use lowercase letters for files that are marked
140           as fsmonitor valid (see git-update-index(1)).
141
142       --full-name
143           When run from a subdirectory, the command usually outputs paths
144           relative to the current directory. This option forces paths to be
145           output relative to the project top directory.
146
147       --recurse-submodules
148           Recursively calls ls-files on each active submodule in the
149           repository. Currently there is only support for the --cached mode.
150
151       --abbrev[=<n>]
152           Instead of showing the full 40-byte hexadecimal object lines, show
153           the shortest prefix that is at least <n> hexdigits long that
154           uniquely refers the object. Non default number of digits can be
155           specified with --abbrev=<n>.
156
157       --debug
158           After each line that describes a file, add more data about its
159           cache entry. This is intended to show as much information as
160           possible for manual inspection; the exact format may change at any
161           time.
162
163       --eol
164           Show <eolinfo> and <eolattr> of files. <eolinfo> is the file
165           content identification used by Git when the "text" attribute is
166           "auto" (or not set and core.autocrlf is not false). <eolinfo> is
167           either "-text", "none", "lf", "crlf", "mixed" or "".
168
169           "" means the file is not a regular file, it is not in the index or
170           not accessible in the working tree.
171
172           <eolattr> is the attribute that is used when checking out or
173           committing, it is either "", "-text", "text", "text=auto", "text
174           eol=lf", "text eol=crlf". Since Git 2.10 "text=auto eol=lf" and
175           "text=auto eol=crlf" are supported.
176
177           Both the <eolinfo> in the index ("i/<eolinfo>") and in the working
178           tree ("w/<eolinfo>") are shown for regular files, followed by the
179           ("attr/<eolattr>").
180
181       --
182           Do not interpret any more arguments as options.
183
184       <file>
185           Files to show. If no files are given all files which match the
186           other specified criteria are shown.
187

OUTPUT

189       git ls-files just outputs the filenames unless --stage is specified in
190       which case it outputs:
191
192           [<tag> ]<mode> <object> <stage> <file>
193
194       git ls-files --eol will show
195       i/<eolinfo><SPACES>w/<eolinfo><SPACES>attr/<eolattr><SPACE*><TAB><file>
196
197       git ls-files --unmerged and git ls-files --stage can be used to examine
198       detailed information on unmerged paths.
199
200       For an unmerged path, instead of recording a single mode/SHA-1 pair,
201       the index records up to three such pairs; one from tree O in stage 1, A
202       in stage 2, and B in stage 3. This information can be used by the user
203       (or the porcelain) to see what should eventually be recorded at the
204       path. (see git-read-tree(1) for more information on state)
205
206       Without the -z option, pathnames with "unusual" characters are quoted
207       as explained for the configuration variable core.quotePath (see git-
208       config(1)). Using -z the filename is output verbatim and the line is
209       terminated by a NUL byte.
210

EXCLUDE PATTERNS

212       git ls-files can use a list of "exclude patterns" when traversing the
213       directory tree and finding files to show when the flags --others or
214       --ignored are specified. gitignore(5) specifies the format of exclude
215       patterns.
216
217       These exclude patterns come from these places, in order:
218
219        1. The command-line flag --exclude=<pattern> specifies a single
220           pattern. Patterns are ordered in the same order they appear in the
221           command line.
222
223        2. The command-line flag --exclude-from=<file> specifies a file
224           containing a list of patterns. Patterns are ordered in the same
225           order they appear in the file.
226
227        3. The command-line flag --exclude-per-directory=<name> specifies a
228           name of the file in each directory git ls-files examines, normally
229           .gitignore. Files in deeper directories take precedence. Patterns
230           are ordered in the same order they appear in the files.
231
232       A pattern specified on the command line with --exclude or read from the
233       file specified with --exclude-from is relative to the top of the
234       directory tree. A pattern read from a file specified by
235       --exclude-per-directory is relative to the directory that the pattern
236       file appears in.
237

SEE ALSO

239       git-read-tree(1), gitignore(5)
240

GIT

242       Part of the git(1) suite
243
244
245
246Git 2.31.1                        2021-03-26                   GIT-LS-FILES(1)
Impressum