1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <article lang="en" id="git-ls-files(1)">
\r
6 <title>git-ls-files(1)</title>
\r
8 <primary>git-ls-files(1)</primary>
\r
11 <simplesect id="_name">
\r
13 <simpara>git-ls-files - Show information about files in the index and the working tree</simpara>
\r
15 <simplesect id="_synopsis">
\r
16 <title>SYNOPSIS</title>
\r
18 <literallayout><emphasis>git ls-files</emphasis> [-z] [-t] [-v]
\r
19 (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*
\r
20 (-[c|d|o|i|s|u|k|m])*
\r
21 [-x <pattern>|--exclude=<pattern>]
\r
22 [-X <file>|--exclude-from=<file>]
\r
23 [--exclude-per-directory=<file>]
\r
24 [--exclude-standard]
\r
25 [--error-unmatch] [--with-tree=<tree-ish>]
\r
26 [--full-name] [--abbrev] [--] [<file>…]</literallayout>
\r
29 <simplesect id="_description">
\r
30 <title>DESCRIPTION</title>
\r
31 <simpara>This merges the file listing in the directory cache index with the
\r
32 actual working directory list, and shows different combinations of the
\r
34 <simpara>One or more of the options below may be used to determine the files
\r
37 <simplesect id="_options">
\r
38 <title>OPTIONS</title>
\r
49 Show cached files in the output (default)
\r
62 Show deleted files in the output
\r
75 Show modified files in the output
\r
88 Show other (i.e. untracked) files in the output
\r
101 Show only ignored files in the output. When showing files in the
\r
102 index, print only those matched by an exclude pattern. When
\r
103 showing "other" files, show only those matched by an exclude
\r
117 Show staged contents' object name, mode bits and stage number in the output.
\r
127 If a whole directory is classified as "other", show just its
\r
128 name (with a trailing slash) and not its whole contents.
\r
134 --no-empty-directory
\r
138 Do not list empty directories. Has no effect without --directory.
\r
151 Show unmerged files in the output (forces --stage)
\r
164 Show files on the filesystem that need to be removed due
\r
165 to file/directory conflicts for checkout-index to
\r
176 \0 line termination on output.
\r
185 --exclude=<pattern>
\r
189 Skip untracked files matching pattern.
\r
190 Note that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS
\r
191 below for more information.
\r
200 --exclude-from=<file>
\r
204 Read exclude patterns from <file>; 1 per line.
\r
210 --exclude-per-directory=<file>
\r
214 Read additional exclude patterns that apply only to the
\r
215 directory and its subdirectories in <file>.
\r
225 Add the standard git exclusions: .git/info/exclude, .gitignore
\r
226 in each directory, and the user's global exclusion file.
\r
236 If any <file> does not appear in the index, treat this as an
\r
243 --with-tree=<tree-ish>
\r
247 When using --error-unmatch to expand the user supplied
\r
248 <file> (i.e. path pattern) arguments to paths, pretend
\r
249 that paths which were removed in the index since the
\r
250 named <tree-ish> are still present. Using this option
\r
251 with <emphasis>-s</emphasis> or <emphasis>-u</emphasis> options does not make any sense.
\r
261 This feature is semi-deprecated. For scripting purpose,
\r
262 <xref linkend="git-status(1)" /> <emphasis>--porcelain</emphasis> and
\r
263 <xref linkend="git-diff-files(1)" /> <emphasis>--name-status</emphasis> are almost always
\r
264 superior alternatives, and users should look at
\r
265 <xref linkend="git-status(1)" /> <emphasis>--short</emphasis> or <xref linkend="git-diff(1)" />
\r
266 <emphasis>--name-status</emphasis> for more user-friendly alternatives.
\r
268 <simpara>This option identifies the file status with the following tags (followed by
\r
269 a space) at the start of each line:</simpara>
\r
348 Similar to <emphasis>-t</emphasis>, but use lowercase letters for files
\r
349 that are marked as <emphasis>assume unchanged</emphasis> (see
\r
350 <xref linkend="git-update-index(1)" />).
\r
360 When run from a subdirectory, the command usually
\r
361 outputs paths relative to the current directory. This
\r
362 option forces paths to be output relative to the project
\r
369 --abbrev[=<n>]
\r
373 Instead of showing the full 40-byte hexadecimal object
\r
374 lines, show only a partial prefix.
\r
375 Non default number of digits can be specified with --abbrev=<n>.
\r
385 After each line that describes a file, add more data about its
\r
386 cache entry. This is intended to show as much information as
\r
387 possible for manual inspection; the exact format may change at
\r
398 Do not interpret any more arguments as options.
\r
408 Files to show. If no files are given all files which match the other
\r
409 specified criteria are shown.
\r
415 <simplesect id="_output">
\r
416 <title>Output</title>
\r
417 <simpara><emphasis>git ls-files</emphasis> just outputs the filenames unless <emphasis>--stage</emphasis> is specified in
\r
418 which case it outputs:</simpara>
\r
419 <literallayout class="monospaced">[<tag> ]<mode> <object> <stage> <file></literallayout>
\r
420 <simpara><emphasis>git ls-files --unmerged</emphasis> and <emphasis>git ls-files --stage</emphasis> can be used to examine
\r
421 detailed information on unmerged paths.</simpara>
\r
422 <simpara>For an unmerged path, instead of recording a single mode/SHA1 pair,
\r
423 the index records up to three such pairs; one from tree O in stage
\r
424 1, A in stage 2, and B in stage 3. This information can be used by
\r
425 the user (or the porcelain) to see what should eventually be recorded at the
\r
426 path. (see <xref linkend="git-read-tree(1)" /> for more information on state)</simpara>
\r
427 <simpara>When <emphasis>-z</emphasis> option is not used, TAB, LF, and backslash characters
\r
428 in pathnames are represented as <emphasis>\t</emphasis>, <emphasis>\n</emphasis>, and <emphasis>\\</emphasis>,
\r
429 respectively.</simpara>
\r
431 <simplesect id="_exclude_patterns">
\r
432 <title>Exclude Patterns</title>
\r
433 <simpara><emphasis>git ls-files</emphasis> can use a list of "exclude patterns" when
\r
434 traversing the directory tree and finding files to show when the
\r
435 flags --others or --ignored are specified. <xref linkend="gitignore(5)" />
\r
436 specifies the format of exclude patterns.</simpara>
\r
437 <simpara>These exclude patterns come from these places, in order:</simpara>
\r
438 <orderedlist numeration="arabic">
\r
441 The command line flag --exclude=<pattern> specifies a
\r
442 single pattern. Patterns are ordered in the same order
\r
443 they appear in the command line.
\r
448 The command line flag --exclude-from=<file> specifies a
\r
449 file containing a list of patterns. Patterns are ordered
\r
450 in the same order they appear in the file.
\r
455 The command line flag --exclude-per-directory=<name> specifies
\r
456 a name of the file in each directory <emphasis>git ls-files</emphasis>
\r
457 examines, normally <emphasis>.gitignore</emphasis>. Files in deeper
\r
458 directories take precedence. Patterns are ordered in the
\r
459 same order they appear in the files.
\r
463 <simpara>A pattern specified on the command line with --exclude or read
\r
464 from the file specified with --exclude-from is relative to the
\r
465 top of the directory tree. A pattern read from a file specified
\r
466 by --exclude-per-directory is relative to the directory that the
\r
467 pattern file appears in.</simpara>
\r
469 <simplesect id="_see_also">
\r
470 <title>SEE ALSO</title>
\r
471 <simpara><xref linkend="git-read-tree(1)" />, <xref linkend="gitignore(5)" /></simpara>
\r
473 <simplesect id="_git">
\r
475 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r