[PATCH] Verbose git-daemon logging
[git/dscho.git] / Documentation / git-ls-files.txt
blob591f4ed462dea070c3f5d264b1b96d7edd70d063
1 git-ls-files(1)
2 ===============
4 NAME
5 ----
6 git-ls-files - Information about files in the cache/working directory
9 SYNOPSIS
10 --------
11 'git-ls-files' [-z] [-t]
12                 (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])\*
13                 (-[c|d|o|i|s|u|k|m])\*
14                 [-x <pattern>|--exclude=<pattern>]
15                 [-X <file>|--exclude-from=<file>]
16                 [--exclude-per-directory=<file>]
18 DESCRIPTION
19 -----------
20 This merges the file listing in the directory cache index with the
21 actual working directory list, and shows different combinations of the
22 two.
24 One or more of the options below may be used to determine the files
25 shown:
27 OPTIONS
28 -------
29 -c|--cached::
30         Show cached files in the output (default)
32 -d|--deleted::
33         Show deleted files in the output
35 -m|--modified::
36         Show modified files in the output
38 -o|--others::
39         Show other files in the output
41 -i|--ignored::
42         Show ignored files in the output
43         Note the this also reverses any exclude list present.
45 -s|--stage::
46         Show stage files in the output
48 -u|--unmerged::
49         Show unmerged files in the output (forces --stage)
51 -k|--killed::
52         Show files on the filesystem that need to be removed due
53         to file/directory conflicts for checkout-cache to
54         succeed.
56 -z::
57         \0 line termination on output
59 -x|--exclude=<pattern>::
60         Skips files matching pattern.
61         Note that pattern is a shell wildcard pattern.
63 -X|--exclude-from=<file>::
64         exclude patterns are read from <file>; 1 per line.
66 --exclude-per-directory=<file>::
67         read additional exclude patterns that apply only to the
68         directory and its subdirectories in <file>.
70 -t::
71         Identify the file status with the following tags (followed by
72         a space) at the start of each line:
73         H       cached
74         M       unmerged
75         R       removed/deleted
76         C       modifed/changed
77         K       to be killed
78         ?       other
80 Output
81 ------
82 show files just outputs the filename unless '--stage' is specified in
83 which case it outputs:
85         [<tag> ]<mode> <object> <stage> <file>
87 "git-ls-files --unmerged" and "git-ls-files --stage" can be used to examine
88 detailed information on unmerged paths.
90 For an unmerged path, instead of recording a single mode/SHA1 pair,
91 the dircache records up to three such pairs; one from tree O in stage
92 1, A in stage 2, and B in stage 3.  This information can be used by
93 the user (or the porcelain) to see what should eventually be recorded at the
94 path. (see git-read-tree for more information on state)
97 Exclude Patterns
98 ----------------
100 'git-ls-files' can use a list of "exclude patterns" when
101 traversing the directory tree and finding files to show when the
102 flags --others or --ignored are specified.
104 These exclude patterns come from these places:
106  (1) command line flag --exclude=<pattern> specifies a single
107      pattern.
109  (2) command line flag --exclude-from=<file> specifies a list of
110      patterns stored in a file.
112  (3) command line flag --exclude-per-directory=<name> specifies
113      a name of the file in each directory 'git-ls-files'
114      examines, and if exists, its contents are used as an
115      additional list of patterns.
117 An exclude pattern file used by (2) and (3) contains one pattern
118 per line.  A line that starts with a '#' can be used as comment
119 for readability.
121 There are three lists of patterns that are in effect at a given
122 time.  They are built and ordered in the following way:
124  * --exclude=<pattern> from the command line; patterns are
125    ordered in the same order as they appear on the command line.
127  * lines read from --exclude-from=<file>; patterns are ordered
128    in the same order as they appear in the file.
130  * When --exclude-per-directory=<name> is specified, upon
131    entering a directory that has such a file, its contents are
132    appended at the end of the current "list of patterns".  They
133    are popped off when leaving the directory.
135 Each pattern in the pattern list specifies "a match pattern" and
136 optionally the fate; either a file that matches the pattern is
137 considered excluded or included.  A filename is matched against
138 the patterns in the three lists; the --exclude-from list is
139 checked first, then the --exclude-per-directory list, and then
140 finally the --exclude list. The last match determines its fate.
141 If there is no match in the three lists, the fate is "included".
143 A pattern specified on the command line with --exclude or read
144 from the file specified with --exclude-from is relative to the
145 top of the directory tree.  A pattern read from a file specified
146 by --exclude-per-directory is relative to the directory that the
147 pattern file appears in.
149 An exclude pattern is of the following format:
151  - an optional prefix '!' which means that the fate this pattern
152    specifies is "include", not the usual "exclude"; the
153    remainder of the pattern string is interpreted according to
154    the following rules.
156  - if it does not contain a slash '/', it is a shell glob
157    pattern and used to match against the filename without
158    leading directories (i.e. the same way as the current
159    implementation).
161  - otherwise, it is a shell glob pattern, suitable for
162    consumption by fnmatch(3) with FNM_PATHNAME flag.  I.e. a
163    slash in the pattern must match a slash in the pathname.
164    "Documentation/*.html" matches "Documentation/git.html" but
165    not "ppc/ppc.html".  As a natural exception, "/*.c" matches
166    "cat-file.c" but not "mozilla-sha1/sha1.c".
168 An example:
170     $ cat .git/ignore
171     # ignore objects and archives, anywhere in the tree.
172     *.[oa]
173     $ cat Documentation/.gitignore
174     # ignore generated html files,
175     *.html
176     # except foo.html which is maintained by hand
177     !foo.html
178     $ git-ls-files --ignored \
179         --exclude='Documentation/*.[0-9]' \
180         --exclude-from=.git/ignore \
181         --exclude-per-directory=.gitignore
184 See Also
185 --------
186 gitlink:git-read-tree[1]
189 Author
190 ------
191 Written by Linus Torvalds <torvalds@osdl.org>
193 Documentation
194 --------------
195 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
199 Part of the gitlink:git[7] suite