blob: c09e17789d950bcc79c8a8c8810d7cc60acf3a51 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano6697ac52006-02-14 08:00:236<meta name="generator" content="AsciiDoc 7.0.2" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
19a { color: blue; }
20a:visited { color: fuchsia; }
21
22em {
23 font-style: italic;
24}
25
26strong {
27 font-weight: bold;
28}
29
30tt {
31 color: navy;
32}
33
34h1, h2, h3, h4, h5, h6 {
35 color: #527bbd;
36 font-family: sans-serif;
37 margin-top: 1.2em;
38 margin-bottom: 0.5em;
39 line-height: 1.3;
40}
41
42h1 {
43 border-bottom: 2px solid silver;
44}
45h2 {
46 border-bottom: 2px solid silver;
47 padding-top: 0.5em;
48}
49
50div.sectionbody {
51 font-family: serif;
52 margin-left: 0;
53}
54
55hr {
56 border: 1px solid silver;
57}
58
59p {
60 margin-top: 0.5em;
61 margin-bottom: 0.5em;
62}
63
64pre {
65 padding: 0;
66 margin: 0;
67}
68
69span#author {
70 color: #527bbd;
71 font-family: sans-serif;
72 font-weight: bold;
73 font-size: 1.2em;
74}
75span#email {
76}
77span#revision {
78 font-family: sans-serif;
79}
80
81div#footer {
82 font-family: sans-serif;
83 font-size: small;
84 border-top: 2px solid silver;
85 padding-top: 0.5em;
86 margin-top: 4.0em;
87}
88div#footer-text {
89 float: left;
90 padding-bottom: 0.5em;
91}
92div#footer-badges {
93 float: right;
94 padding-bottom: 0.5em;
95}
96
97div#preamble,
98div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
99div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
100div.admonitionblock {
101 margin-right: 10%;
102 margin-top: 1.5em;
103 margin-bottom: 1.5em;
104}
105div.admonitionblock {
106 margin-top: 2.5em;
107 margin-bottom: 2.5em;
108}
109
110div.content { /* Block element content. */
111 padding: 0;
112}
113
114/* Block element titles. */
115div.title, caption.title {
116 font-family: sans-serif;
117 font-weight: bold;
118 text-align: left;
119 margin-top: 1.0em;
120 margin-bottom: 0.5em;
121}
122div.title + * {
123 margin-top: 0;
124}
125
126td div.title:first-child {
127 margin-top: 0.0em;
128}
129div.content div.title:first-child {
130 margin-top: 0.0em;
131}
132div.content + div.title {
133 margin-top: 0.0em;
134}
135
136div.sidebarblock > div.content {
137 background: #ffffee;
138 border: 1px solid silver;
139 padding: 0.5em;
140}
141
142div.listingblock > div.content {
143 border: 1px solid silver;
144 background: #f4f4f4;
145 padding: 0.5em;
146}
147
148div.quoteblock > div.content {
149 padding-left: 2.0em;
150}
151div.quoteblock .attribution {
152 text-align: right;
153}
154
155div.admonitionblock .icon {
156 vertical-align: top;
157 font-size: 1.1em;
158 font-weight: bold;
159 text-decoration: underline;
160 color: #527bbd;
161 padding-right: 0.5em;
162}
163div.admonitionblock td.content {
164 padding-left: 0.5em;
165 border-left: 2px solid silver;
166}
167
168div.exampleblock > div.content {
169 border-left: 2px solid silver;
170 padding: 0.5em;
171}
172
173div.verseblock div.content {
174 white-space: pre;
175}
176
177div.imageblock div.content { padding-left: 0; }
178div.imageblock img { border: 1px solid silver; }
179span.image img { border-style: none; }
180
181dl {
182 margin-top: 0.8em;
183 margin-bottom: 0.8em;
184}
185dt {
186 margin-top: 0.5em;
187 margin-bottom: 0;
188 font-style: italic;
189}
190dd > *:first-child {
191 margin-top: 0;
192}
193
194ul, ol {
195 list-style-position: outside;
196}
197ol.olist2 {
198 list-style-type: lower-alpha;
199}
200
201div.tableblock > table {
202 border-color: #527bbd;
203 border-width: 3px;
204}
205thead {
206 font-family: sans-serif;
207 font-weight: bold;
208}
209tfoot {
210 font-weight: bold;
211}
212
213div.hlist {
214 margin-top: 0.8em;
215 margin-bottom: 0.8em;
216}
217td.hlist1 {
218 vertical-align: top;
219 font-style: italic;
220 padding-right: 0.8em;
221}
222td.hlist2 {
223 vertical-align: top;
224}
225
226@media print {
227 div#footer-badges { display: none; }
228}
229include::./stylesheets/xhtml11-manpage.css[]
230/* Workarounds for IE6's broken and incomplete CSS2. */
231
232div.sidebar-content {
233 background: #ffffee;
234 border: 1px solid silver;
235 padding: 0.5em;
236}
237div.sidebar-title, div.image-title {
238 font-family: sans-serif;
239 font-weight: bold;
240 margin-top: 0.0em;
241 margin-bottom: 0.5em;
242}
243
244div.listingblock div.content {
245 border: 1px solid silver;
246 background: #f4f4f4;
247 padding: 0.5em;
248}
249
250div.quoteblock-content {
251 padding-left: 2.0em;
252}
253
254div.exampleblock-content {
255 border-left: 2px solid silver;
256 padding-left: 0.5em;
257}
258</style>
259<title>git-ls-files(1)</title>
260</head>
261<body>
262<div id="header">
263<h1>
264git-ls-files(1) Manual Page
265</h1>
266<h2>NAME</h2>
267<div class="sectionbody">
268<p>git-ls-files -
Junio C Hamano7c73c662007-01-19 00:37:50269 Show information about files in the index and the working tree
Junio C Hamano1a4e8412005-12-27 08:17:23270</p>
271</div>
272</div>
273<h2>SYNOPSIS</h2>
274<div class="sectionbody">
Junio C Hamano7e9f6b72006-02-22 10:44:55275<div class="verseblock">
276<div class="content"><em>git-ls-files</em> [-z] [-t] [-v]
Junio C Hamano1a4e8412005-12-27 08:17:23277 (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*
278 (-[c|d|o|i|s|u|k|m])*
279 [-x &lt;pattern&gt;|--exclude=&lt;pattern&gt;]
280 [-X &lt;file&gt;|--exclude-from=&lt;file&gt;]
281 [--exclude-per-directory=&lt;file&gt;]
Junio C Hamano7e9f6b72006-02-22 10:44:55282 [--error-unmatch]
Junio C Hamano5c3957e2006-03-28 00:28:01283 [--full-name] [--abbrev] [--] [&lt;file&gt;]*</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23284</div>
285<h2>DESCRIPTION</h2>
286<div class="sectionbody">
287<p>This merges the file listing in the directory cache index with the
288actual working directory list, and shows different combinations of the
289two.</p>
290<p>One or more of the options below may be used to determine the files
291shown:</p>
292</div>
293<h2>OPTIONS</h2>
294<div class="sectionbody">
295<dl>
296<dt>
297-c|--cached
298</dt>
299<dd>
300<p>
301 Show cached files in the output (default)
302</p>
303</dd>
304<dt>
305-d|--deleted
306</dt>
307<dd>
308<p>
309 Show deleted files in the output
310</p>
311</dd>
312<dt>
313-m|--modified
314</dt>
315<dd>
316<p>
317 Show modified files in the output
318</p>
319</dd>
320<dt>
321-o|--others
322</dt>
323<dd>
324<p>
325 Show other files in the output
326</p>
327</dd>
328<dt>
329-i|--ignored
330</dt>
331<dd>
332<p>
333 Show ignored files in the output
334 Note the this also reverses any exclude list present.
335</p>
336</dd>
337<dt>
338-s|--stage
339</dt>
340<dd>
341<p>
342 Show stage files in the output
343</p>
344</dd>
345<dt>
Junio C Hamanoa6331a82006-01-22 07:50:33346--directory
347</dt>
348<dd>
349<p>
350 If a whole directory is classified as "other", show just its
351 name (with a trailing slash) and not its whole contents.
352</p>
353</dd>
354<dt>
Junio C Hamanof02e09f2006-03-27 07:51:03355--no-empty-directory
356</dt>
357<dd>
358<p>
359 Do not list empty directories. Has no effect without --directory.
360</p>
361</dd>
362<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23363-u|--unmerged
364</dt>
365<dd>
366<p>
367 Show unmerged files in the output (forces --stage)
368</p>
369</dd>
370<dt>
371-k|--killed
372</dt>
373<dd>
374<p>
375 Show files on the filesystem that need to be removed due
376 to file/directory conflicts for checkout-index to
377 succeed.
378</p>
379</dd>
380<dt>
381-z
382</dt>
383<dd>
384<p>
385 \0 line termination on output.
386</p>
387</dd>
388<dt>
389-x|--exclude=&lt;pattern&gt;
390</dt>
391<dd>
392<p>
393 Skips files matching pattern.
394 Note that pattern is a shell wildcard pattern.
395</p>
396</dd>
397<dt>
398-X|--exclude-from=&lt;file&gt;
399</dt>
400<dd>
401<p>
402 exclude patterns are read from &lt;file&gt;; 1 per line.
403</p>
404</dd>
405<dt>
406--exclude-per-directory=&lt;file&gt;
407</dt>
408<dd>
409<p>
410 read additional exclude patterns that apply only to the
411 directory and its subdirectories in &lt;file&gt;.
412</p>
413</dd>
414<dt>
Junio C Hamano7e9f6b72006-02-22 10:44:55415--error-unmatch
416</dt>
417<dd>
418<p>
419 If any &lt;file&gt; does not appear in the index, treat this as an
420 error (return 1).
421</p>
422</dd>
423<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23424-t
425</dt>
426<dd>
427<p>
428 Identify the file status with the following tags (followed by
429 a space) at the start of each line:
430</p>
431<div class="hlist"><table>
432<tr>
433<td class="hlist1">
434H
435</td>
436<td class="hlist2">
437cached
438</td>
439</tr>
440<tr>
441<td class="hlist1">
442M
443</td>
444<td class="hlist2">
445unmerged
446</td>
447</tr>
448<tr>
449<td class="hlist1">
450R
451</td>
452<td class="hlist2">
453removed/deleted
454</td>
455</tr>
456<tr>
457<td class="hlist1">
458C
459</td>
460<td class="hlist2">
Junio C Hamano235a91e2006-01-07 01:13:58461modified/changed
Junio C Hamano1a4e8412005-12-27 08:17:23462</td>
463</tr>
464<tr>
465<td class="hlist1">
466K
467</td>
468<td class="hlist2">
469to be killed
Junio C Hamano6697ac52006-02-14 08:00:23470</td>
471</tr>
472<tr>
473<td class="hlist1">
474?
475</td>
476<td class="hlist2">
477other
Junio C Hamano1a4e8412005-12-27 08:17:23478</td>
479</tr>
480</table></div>
481</dd>
482<dt>
Junio C Hamano7e9f6b72006-02-22 10:44:55483-v
484</dt>
485<dd>
486<p>
487 Similar to <tt>-t</tt>, but use lowercase letters for files
488 that are marked as <em>always matching index</em>.
489</p>
490</dd>
491<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23492--full-name
493</dt>
494<dd>
495<p>
496 When run from a subdirectory, the command usually
497 outputs paths relative to the current directory. This
498 option forces paths to be output relative to the project
499 top directory.
500</p>
501</dd>
502<dt>
Junio C Hamano5c3957e2006-03-28 00:28:01503--abbrev[=&lt;n&gt;]
504</dt>
505<dd>
506<p>
507 Instead of showing the full 40-byte hexadecimal object
508 lines, show only handful hexdigits prefix.
509 Non default number of digits can be specified with --abbrev=&lt;n&gt;.
510</p>
511</dd>
512<dt>
Junio C Hamano1bb569e2006-05-05 23:14:25513--
Junio C Hamano1a4e8412005-12-27 08:17:23514</dt>
515<dd>
516<p>
517 Do not interpret any more arguments as options.
518</p>
519</dd>
520<dt>
521&lt;file&gt;
522</dt>
523<dd>
524<p>
525 Files to show. If no files are given all files which match the other
526 specified criteria are shown.
527</p>
528</dd>
529</dl>
530</div>
531<h2>Output</h2>
532<div class="sectionbody">
533<p>show files just outputs the filename unless <em>--stage</em> is specified in
534which case it outputs:</p>
535<div class="literalblock">
536<div class="content">
537<pre><tt>[&lt;tag&gt; ]&lt;mode&gt; &lt;object&gt; &lt;stage&gt; &lt;file&gt;</tt></pre>
538</div></div>
539<p>"git-ls-files --unmerged" and "git-ls-files --stage" can be used to examine
540detailed information on unmerged paths.</p>
541<p>For an unmerged path, instead of recording a single mode/SHA1 pair,
542the dircache records up to three such pairs; one from tree O in stage
5431, A in stage 2, and B in stage 3. This information can be used by
544the user (or the porcelain) to see what should eventually be recorded at the
545path. (see git-read-tree for more information on state)</p>
546<p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters
547in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>,
548respectively.</p>
549</div>
550<h2>Exclude Patterns</h2>
551<div class="sectionbody">
552<p><em>git-ls-files</em> can use a list of "exclude patterns" when
553traversing the directory tree and finding files to show when the
554flags --others or --ignored are specified.</p>
555<p>These exclude patterns come from these places:</p>
556<ol>
557<li>
558<p>
559command line flag --exclude=&lt;pattern&gt; specifies a single
560 pattern.
561</p>
562</li>
563<li>
564<p>
565command line flag --exclude-from=&lt;file&gt; specifies a list of
566 patterns stored in a file.
567</p>
568</li>
569<li>
570<p>
571command line flag --exclude-per-directory=&lt;name&gt; specifies
572 a name of the file in each directory <em>git-ls-files</em>
573 examines, and if exists, its contents are used as an
574 additional list of patterns.
575</p>
576</li>
577</ol>
578<p>An exclude pattern file used by (2) and (3) contains one pattern
579per line. A line that starts with a <em>#</em> can be used as comment
580for readability.</p>
581<p>There are three lists of patterns that are in effect at a given
582time. They are built and ordered in the following way:</p>
583<ul>
584<li>
585<p>
586--exclude=&lt;pattern&gt; from the command line; patterns are
587 ordered in the same order as they appear on the command line.
588</p>
589</li>
590<li>
591<p>
592lines read from --exclude-from=&lt;file&gt;; patterns are ordered
593 in the same order as they appear in the file.
594</p>
595</li>
596<li>
597<p>
598When --exclude-per-directory=&lt;name&gt; is specified, upon
599 entering a directory that has such a file, its contents are
600 appended at the end of the current "list of patterns". They
601 are popped off when leaving the directory.
602</p>
603</li>
604</ul>
605<p>Each pattern in the pattern list specifies "a match pattern" and
606optionally the fate; either a file that matches the pattern is
607considered excluded or included. A filename is matched against
608the patterns in the three lists; the --exclude-from list is
609checked first, then the --exclude-per-directory list, and then
610finally the --exclude list. The last match determines its fate.
611If there is no match in the three lists, the fate is "included".</p>
612<p>A pattern specified on the command line with --exclude or read
613from the file specified with --exclude-from is relative to the
614top of the directory tree. A pattern read from a file specified
615by --exclude-per-directory is relative to the directory that the
616pattern file appears in.</p>
617<p>An exclude pattern is of the following format:</p>
618<ul>
619<li>
620<p>
621an optional prefix <em>!</em> which means that the fate this pattern
622 specifies is "include", not the usual "exclude"; the
623 remainder of the pattern string is interpreted according to
624 the following rules.
625</p>
626</li>
627<li>
628<p>
629if it does not contain a slash <em>/</em>, it is a shell glob
630 pattern and used to match against the filename without
Junio C Hamano125c3272006-06-08 03:41:35631 leading directories.
Junio C Hamano1a4e8412005-12-27 08:17:23632</p>
633</li>
634<li>
635<p>
636otherwise, it is a shell glob pattern, suitable for
637 consumption by fnmatch(3) with FNM_PATHNAME flag. I.e. a
638 slash in the pattern must match a slash in the pathname.
639 "Documentation/*.html" matches "Documentation/git.html" but
640 not "ppc/ppc.html". As a natural exception, "/*.c" matches
641 "cat-file.c" but not "mozilla-sha1/sha1.c".
642</p>
643</li>
644</ul>
645<p>An example:</p>
646<div class="listingblock">
647<div class="content">
Junio C Hamano7ccb9fd2006-07-15 01:38:40648<pre><tt> $ cat .git/info/exclude
Junio C Hamano1a4e8412005-12-27 08:17:23649 # ignore objects and archives, anywhere in the tree.
650 *.[oa]
651 $ cat Documentation/.gitignore
652 # ignore generated html files,
653 *.html
654 # except foo.html which is maintained by hand
655 !foo.html
656 $ git-ls-files --ignored \
657 --exclude='Documentation/*.[0-9]' \
Junio C Hamano7ccb9fd2006-07-15 01:38:40658 --exclude-from=.git/info/exclude \
Junio C Hamano1a4e8412005-12-27 08:17:23659 --exclude-per-directory=.gitignore</tt></pre>
660</div></div>
Junio C Hamano125c3272006-06-08 03:41:35661<p>Another example:</p>
662<div class="listingblock">
663<div class="content">
664<pre><tt> $ cat .gitignore
665 vmlinux*
666 $ ls arch/foo/kernel/vm*
667 arch/foo/kernel/vmlinux.lds.S
668 $ echo '!/vmlinux*' &gt;arch/foo/kernel/.gitignore</tt></pre>
669</div></div>
670<p>The second .gitignore keeps <tt>arch/foo/kernel/vmlinux.lds.S</tt> file
671from getting ignored.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23672</div>
673<h2>See Also</h2>
674<div class="sectionbody">
675<p><a href="git-read-tree.html">git-read-tree(1)</a></p>
676</div>
677<h2>Author</h2>
678<div class="sectionbody">
679<p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;</p>
680</div>
681<h2>Documentation</h2>
682<div class="sectionbody">
683<p>Documentation by David Greaves, Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p>
684</div>
685<h2>GIT</h2>
686<div class="sectionbody">
687<p>Part of the <a href="git.html">git(7)</a> suite</p>
688</div>
689<div id="footer">
690<div id="footer-text">
Junio C Hamano7c73c662007-01-19 00:37:50691Last updated 19-Jan-2007 00:37:22 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23692</div>
693</div>
694</body>
695</html>