1GIT-LS-FILES(1) Git Manual GIT-LS-FILES(1)
2
3
4
6 git-ls-files - Show information about files in the index and the
7 working tree
8
10 git ls-files [-z] [-t] [-v]
11 (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])\*
12 (-[c|d|o|i|s|u|k|m])\*
13 [-x <pattern>|--exclude=<pattern>]
14 [-X <file>|--exclude-from=<file>]
15 [--exclude-per-directory=<file>]
16 [--exclude-standard]
17 [--error-unmatch] [--with-tree=<tree-ish>]
18 [--full-name] [--abbrev] [--] [<file>]\*
19
20
22 This merges the file listing in the directory cache index with the
23 actual working directory list, and shows different combinations of the
24 two.
25
26 One or more of the options below may be used to determine the files
27 shown:
28
30 -c, --cached
31 Show cached files in the output (default)
32
33 -d, --deleted
34 Show deleted files in the output
35
36 -m, --modified
37 Show modified files in the output
38
39 -o, --others
40 Show other (i.e. untracked) files in the output
41
42 -i, --ignored
43 Show only ignored files in the output. When showing files in the
44 index, print only those matched by an exclude pattern. When showing
45 "other" files, show only those matched by an exclude pattern.
46
47 -s, --stage
48 Show staged contents´ object name, mode bits and stage number in
49 the output.
50
51 --directory
52 If a whole directory is classified as "other", show just its name
53 (with a trailing slash) and not its whole contents.
54
55 --no-empty-directory
56 Do not list empty directories. Has no effect without --directory.
57
58 -u, --unmerged
59 Show unmerged files in the output (forces --stage)
60
61 -k, --killed
62 Show files on the filesystem that need to be removed due to
63 file/directory conflicts for checkout-index to succeed.
64
65 -z
66 \0 line termination on output.
67
68 -x <pattern>, --exclude=<pattern>
69 Skips files matching pattern. Note that pattern is a shell wildcard
70 pattern.
71
72 -X <file>, --exclude-from=<file>
73 exclude patterns are read from <file>; 1 per line.
74
75 --exclude-per-directory=<file>
76 read additional exclude patterns that apply only to the directory
77 and its subdirectories in <file>.
78
79 --exclude-standard
80 Add the standard git exclusions: .git/info/exclude, .gitignore in
81 each directory, and the user’s global exclusion file.
82
83 --error-unmatch
84 If any <file> does not appear in the index, treat this as an error
85 (return 1).
86
87 --with-tree=<tree-ish>
88 When using --error-unmatch to expand the user supplied <file> (i.e.
89 path pattern) arguments to paths, pretend that paths which were
90 removed in the index since the named <tree-ish> are still present.
91 Using this option with -s or -u options does not make any sense.
92
93 -t
94 Identify the file status with the following tags (followed by a
95 space) at the start of each line:
96
97 H
98 cached
99
100 S
101 skip-worktree
102
103 M
104 unmerged
105
106 R
107 removed/deleted
108
109 C
110 modified/changed
111
112 K
113 to be killed
114
115 ?
116 other
117
118 -v
119 Similar to -t, but use lowercase letters for files that are marked
120 as assume unchanged (see git-update-index(1)).
121
122 --full-name
123 When run from a subdirectory, the command usually outputs paths
124 relative to the current directory. This option forces paths to be
125 output relative to the project top directory.
126
127 --abbrev[=<n>]
128 Instead of showing the full 40-byte hexadecimal object lines, show
129 only a partial prefix. Non default number of digits can be
130 specified with --abbrev=<n>.
131
132 --
133 Do not interpret any more arguments as options.
134
135 <file>
136 Files to show. If no files are given all files which match the
137 other specified criteria are shown.
138
140 git ls-files just outputs the filenames unless --stage is specified in
141 which case it outputs:
142
143 [<tag> ]<mode> <object> <stage> <file>
144
145 git ls-files --unmerged and git ls-files --stage can be used to examine
146 detailed information on unmerged paths.
147
148 For an unmerged path, instead of recording a single mode/SHA1 pair, the
149 index records up to three such pairs; one from tree O in stage 1, A in
150 stage 2, and B in stage 3. This information can be used by the user (or
151 the porcelain) to see what should eventually be recorded at the path.
152 (see git-read-tree(1) for more information on state)
153
154 When -z option is not used, TAB, LF, and backslash characters in
155 pathnames are represented as \t, \n, and \\, respectively.
156
158 git ls-files can use a list of "exclude patterns" when traversing the
159 directory tree and finding files to show when the flags --others or
160 --ignored are specified. gitignore(5) specifies the format of exclude
161 patterns.
162
163 These exclude patterns come from these places, in order:
164
165 1. The command line flag --exclude=<pattern> specifies a single
166 pattern. Patterns are ordered in the same order they appear in the
167 command line.
168
169 2. The command line flag --exclude-from=<file> specifies a file
170 containing a list of patterns. Patterns are ordered in the same
171 order they appear in the file.
172
173 3. command line flag --exclude-per-directory=<name> specifies a name
174 of the file in each directory git ls-files examines, normally
175 .gitignore. Files in deeper directories take precedence. Patterns
176 are ordered in the same order they appear in the files.
177
178 A pattern specified on the command line with --exclude or read from the
179 file specified with --exclude-from is relative to the top of the
180 directory tree. A pattern read from a file specified by
181 --exclude-per-directory is relative to the directory that the pattern
182 file appears in.
183
185 git-read-tree(1), gitignore(5)
186
188 Written by Linus Torvalds <torvalds@osdl.org[1]>
189
191 Documentation by David Greaves, Junio C Hamano, Josh Triplett, and the
192 git-list <git@vger.kernel.org[2]>.
193
195 Part of the git(1) suite
196
198 1. torvalds@osdl.org
199 mailto:torvalds@osdl.org
200
201 2. git@vger.kernel.org
202 mailto:git@vger.kernel.org
203
204
205
206Git 1.7.1 08/16/2017 GIT-LS-FILES(1)