1GIT-LS-TREE(1) Git Manual GIT-LS-TREE(1)
2
3
4
6 git-ls-tree - List the contents of a tree object
7
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
13
15 Lists the contents of a given tree object, like what "/bin/ls -a" does
16 in the current working directory. Note that:
17
18 · the behaviour is slightly different from that of "/bin/ls" in that
19 the <path> denotes just a list of patterns to match, e.g. so
20 specifying directory name (without -r) will behave differently, and
21 order of the arguments does not matter.
22
23 · the behaviour is similar to that of "/bin/ls" in that the <path> is
24 taken as relative to the current working directory. E.g. when you
25 are in a directory sub that has a directory dir, you can run git
26 ls-tree -r HEAD dir to list the contents of the tree (that is
27 sub/dir in HEAD). You don’t want to give a tree that is not at the
28 root level (e.g. git ls-tree -r HEAD:sub dir) in this case, as
29 that would result in asking for sub/sub/dir in the HEAD commit.
30 However, the current working directory can be ignored by passing
31 --full-tree option.
32
34 <tree-ish>
35 Id of a tree-ish.
36
37 -d
38 Show only the named tree entry itself, not its children.
39
40 -r
41 Recurse into sub-trees.
42
43 -t
44 Show tree entries even when going to recurse them. Has no effect if
45 -r was not passed. -d implies -t.
46
47 -l, --long
48 Show object size of blob (file) entries.
49
50 -z
51 \0 line termination on output.
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 only a partial prefix. Non default number of digits can be
59 specified with --abbrev=<n>.
60
61 --full-name
62 Instead of showing the path names relative to the current working
63 directory, show the full path names.
64
65 --full-tree
66 Do not limit the listing to the current working directory. Implies
67 --full-name.
68
69 [<path>...]
70 When paths are given, show them (note that this isn’t really raw
71 pathnames, but rather a list of patterns to match). Otherwise
72 implicitly uses the root level of the tree as the sole path
73 argument.
74
76 <mode> SP <type> SP <object> TAB <file>
77
78 Unless the -z option is used, TAB, LF, and backslash characters in
79 pathnames are represented as \t, \n, and \\, respectively. This output
80 format is compatible with what --index-info --stdin of git update-index
81 expects.
82
83 When the -l option is used, format changes to
84
85 <mode> SP <type> SP <object> SP <object size> TAB <file>
86
87 Object size identified by <object> is given in bytes, and
88 right-justified with minimum width of 7 characters. Object size is
89 given only for blobs (file) entries; for other entries - character is
90 used in place of size.
91
93 Part of the git(1) suite
94
95
96
97Git 1.8.3.1 11/19/2018 GIT-LS-TREE(1)