1GIT-LS-TREE(1)                    Git Manual                    GIT-LS-TREE(1)
2
3
4

NAME

6       git-ls-tree - List the contents of a tree object
7

SYNOPSIS

9       git ls-tree [-d] [-r] [-t] [-l] [-z]
10                   [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
11                   <tree-ish> [<path>...]
12

DESCRIPTION

14       Lists the contents of a given tree object, like what "/bin/ls -a" does
15       in the current working directory. Note that:
16
17       •   the behaviour is slightly different from that of "/bin/ls" in that
18           the <path> denotes just a list of patterns to match, e.g. so
19           specifying directory name (without -r) will behave differently, and
20           order of the arguments does not matter.
21
22       •   the behaviour is similar to that of "/bin/ls" in that the <path> is
23           taken as relative to the current working directory. E.g. when you
24           are in a directory sub that has a directory dir, you can run git
25           ls-tree -r HEAD dir to list the contents of the tree (that is
26           sub/dir in HEAD). You don’t want to give a tree that is not at the
27           root level (e.g.  git ls-tree -r HEAD:sub dir) in this case, as
28           that would result in asking for sub/sub/dir in the HEAD commit.
29           However, the current working directory can be ignored by passing
30           --full-tree option.
31

OPTIONS

33       <tree-ish>
34           Id of a tree-ish.
35
36       -d
37           Show only the named tree entry itself, not its children.
38
39       -r
40           Recurse into sub-trees.
41
42       -t
43           Show tree entries even when going to recurse them. Has no effect if
44           -r was not passed.  -d implies -t.
45
46       -l, --long
47           Show object size of blob (file) entries.
48
49       -z
50           \0 line termination on output and do not quote filenames. See
51           OUTPUT FORMAT below for more information.
52
53       --name-only, --name-status
54           List only filenames (instead of the "long" output), one per line.
55
56       --abbrev[=<n>]
57           Instead of showing the full 40-byte hexadecimal object lines, show
58           the shortest prefix that is at least <n> hexdigits long that
59           uniquely refers the object. Non default number of digits can be
60           specified with --abbrev=<n>.
61
62       --full-name
63           Instead of showing the path names relative to the current working
64           directory, show the full path names.
65
66       --full-tree
67           Do not limit the listing to the current working directory. Implies
68           --full-name.
69
70       [<path>...]
71           When paths are given, show them (note that this isn’t really raw
72           pathnames, but rather a list of patterns to match). Otherwise
73           implicitly uses the root level of the tree as the sole path
74           argument.
75

OUTPUT FORMAT

77           <mode> SP <type> SP <object> TAB <file>
78
79       This output format is compatible with what --index-info --stdin of git
80       update-index expects.
81
82       When the -l option is used, format changes to
83
84           <mode> SP <type> SP <object> SP <object size> TAB <file>
85
86       Object size identified by <object> is given in bytes, and
87       right-justified with minimum width of 7 characters. Object size is
88       given only for blobs (file) entries; for other entries - character is
89       used in place of size.
90
91       Without the -z option, pathnames with "unusual" characters are quoted
92       as explained for the configuration variable core.quotePath (see git-
93       config(1)). Using -z the filename is output verbatim and the line is
94       terminated by a NUL byte.
95

GIT

97       Part of the git(1) suite
98
99
100
101Git 2.31.1                        2021-03-26                    GIT-LS-TREE(1)
Impressum