summaryrefslogtreecommitdiff
path: root/Documentation/git-ls-files.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/git-ls-files.txt')
-rw-r--r--Documentation/git-ls-files.txt41
1 files changed, 39 insertions, 2 deletions
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index 48cc7c0..d798641 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -20,7 +20,7 @@ SYNOPSIS
[--exclude-standard]
[--error-unmatch] [--with-tree=<tree-ish>]
[--full-name] [--recurse-submodules]
- [--abbrev[=<n>]] [--] [<file>...]
+ [--abbrev[=<n>]] [--format=<format>] [--] [<file>...]
DESCRIPTION
-----------
@@ -156,7 +156,7 @@ a space) at the start of each line:
--recurse-submodules::
Recursively calls ls-files on each active submodule in the repository.
- Currently there is only support for the --cached mode.
+ Currently there is only support for the --cached and --stage modes.
--abbrev[=<n>]::
Instead of showing the full 40-byte hexadecimal object
@@ -192,6 +192,13 @@ followed by the ("attr/<eolattr>").
to the contained files. Sparse directories will be shown with a
trailing slash, such as "x/" for a sparse directory "x".
+--format=<format>::
+ A string that interpolates `%(fieldname)` from the result being shown.
+ It also interpolates `%%` to `%`, and `%xx` where `xx` are hex digits
+ interpolates to character with hex code `xx`; for example `%00`
+ interpolates to `\0` (NUL), `%09` to `\t` (TAB) and %0a to `\n` (LF).
+ --format cannot be combined with `-s`, `-o`, `-k`, `-t`, `--resolve-undo`
+ and `--eol`.
\--::
Do not interpret any more arguments as options.
@@ -223,6 +230,36 @@ quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). Using `-z` the filename is output
verbatim and the line is terminated by a NUL byte.
+It is possible to print in a custom format by using the `--format`
+option, which is able to interpolate different fields using
+a `%(fieldname)` notation. For example, if you only care about the
+"objectname" and "path" fields, you can execute with a specific
+"--format" like
+
+ git ls-files --format='%(objectname) %(path)'
+
+FIELD NAMES
+-----------
+The way each path is shown can be customized by using the
+`--format=<format>` option, where the %(fieldname) in the
+<format> string for various aspects of the index entry are
+interpolated. The following "fieldname" are understood:
+
+objectmode::
+ The mode of the file which is recorded in the index.
+objectname::
+ The name of the file which is recorded in the index.
+stage::
+ The stage of the file which is recorded in the index.
+eolinfo:index::
+eolinfo:worktree::
+ The <eolinfo> (see the description of the `--eol` option) of
+ the contents in the index or in the worktree for the path.
+eolattr::
+ The <eolattr> (see the description of the `--eol` option)
+ that applies to the path.
+path::
+ The pathname of the file which is recorded in the index.
EXCLUDE PATTERNS
----------------