blob: 625723e41fa072523fa850e37534677cfe8af631 [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 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 Hamano1a4e8412005-12-27 08:17:2382Skips files matching pattern.
83Note that pattern is a shell wildcard pattern.
84
Junio C Hamanoeb415992008-06-08 22:49:4785-X <file>::
86--exclude-from=<file>::
Junio C Hamano1a4e8412005-12-27 08:17:2387exclude patterns are read from <file>; 1 per line.
88
89--exclude-per-directory=<file>::
90read additional exclude patterns that apply only to the
91directory and its subdirectories in <file>.
92
Junio C Hamanoff979792007-11-16 10:11:3093--exclude-standard::
94Add the standard git exclusions: .git/info/exclude, .gitignore
95in each directory, and the user's global exclusion file.
96
Junio C Hamano7e9f6b72006-02-22 10:44:5597--error-unmatch::
98If any <file> does not appear in the index, treat this as an
99error (return 1).
100
Junio C Hamano58155b42007-09-15 07:46:14101--with-tree=<tree-ish>::
102When using --error-unmatch to expand the user supplied
103<file> (i.e. path pattern) arguments to paths, pretend
104that paths which were removed in the index since the
105named <tree-ish> are still present. Using this option
106with `-s` or `-u` options does not make any sense.
107
Junio C Hamano1a4e8412005-12-27 08:17:23108-t::
109Identify the file status with the following tags (followed by
110a space) at the start of each line:
111H:: cached
112M:: unmerged
113R:: removed/deleted
Junio C Hamano235a91e2006-01-07 01:13:58114C:: modified/changed
Junio C Hamano1a4e8412005-12-27 08:17:23115K:: to be killed
Junio C Hamano6697ac52006-02-14 08:00:23116?:: other
Junio C Hamano1a4e8412005-12-27 08:17:23117
Junio C Hamano7e9f6b72006-02-22 10:44:55118-v::
119Similar to `-t`, but use lowercase letters for files
Junio C Hamanof556fc22007-12-23 08:16:38120that are marked as 'assume unchanged' (see
Junio C Hamano35738e82008-01-07 07:55:46121linkgit:git-update-index[1]).
Junio C Hamano7e9f6b72006-02-22 10:44:55122
Junio C Hamano1a4e8412005-12-27 08:17:23123--full-name::
124When run from a subdirectory, the command usually
125outputs paths relative to the current directory. This
126option forces paths to be output relative to the project
127top directory.
128
Junio C Hamano5c3957e2006-03-28 00:28:01129--abbrev[=<n>]::
130Instead of showing the full 40-byte hexadecimal object
Junio C Hamano6efe3022009-01-13 16:47:56131lines, show only a partial prefix.
Junio C Hamano5c3957e2006-03-28 00:28:01132Non default number of digits can be specified with --abbrev=<n>.
133
Junio C Hamano1bb569e2006-05-05 23:14:25134\--::
Junio C Hamano1a4e8412005-12-27 08:17:23135Do not interpret any more arguments as options.
136
137<file>::
138Files to show. If no files are given all files which match the other
139specified criteria are shown.
140
141Output
142------
143show files just outputs the filename unless '--stage' is specified in
144which case it outputs:
145
146 [<tag> ]<mode> <object> <stage> <file>
147
Junio C Hamanoba4b9282008-07-06 05:20:31148'git-ls-files --unmerged' and 'git-ls-files --stage' can be used to examine
Junio C Hamano1a4e8412005-12-27 08:17:23149detailed information on unmerged paths.
150
151For an unmerged path, instead of recording a single mode/SHA1 pair,
Junio C Hamano36460982007-05-27 04:29:12152the index records up to three such pairs; one from tree O in stage
Junio C Hamano1a4e8412005-12-27 08:17:231531, A in stage 2, and B in stage 3. This information can be used by
154the user (or the porcelain) to see what should eventually be recorded at the
Junio C Hamanofce7c7e2008-07-02 03:06:38155path. (see linkgit:git-read-tree[1] for more information on state)
Junio C Hamano1a4e8412005-12-27 08:17:23156
157When `-z` option is not used, TAB, LF, and backslash characters
158in pathnames are represented as `\t`, `\n`, and `\\`,
159respectively.
160
161
162Exclude Patterns
163----------------
164
Junio C Hamanoba4b9282008-07-06 05:20:31165'git-ls-files' can use a list of "exclude patterns" when
Junio C Hamano1a4e8412005-12-27 08:17:23166traversing the directory tree and finding files to show when the
Junio C Hamano35738e82008-01-07 07:55:46167flags --others or --ignored are specified. linkgit:gitignore[5]
Junio C Hamano679d22d2007-06-02 21:13:44168specifies the format of exclude patterns.
Junio C Hamano1a4e8412005-12-27 08:17:23169
Junio C Hamano679d22d2007-06-02 21:13:44170These exclude patterns come from these places, in order:
Junio C Hamano1a4e8412005-12-27 08:17:23171
Junio C Hamano679d22d2007-06-02 21:13:44172 1. The command line flag --exclude=<pattern> specifies a
173 single pattern. Patterns are ordered in the same order
174 they appear in the command line.
Junio C Hamano1a4e8412005-12-27 08:17:23175
Junio C Hamano679d22d2007-06-02 21:13:44176 2. The command line flag --exclude-from=<file> specifies a
177 file containing a list of patterns. Patterns are ordered
178 in the same order they appear in the file.
Junio C Hamano1a4e8412005-12-27 08:17:23179
180 3. command line flag --exclude-per-directory=<name> specifies
Junio C Hamanoba4b9282008-07-06 05:20:31181 a name of the file in each directory 'git-ls-files'
Junio C Hamano679d22d2007-06-02 21:13:44182 examines, normally `.gitignore`. Files in deeper
183 directories take precedence. Patterns are ordered in the
184 same order they appear in the files.
Junio C Hamano1a4e8412005-12-27 08:17:23185
186A pattern specified on the command line with --exclude or read
187from the file specified with --exclude-from is relative to the
188top of the directory tree. A pattern read from a file specified
189by --exclude-per-directory is relative to the directory that the
190pattern file appears in.
191
Junio C Hamano9049d912008-05-29 02:09:50192SEE ALSO
Junio C Hamano1a4e8412005-12-27 08:17:23193--------
Junio C Hamano35738e82008-01-07 07:55:46194linkgit:git-read-tree[1], linkgit:gitignore[5]
Junio C Hamano1a4e8412005-12-27 08:17:23195
196
197Author
198------
199Written by Linus Torvalds <torvalds@osdl.org>
200
201Documentation
202--------------
Junio C Hamano679d22d2007-06-02 21:13:44203Documentation by David Greaves, Junio C Hamano, Josh Triplett, and the git-list <git@vger.kernel.org>.
Junio C Hamano1a4e8412005-12-27 08:17:23204
205GIT
206---
Junio C Hamanof7c042d2008-06-06 22:50:53207Part of the linkgit:git[1] suite