]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-ls-tree.txt
git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8
[thirdparty/git.git] / Documentation / git-ls-tree.txt
CommitLineData
2cf565c5
DG
1git-ls-tree(1)
2==============
2cf565c5
DG
3
4NAME
5----
c3f0baac 6git-ls-tree - List the contents of a tree object
2cf565c5
DG
7
8
9SYNOPSIS
10--------
fd7e9fb7 11[verse]
b1889c36 12'git ls-tree' [-d] [-r] [-t] [-l] [-z]
e1a59774 13 [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev=[<n>]]
fd7e9fb7 14 <tree-ish> [paths...]
2cf565c5
DG
15
16DESCRIPTION
17-----------
7b9b4c45 18Lists the contents of a given tree object, like what "/bin/ls -a" does
7ddea13a
JH
19in the current working directory. Note that:
20
21 - the behaviour is slightly different from that of "/bin/ls" in that the
22 'paths' denote just a list of patterns to match, e.g. so specifying
23 directory name (without '-r') will behave differently, and order of the
24 arguments does not matter.
25
26 - the behaviour is similar to that of "/bin/ls" in that the 'paths' is
27 taken as relative to the current working directory. E.g. when you are
28 in a directory 'sub' that has a directory 'dir', you can run 'git
29 ls-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
31 root level (e.g. 'git ls-tree -r HEAD:sub dir') in this case, as that
32 would result in asking for 'sub/sub/dir' in the 'HEAD' commit.
e1a59774
NS
33 However, the current working directory can be ignored by passing
34 --full-tree option.
2cf565c5
DG
35
36OPTIONS
37-------
38<tree-ish>::
2c6e4771 39 Id of a tree-ish.
2cf565c5 40
6af1f019 41-d::
7b9b4c45 42 Show only the named tree entry itself, not its children.
6af1f019 43
2cf565c5 44-r::
7b9b4c45
PB
45 Recurse into sub-trees.
46
47-t::
48 Show tree entries even when going to recurse them. Has no effect
49 if '-r' was not passed. '-d' implies '-t'.
2cf565c5 50
a5bbda8b
JN
51-l::
52--long::
53 Show object size of blob (file) entries.
54
2cf565c5 55-z::
7b9b4c45
PB
56 \0 line termination on output.
57
58--name-only::
59--name-status::
60 List only filenames (instead of the "long" output), one per line.
2cf565c5 61
cb85bfe5
EW
62--abbrev[=<n>]::
63 Instead of showing the full 40-byte hexadecimal object
323b9db8 64 lines, show only a partial prefix.
cb85bfe5
EW
65 Non default number of digits can be specified with --abbrev=<n>.
66
fd7e9fb7 67--full-name::
42698220 68 Instead of showing the path names relative to the current working
fd7e9fb7
JF
69 directory, show the full path names.
70
e1a59774
NS
71--full-tree::
72 Do not limit the listing to the current working directory.
73 Implies --full-name.
74
6d3a5077 75paths::
7b9b4c45
PB
76 When paths are given, show them (note that this isn't really raw
77 pathnames, but rather a list of patterns to match). Otherwise
78 implicitly uses the root level of the tree as the sole path argument.
6af1f019 79
6d3a5077 80
2cf565c5
DG
81Output Format
82-------------
6af1f019 83 <mode> SP <type> SP <object> TAB <file>
2cf565c5 84
713697b3 85Unless the `-z` option is used, TAB, LF, and backslash characters
7b9b4c45 86in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
c98a95ee
AR
87This output format is compatible with what '--index-info --stdin' of
88'git update-index' expects.
d88156e9 89
a5bbda8b
JN
90When the `-l` option is used, format changes to
91
92 <mode> SP <type> SP <object> SP <object size> TAB <file>
93
94Object 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.
97
2cf565c5
DG
98
99Author
100------
7b9b4c45 101Written by Petr Baudis <pasky@suse.cz>
59eb68aa 102Completely rewritten from scratch by Junio C Hamano <gitster@pobox.com>,
7b9b4c45 103another major rewrite by Linus Torvalds <torvalds@osdl.org>
2cf565c5
DG
104
105Documentation
106--------------
7b9b4c45
PB
107Documentation by David Greaves, Junio C Hamano and the git-list
108<git@vger.kernel.org>.
109
2cf565c5
DG
110GIT
111---
9e1f0a85 112Part of the linkgit:git[1] suite