blob: 4b28292811ce019fc94259849f8c5ad6d514b686 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-ls-files(1)
2===============
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-ls-files - Show information about files in the index and the working tree
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano7e9f6b72006-02-22 10:44:5511[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git ls-files' [-z] [-t] [-v]
Junio C Hamano2db3e752010-09-03 21:33:0613(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*
14(-[c|d|o|i|s|u|k|m])*
Junio C Hamano1a4e8412005-12-27 08:17:2315[-x <pattern>|--exclude=<pattern>]
16[-X <file>|--exclude-from=<file>]
Junio C Hamano5c3957e2006-03-28 00:28:0117[--exclude-per-directory=<file>]
Junio C Hamanoff979792007-11-16 10:11:3018[--exclude-standard]
Junio C Hamano58155b42007-09-15 07:46:1419[--error-unmatch] [--with-tree=<tree-ish>]
Junio C Hamanod2179ef2010-10-22 04:12:1720[--full-name] [--abbrev] [--] [<file>...]
Junio C Hamano1a4e8412005-12-27 08:17:2321
22DESCRIPTION
23-----------
24This merges the file listing in the directory cache index with the
25actual working directory list, and shows different combinations of the
26two.
27
28One or more of the options below may be used to determine the files
29shown:
30
31OPTIONS
32-------
Junio C Hamanoeb415992008-06-08 22:49:4733-c::
34--cached::
Junio C Hamano1a4e8412005-12-27 08:17:2335Show cached files in the output (default)
36
Junio C Hamanoeb415992008-06-08 22:49:4737-d::
38--deleted::
Junio C Hamano1a4e8412005-12-27 08:17:2339Show deleted files in the output
40
Junio C Hamanoeb415992008-06-08 22:49:4741-m::
42--modified::
Junio C Hamano1a4e8412005-12-27 08:17:2343Show modified files in the output
44
Junio C Hamanoeb415992008-06-08 22:49:4745-o::
46--others::
Junio C Hamano31cca162009-08-07 05:40:0147Show other (i.e. untracked) files in the output
Junio C Hamano1a4e8412005-12-27 08:17:2348
Junio C Hamanoeb415992008-06-08 22:49:4749-i::
50--ignored::
Junio C Hamano446ed772009-11-10 22:02:2051Show only ignored files in the output. When showing files in the
52index, print only those matched by an exclude pattern. When
53showing "other" files, show only those matched by an exclude
54pattern.
Junio C Hamano1a4e8412005-12-27 08:17:2355
Junio C Hamanoeb415992008-06-08 22:49:4756-s::
57--stage::
Junio C Hamano90ccff32008-07-29 08:17:2458Show staged contents' object name, mode bits and stage number in the output.
Junio C Hamano1a4e8412005-12-27 08:17:2359
Junio C Hamanoa6331a82006-01-22 07:50:3360--directory::
61If a whole directory is classified as "other", show just its
62name (with a trailing slash) and not its whole contents.
63
Junio C Hamanof02e09f2006-03-27 07:51:0364--no-empty-directory::
65Do not list empty directories. Has no effect without --directory.
66
Junio C Hamanoeb415992008-06-08 22:49:4767-u::
68--unmerged::
Junio C Hamano1a4e8412005-12-27 08:17:2369Show unmerged files in the output (forces --stage)
70
Junio C Hamanoeb415992008-06-08 22:49:4771-k::
72--killed::
Junio C Hamano1a4e8412005-12-27 08:17:2373Show files on the filesystem that need to be removed due
74to file/directory conflicts for checkout-index to
75succeed.
76
77-z::
78\0 line termination on output.
79
Junio C Hamanoeb415992008-06-08 22:49:4780-x <pattern>::
81--exclude=<pattern>::
Junio C Hamanoac752fa2010-09-19 00:01:0082Skip untracked files matching pattern.
83Note that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS
84below for more information.
Junio C Hamano1a4e8412005-12-27 08:17:2385
Junio C Hamanoeb415992008-06-08 22:49:4786-X <file>::
87--exclude-from=<file>::
Junio C Hamanoac752fa2010-09-19 00:01:0088Read exclude patterns from <file>; 1 per line.
Junio C Hamano1a4e8412005-12-27 08:17:2389
90--exclude-per-directory=<file>::
Junio C Hamanoac752fa2010-09-19 00:01:0091Read additional exclude patterns that apply only to the
Junio C Hamano1a4e8412005-12-27 08:17:2392directory and its subdirectories in <file>.
93
Junio C Hamanoff979792007-11-16 10:11:3094--exclude-standard::
95Add the standard git exclusions: .git/info/exclude, .gitignore
96in each directory, and the user's global exclusion file.
97
Junio C Hamano7e9f6b72006-02-22 10:44:5598--error-unmatch::
99If any <file> does not appear in the index, treat this as an
100error (return 1).
101
Junio C Hamano58155b42007-09-15 07:46:14102--with-tree=<tree-ish>::
103When using --error-unmatch to expand the user supplied
104<file> (i.e. path pattern) arguments to paths, pretend
105that paths which were removed in the index since the
106named <tree-ish> are still present. Using this option
107with `-s` or `-u` options does not make any sense.
108
Junio C Hamano1a4e8412005-12-27 08:17:23109-t::
Junio C Hamanoa9788762010-08-03 15:15:54110This feature is semi-deprecated. For scripting purpose,
111linkgit:git-status[1] `--porcelain` and
112linkgit:git-diff-files[1] `--name-status` are almost always
113superior alternatives, and users should look at
114linkgit:git-status[1] `--short` or linkgit:git-diff[1]
115`--name-status` for more user-friendly alternatives.
116+
117This option identifies the file status with the following tags (followed by
118a space) at the start of each line:
119
Junio C Hamano1a4e8412005-12-27 08:17:23120H:: cached
Junio C Hamano3c8d6702010-01-13 23:09:03121S:: skip-worktree
Junio C Hamano1a4e8412005-12-27 08:17:23122M:: unmerged
123R:: removed/deleted
Junio C Hamano235a91e2006-01-07 01:13:58124C:: modified/changed
Junio C Hamano1a4e8412005-12-27 08:17:23125K:: to be killed
Junio C Hamano6697ac52006-02-14 08:00:23126?:: other
Junio C Hamano1a4e8412005-12-27 08:17:23127
Junio C Hamano7e9f6b72006-02-22 10:44:55128-v::
129Similar to `-t`, but use lowercase letters for files
Junio C Hamanof556fc22007-12-23 08:16:38130that are marked as 'assume unchanged' (see
Junio C Hamano35738e82008-01-07 07:55:46131linkgit:git-update-index[1]).
Junio C Hamano7e9f6b72006-02-22 10:44:55132
Junio C Hamano1a4e8412005-12-27 08:17:23133--full-name::
134When run from a subdirectory, the command usually
135outputs paths relative to the current directory. This
136option forces paths to be output relative to the project
137top directory.
138
Junio C Hamano5c3957e2006-03-28 00:28:01139--abbrev[=<n>]::
140Instead of showing the full 40-byte hexadecimal object
Junio C Hamano6efe3022009-01-13 16:47:56141lines, show only a partial prefix.
Junio C Hamano5c3957e2006-03-28 00:28:01142Non default number of digits can be specified with --abbrev=<n>.
143
Junio C Hamanoa9788762010-08-03 15:15:54144--debug::
145After each line that describes a file, add more data about its
146cache entry. This is intended to show as much information as
147possible for manual inspection; the exact format may change at
148any time.
149
Junio C Hamano1bb569e2006-05-05 23:14:25150\--::
Junio C Hamano1a4e8412005-12-27 08:17:23151Do not interpret any more arguments as options.
152
153<file>::
154Files to show. If no files are given all files which match the other
155specified criteria are shown.
156
157Output
158------
Junio C Hamanod0d892c2010-01-24 20:06:29159'git ls-files' just outputs the filenames unless '--stage' is specified in
Junio C Hamano1a4e8412005-12-27 08:17:23160which case it outputs:
161
162 [<tag> ]<mode> <object> <stage> <file>
163
Junio C Hamano1aa40d22010-01-21 17:46:43164'git ls-files --unmerged' and 'git ls-files --stage' can be used to examine
Junio C Hamano1a4e8412005-12-27 08:17:23165detailed information on unmerged paths.
166
167For an unmerged path, instead of recording a single mode/SHA1 pair,
Junio C Hamano36460982007-05-27 04:29:12168the index records up to three such pairs; one from tree O in stage
Junio C Hamano1a4e8412005-12-27 08:17:231691, A in stage 2, and B in stage 3. This information can be used by
170the user (or the porcelain) to see what should eventually be recorded at the
Junio C Hamanofce7c7e2008-07-02 03:06:38171path. (see linkgit:git-read-tree[1] for more information on state)
Junio C Hamano1a4e8412005-12-27 08:17:23172
173When `-z` option is not used, TAB, LF, and backslash characters
174in pathnames are represented as `\t`, `\n`, and `\\`,
175respectively.
176
177
178Exclude Patterns
179----------------
180
Junio C Hamano1aa40d22010-01-21 17:46:43181'git ls-files' can use a list of "exclude patterns" when
Junio C Hamano1a4e8412005-12-27 08:17:23182traversing the directory tree and finding files to show when the
Junio C Hamano35738e82008-01-07 07:55:46183flags --others or --ignored are specified. linkgit:gitignore[5]
Junio C Hamano679d22d2007-06-02 21:13:44184specifies the format of exclude patterns.
Junio C Hamano1a4e8412005-12-27 08:17:23185
Junio C Hamano679d22d2007-06-02 21:13:44186These exclude patterns come from these places, in order:
Junio C Hamano1a4e8412005-12-27 08:17:23187
Junio C Hamano679d22d2007-06-02 21:13:44188 1. The command line flag --exclude=<pattern> specifies a
189 single pattern. Patterns are ordered in the same order
190 they appear in the command line.
Junio C Hamano1a4e8412005-12-27 08:17:23191
Junio C Hamano679d22d2007-06-02 21:13:44192 2. The command line flag --exclude-from=<file> specifies a
193 file containing a list of patterns. Patterns are ordered
194 in the same order they appear in the file.
Junio C Hamano1a4e8412005-12-27 08:17:23195
Junio C Hamanoac752fa2010-09-19 00:01:00196 3. The command line flag --exclude-per-directory=<name> specifies
Junio C Hamano1aa40d22010-01-21 17:46:43197 a name of the file in each directory 'git ls-files'
Junio C Hamano679d22d2007-06-02 21:13:44198 examines, normally `.gitignore`. Files in deeper
199 directories take precedence. Patterns are ordered in the
200 same order they appear in the files.
Junio C Hamano1a4e8412005-12-27 08:17:23201
202A pattern specified on the command line with --exclude or read
203from the file specified with --exclude-from is relative to the
204top of the directory tree. A pattern read from a file specified
205by --exclude-per-directory is relative to the directory that the
206pattern file appears in.
207
Junio C Hamano9049d912008-05-29 02:09:50208SEE ALSO
Junio C Hamano1a4e8412005-12-27 08:17:23209--------
Junio C Hamano35738e82008-01-07 07:55:46210linkgit:git-read-tree[1], linkgit:gitignore[5]
Junio C Hamano1a4e8412005-12-27 08:17:23211
Junio C Hamano1a4e8412005-12-27 08:17:23212GIT
213---
Junio C Hamanof7c042d2008-06-06 22:50:53214Part of the linkgit:git[1] suite