blob: 16e87fd6dd548d462715d394df0586bd9cb5d3ec [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-ls-tree(1)
2==============
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-ls-tree - List the contents of a tree object
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano33db4372006-06-07 19:51:4511[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git ls-tree' [-d] [-r] [-t] [-l] [-z]
Junio C Hamanod2179ef2010-10-22 04:12:1713 [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
14 <tree-ish> [<path>...]
Junio C Hamano1a4e8412005-12-27 08:17:2315
16DESCRIPTION
17-----------
18Lists the contents of a given tree object, like what "/bin/ls -a" does
Junio C Hamano90ccff32008-07-29 08:17:2419in the current working directory. Note that:
20
21 - the behaviour is slightly different from that of "/bin/ls" in that the
Junio C Hamanod2179ef2010-10-22 04:12:1722 '<path>' denotes just a list of patterns to match, e.g. so specifying
Junio C Hamano90ccff32008-07-29 08:17:2423 directory name (without '-r') will behave differently, and order of the
24 arguments does not matter.
25
Junio C Hamanod2179ef2010-10-22 04:12:1726 - the behaviour is similar to that of "/bin/ls" in that the '<path>' is
Junio C Hamano90ccff32008-07-29 08:17:2427 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
Junio C Hamano1aa40d22010-01-21 17:46:4331 root level (e.g. `git ls-tree -r HEAD:sub dir`) in this case, as that
Junio C Hamano90ccff32008-07-29 08:17:2432 would result in asking for 'sub/sub/dir' in the 'HEAD' commit.
Junio C Hamanoa3148f52009-01-14 08:49:5733 However, the current working directory can be ignored by passing
34 --full-tree option.
Junio C Hamano1a4e8412005-12-27 08:17:2335
36OPTIONS
37-------
38<tree-ish>::
39Id of a tree-ish.
40
41-d::
42Show only the named tree entry itself, not its children.
43
44-r::
45Recurse into sub-trees.
46
47-t::
48Show tree entries even when going to recurse them. Has no effect
49if '-r' was not passed. '-d' implies '-t'.
50
Junio C Hamano7fd84172007-05-24 07:00:3251-l::
52--long::
53Show object size of blob (file) entries.
54
Junio C Hamano1a4e8412005-12-27 08:17:2355-z::
56\0 line termination on output.
57
58--name-only::
59--name-status::
60List only filenames (instead of the "long" output), one per line.
61
Junio C Hamano5c3957e2006-03-28 00:28:0162--abbrev[=<n>]::
63Instead of showing the full 40-byte hexadecimal object
Junio C Hamano6efe3022009-01-13 16:47:5664lines, show only a partial prefix.
Junio C Hamano5c3957e2006-03-28 00:28:0165Non default number of digits can be specified with --abbrev=<n>.
66
Junio C Hamano33db4372006-06-07 19:51:4567--full-name::
Junio C Hamanof1d14802006-06-08 00:48:1768Instead of showing the path names relative to the current working
Junio C Hamano33db4372006-06-07 19:51:4569directory, show the full path names.
70
Junio C Hamanoa3148f52009-01-14 08:49:5771--full-tree::
72Do not limit the listing to the current working directory.
73Implies --full-name.
74
Junio C Hamanod2179ef2010-10-22 04:12:1775[<path>...]::
Junio C Hamano1a4e8412005-12-27 08:17:2376When 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.
79
80
81Output Format
82-------------
83 <mode> SP <type> SP <object> TAB <file>
84
Junio C Hamanod4f35a92009-05-17 05:39:2985Unless the `-z` option is used, TAB, LF, and backslash characters
Junio C Hamano1a4e8412005-12-27 08:17:2386in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
Junio C Hamano1aa40d22010-01-21 17:46:4387This output format is compatible with what `--index-info --stdin` of
Junio C Hamanod4f35a92009-05-17 05:39:2988'git update-index' expects.
Junio C Hamano1a4e8412005-12-27 08:17:2389
Junio C Hamano7fd84172007-05-24 07:00:3290When 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
Junio C Hamano1a4e8412005-12-27 08:17:2398GIT
99---
Junio C Hamanof7c042d2008-06-06 22:50:53100Part of the linkgit:git[1] suite