1git-ls-tree(1)
2==============
34
NAME
5----
6git-ls-tree - List the contents of a tree object
78
9
SYNOPSIS
10--------
11[verse]
12'git ls-tree' [-d] [-r] [-t] [-l] [-z]
13[--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
14<tree-ish> [<path>...]
1516
DESCRIPTION
17-----------
18Lists the contents of a given tree object, like what "/bin/ls -a" does
19in the current working directory. Note that:
2021
- the behaviour is slightly different from that of "/bin/ls" in that the
22'<path>' denotes just a list of patterns to match, e.g. so specifying
23directory name (without `-r`) will behave differently, and order of the
24arguments does not matter.
2526
- the behaviour is similar to that of "/bin/ls" in that the '<path>' is
27taken as relative to the current working directory. E.g. when you are
28in a directory 'sub' that has a directory 'dir', you can run 'git
29ls-tree -r HEAD dir' to list the contents of the tree (that is
30'sub/dir' in `HEAD`). You don't want to give a tree that is not at the
31root level (e.g. `git ls-tree -r HEAD:sub dir`) in this case, as that
32would result in asking for 'sub/sub/dir' in the `HEAD` commit.
33However, the current working directory can be ignored by passing
34--full-tree option.
3536
OPTIONS
37-------
38<tree-ish>::
39Id of a tree-ish.
4041
-d::
42Show only the named tree entry itself, not its children.
4344
-r::
45Recurse into sub-trees.
4647
-t::
48Show tree entries even when going to recurse them. Has no effect
49if `-r` was not passed. `-d` implies `-t`.
5051
-l::
52--long::
53Show object size of blob (file) entries.
5455
-z::
56\0 line termination on output.
5758
--name-only::
59--name-status::
60List only filenames (instead of the "long" output), one per line.
6162
--abbrev[=<n>]::
63Instead of showing the full 40-byte hexadecimal object
64lines, show only a partial prefix.
65Non default number of digits can be specified with --abbrev=<n>.
6667
--full-name::
68Instead of showing the path names relative to the current working
69directory, show the full path names.
7071
--full-tree::
72Do not limit the listing to the current working directory.
73Implies --full-name.
7475
[<path>...]::
76When paths are given, show them (note that this isn't really raw
77pathnames, but rather a list of patterns to match). Otherwise
78implicitly uses the root level of the tree as the sole path argument.
7980
81
Output Format
82-------------
83<mode> SP <type> SP <object> TAB <file>
8485
Unless the `-z` option is used, TAB, LF, and backslash characters
86in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
87This output format is compatible with what `--index-info --stdin` of
88'git update-index' expects.
8990
When the `-l` option is used, format changes to
9192
<mode> SP <type> SP <object> SP <object size> TAB <file>
9394
Object size identified by <object> is given in bytes, and right-justified
95with minimum width of 7 characters. Object size is given only for blobs
96(file) entries; for other entries `-` character is used in place of size.
9798
GIT
99---
100Part of the linkgit:git[1] suite