blob: 057a021eb50899ed5fe1ee5a7b6c59e7fc27becf [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 Hamano1a4e8412005-12-27 08:17:2313(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])\*
14(-[c|d|o|i|s|u|k|m])\*
15[-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 Hamano5c3957e2006-03-28 00:28:0120[--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 Hamano1a4e8412005-12-27 08:17:2347Show other files in the output
48
Junio C Hamanoeb415992008-06-08 22:49:4749-i::
50--ignored::
Junio C Hamano3d30fd52007-05-08 00:32:5351Show ignored files in the output.
52Note that this also reverses any exclude list present.
Junio C Hamano1a4e8412005-12-27 08:17:2353
Junio C Hamanoeb415992008-06-08 22:49:4754-s::
55--stage::
Junio C Hamano90ccff32008-07-29 08:17:2456Show staged contents' object name, mode bits and stage number in the output.
Junio C Hamano1a4e8412005-12-27 08:17:2357
Junio C Hamanoa6331a82006-01-22 07:50:3358--directory::
59If a whole directory is classified as "other", show just its
60name (with a trailing slash) and not its whole contents.
61
Junio C Hamanof02e09f2006-03-27 07:51:0362--no-empty-directory::
63Do not list empty directories. Has no effect without --directory.
64
Junio C Hamanoeb415992008-06-08 22:49:4765-u::
66--unmerged::
Junio C Hamano1a4e8412005-12-27 08:17:2367Show unmerged files in the output (forces --stage)
68
Junio C Hamanoeb415992008-06-08 22:49:4769-k::
70--killed::
Junio C Hamano1a4e8412005-12-27 08:17:2371Show files on the filesystem that need to be removed due
72to file/directory conflicts for checkout-index to
73succeed.
74
75-z::
76\0 line termination on output.
77
Junio C Hamanoeb415992008-06-08 22:49:4778-x <pattern>::
79--exclude=<pattern>::
Junio C Hamano1a4e8412005-12-27 08:17:2380Skips files matching pattern.
81Note that pattern is a shell wildcard pattern.
82
Junio C Hamanoeb415992008-06-08 22:49:4783-X <file>::
84--exclude-from=<file>::
Junio C Hamano1a4e8412005-12-27 08:17:2385exclude patterns are read from <file>; 1 per line.
86
87--exclude-per-directory=<file>::
88read additional exclude patterns that apply only to the
89directory and its subdirectories in <file>.
90
Junio C Hamanoff979792007-11-16 10:11:3091--exclude-standard::
92Add the standard git exclusions: .git/info/exclude, .gitignore
93in each directory, and the user's global exclusion file.
94
Junio C Hamano7e9f6b72006-02-22 10:44:5595--error-unmatch::
96If any <file> does not appear in the index, treat this as an
97error (return 1).
98
Junio C Hamano58155b42007-09-15 07:46:1499--with-tree=<tree-ish>::
100When using --error-unmatch to expand the user supplied
101<file> (i.e. path pattern) arguments to paths, pretend
102that paths which were removed in the index since the
103named <tree-ish> are still present. Using this option
104with `-s` or `-u` options does not make any sense.
105
Junio C Hamano1a4e8412005-12-27 08:17:23106-t::
107Identify the file status with the following tags (followed by
108a space) at the start of each line:
109H:: cached
110M:: unmerged
111R:: removed/deleted
Junio C Hamano235a91e2006-01-07 01:13:58112C:: modified/changed
Junio C Hamano1a4e8412005-12-27 08:17:23113K:: to be killed
Junio C Hamano6697ac52006-02-14 08:00:23114?:: other
Junio C Hamano1a4e8412005-12-27 08:17:23115
Junio C Hamano7e9f6b72006-02-22 10:44:55116-v::
117Similar to `-t`, but use lowercase letters for files
Junio C Hamanof556fc22007-12-23 08:16:38118that are marked as 'assume unchanged' (see
Junio C Hamano35738e82008-01-07 07:55:46119linkgit:git-update-index[1]).
Junio C Hamano7e9f6b72006-02-22 10:44:55120
Junio C Hamano1a4e8412005-12-27 08:17:23121--full-name::
122When run from a subdirectory, the command usually
123outputs paths relative to the current directory. This
124option forces paths to be output relative to the project
125top directory.
126
Junio C Hamano5c3957e2006-03-28 00:28:01127--abbrev[=<n>]::
128Instead of showing the full 40-byte hexadecimal object
Junio C Hamano6efe3022009-01-13 16:47:56129lines, show only a partial prefix.
Junio C Hamano5c3957e2006-03-28 00:28:01130Non default number of digits can be specified with --abbrev=<n>.
131
Junio C Hamano1bb569e2006-05-05 23:14:25132\--::
Junio C Hamano1a4e8412005-12-27 08:17:23133Do not interpret any more arguments as options.
134
135<file>::
136Files to show. If no files are given all files which match the other
137specified criteria are shown.
138
139Output
140------
141show files just outputs the filename unless '--stage' is specified in
142which case it outputs:
143
144 [<tag> ]<mode> <object> <stage> <file>
145
Junio C Hamanoba4b9282008-07-06 05:20:31146'git-ls-files --unmerged' and 'git-ls-files --stage' can be used to examine
Junio C Hamano1a4e8412005-12-27 08:17:23147detailed information on unmerged paths.
148
149For an unmerged path, instead of recording a single mode/SHA1 pair,
Junio C Hamano36460982007-05-27 04:29:12150the index records up to three such pairs; one from tree O in stage
Junio C Hamano1a4e8412005-12-27 08:17:231511, A in stage 2, and B in stage 3. This information can be used by
152the user (or the porcelain) to see what should eventually be recorded at the
Junio C Hamanofce7c7e2008-07-02 03:06:38153path. (see linkgit:git-read-tree[1] for more information on state)
Junio C Hamano1a4e8412005-12-27 08:17:23154
155When `-z` option is not used, TAB, LF, and backslash characters
156in pathnames are represented as `\t`, `\n`, and `\\`,
157respectively.
158
159
160Exclude Patterns
161----------------
162
Junio C Hamanoba4b9282008-07-06 05:20:31163'git-ls-files' can use a list of "exclude patterns" when
Junio C Hamano1a4e8412005-12-27 08:17:23164traversing the directory tree and finding files to show when the
Junio C Hamano35738e82008-01-07 07:55:46165flags --others or --ignored are specified. linkgit:gitignore[5]
Junio C Hamano679d22d2007-06-02 21:13:44166specifies the format of exclude patterns.
Junio C Hamano1a4e8412005-12-27 08:17:23167
Junio C Hamano679d22d2007-06-02 21:13:44168These exclude patterns come from these places, in order:
Junio C Hamano1a4e8412005-12-27 08:17:23169
Junio C Hamano679d22d2007-06-02 21:13:44170 1. The command line flag --exclude=<pattern> specifies a
171 single pattern. Patterns are ordered in the same order
172 they appear in the command line.
Junio C Hamano1a4e8412005-12-27 08:17:23173
Junio C Hamano679d22d2007-06-02 21:13:44174 2. The command line flag --exclude-from=<file> specifies a
175 file containing a list of patterns. Patterns are ordered
176 in the same order they appear in the file.
Junio C Hamano1a4e8412005-12-27 08:17:23177
178 3. command line flag --exclude-per-directory=<name> specifies
Junio C Hamanoba4b9282008-07-06 05:20:31179 a name of the file in each directory 'git-ls-files'
Junio C Hamano679d22d2007-06-02 21:13:44180 examines, normally `.gitignore`. Files in deeper
181 directories take precedence. Patterns are ordered in the
182 same order they appear in the files.
Junio C Hamano1a4e8412005-12-27 08:17:23183
184A pattern specified on the command line with --exclude or read
185from the file specified with --exclude-from is relative to the
186top of the directory tree. A pattern read from a file specified
187by --exclude-per-directory is relative to the directory that the
188pattern file appears in.
189
Junio C Hamano9049d912008-05-29 02:09:50190SEE ALSO
Junio C Hamano1a4e8412005-12-27 08:17:23191--------
Junio C Hamano35738e82008-01-07 07:55:46192linkgit:git-read-tree[1], linkgit:gitignore[5]
Junio C Hamano1a4e8412005-12-27 08:17:23193
194
195Author
196------
197Written by Linus Torvalds <torvalds@osdl.org>
198
199Documentation
200--------------
Junio C Hamano679d22d2007-06-02 21:13:44201Documentation by David Greaves, Junio C Hamano, Josh Triplett, and the git-list <git@vger.kernel.org>.
Junio C Hamano1a4e8412005-12-27 08:17:23202
203GIT
204---
Junio C Hamanof7c042d2008-06-06 22:50:53205Part of the linkgit:git[1] suite