2005-05-10 21:32:30 +00:00
|
|
|
git-ls-tree(1)
|
|
|
|
==============
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2007-01-18 23:53:37 +00:00
|
|
|
git-ls-tree - List the contents of a tree object
|
2005-05-10 21:32:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2006-06-07 19:46:55 +00:00
|
|
|
[verse]
|
2008-06-30 06:09:04 +00:00
|
|
|
'git ls-tree' [-d] [-r] [-t] [-l] [-z]
|
2010-10-08 17:31:15 +00:00
|
|
|
[--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
|
|
|
|
<tree-ish> [<path>...]
|
2005-05-10 21:32:30 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2005-12-04 23:31:08 +00:00
|
|
|
Lists the contents of a given tree object, like what "/bin/ls -a" does
|
2008-07-28 09:33:33 +00:00
|
|
|
in the current working directory. Note that:
|
|
|
|
|
|
|
|
- the behaviour is slightly different from that of "/bin/ls" in that the
|
2010-10-08 17:31:15 +00:00
|
|
|
'<path>' denotes just a list of patterns to match, e.g. so specifying
|
2016-06-28 11:40:10 +00:00
|
|
|
directory name (without `-r`) will behave differently, and order of the
|
2008-07-28 09:33:33 +00:00
|
|
|
arguments does not matter.
|
|
|
|
|
2010-10-08 17:31:15 +00:00
|
|
|
- the behaviour is similar to that of "/bin/ls" in that the '<path>' is
|
2008-07-28 09:33:33 +00:00
|
|
|
taken as relative to the current working directory. E.g. when you are
|
|
|
|
in a directory 'sub' that has a directory 'dir', you can run 'git
|
|
|
|
ls-tree -r HEAD dir' to list the contents of the tree (that is
|
2019-03-06 13:04:46 +00:00
|
|
|
`sub/dir` in `HEAD`). You don't want to give a tree that is not at the
|
2010-01-07 16:49:12 +00:00
|
|
|
root level (e.g. `git ls-tree -r HEAD:sub dir`) in this case, as that
|
2019-03-06 13:04:46 +00:00
|
|
|
would result in asking for `sub/sub/dir` in the `HEAD` commit.
|
2008-12-31 10:00:50 +00:00
|
|
|
However, the current working directory can be ignored by passing
|
|
|
|
--full-tree option.
|
2005-05-10 21:32:30 +00:00
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
<tree-ish>::
|
2005-08-05 15:05:02 +00:00
|
|
|
Id of a tree-ish.
|
2005-05-10 21:32:30 +00:00
|
|
|
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 07:05:38 +00:00
|
|
|
-d::
|
2005-12-04 23:31:08 +00:00
|
|
|
Show only the named tree entry itself, not its children.
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 07:05:38 +00:00
|
|
|
|
2005-05-10 21:32:30 +00:00
|
|
|
-r::
|
2005-12-04 23:31:08 +00:00
|
|
|
Recurse into sub-trees.
|
|
|
|
|
|
|
|
-t::
|
|
|
|
Show tree entries even when going to recurse them. Has no effect
|
2016-06-28 11:40:10 +00:00
|
|
|
if `-r` was not passed. `-d` implies `-t`.
|
2005-05-10 21:32:30 +00:00
|
|
|
|
2007-05-19 20:08:11 +00:00
|
|
|
-l::
|
|
|
|
--long::
|
|
|
|
Show object size of blob (file) entries.
|
|
|
|
|
2005-05-10 21:32:30 +00:00
|
|
|
-z::
|
2017-03-02 19:03:52 +00:00
|
|
|
\0 line termination on output and do not quote filenames.
|
|
|
|
See OUTPUT FORMAT below for more information.
|
2005-12-04 23:31:08 +00:00
|
|
|
|
|
|
|
--name-only::
|
|
|
|
--name-status::
|
|
|
|
List only filenames (instead of the "long" output), one per line.
|
2005-05-10 21:32:30 +00:00
|
|
|
|
2006-03-07 13:52:02 +00:00
|
|
|
--abbrev[=<n>]::
|
|
|
|
Instead of showing the full 40-byte hexadecimal object
|
2009-01-12 20:02:07 +00:00
|
|
|
lines, show only a partial prefix.
|
2006-03-07 13:52:02 +00:00
|
|
|
Non default number of digits can be specified with --abbrev=<n>.
|
|
|
|
|
2006-06-07 19:46:55 +00:00
|
|
|
--full-name::
|
2006-06-07 23:29:36 +00:00
|
|
|
Instead of showing the path names relative to the current working
|
2006-06-07 19:46:55 +00:00
|
|
|
directory, show the full path names.
|
|
|
|
|
2008-12-31 10:00:50 +00:00
|
|
|
--full-tree::
|
|
|
|
Do not limit the listing to the current working directory.
|
|
|
|
Implies --full-name.
|
|
|
|
|
2010-10-08 17:31:15 +00:00
|
|
|
[<path>...]::
|
2005-12-04 23:31:08 +00:00
|
|
|
When paths are given, show them (note that this isn't really raw
|
|
|
|
pathnames, but rather a list of patterns to match). Otherwise
|
|
|
|
implicitly uses the root level of the tree as the sole path argument.
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 07:05:38 +00:00
|
|
|
|
2005-05-26 17:52:50 +00:00
|
|
|
|
2005-05-10 21:32:30 +00:00
|
|
|
Output Format
|
|
|
|
-------------
|
[PATCH] Rewrite ls-tree to behave more like "/bin/ls -a"
This is a complete rewrite of ls-tree to make it behave more
like what "/bin/ls -a" does in the current working directory.
Namely, the changes are:
- Unlike the old ls-tree behaviour that used paths arguments to
restrict output (not that it worked as intended---as pointed
out in the mailing list discussion, it was quite incoherent),
this rewrite uses paths arguments to specify what to show.
- Without arguments, it implicitly uses the root level as its
sole argument ("/bin/ls -a" behaves as if "." is given
without argument).
- Without -r (recursive) flag, it shows the named blob (either
file or symlink), or the named tree and its immediate
children.
- With -r flag, it shows the named path, and recursively
descends into it if it is a tree.
- With -d flag, it shows the named path and does not show its
children even if the path is a tree, nor descends into it
recursively.
This is still request-for-comments patch. There is no mailing
list consensus that this proposed new behaviour is a good one.
The patch to t/t3100-ls-tree-restrict.sh illustrates
user-visible behaviour changes. Namely:
* "git-ls-tree $tree path1 path0" lists path1 first and then
path0. It used to use paths as an output restrictor and
showed output in cache entry order (i.e. path0 first and then
path1) regardless of the order of paths arguments.
* "git-ls-tree $tree path2" lists path2 and its immediate
children but having explicit paths argument does not imply
recursive behaviour anymore, hence paths/baz is shown but not
paths/baz/b.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-28 07:05:38 +00:00
|
|
|
<mode> SP <type> SP <object> TAB <file>
|
2005-05-10 21:32:30 +00:00
|
|
|
|
2010-01-07 16:49:12 +00:00
|
|
|
This output format is compatible with what `--index-info --stdin` of
|
2009-05-10 16:14:49 +00:00
|
|
|
'git update-index' expects.
|
2005-10-15 04:56:46 +00:00
|
|
|
|
2007-05-19 20:08:11 +00:00
|
|
|
When the `-l` option is used, format changes to
|
|
|
|
|
|
|
|
<mode> SP <type> SP <object> SP <object size> TAB <file>
|
|
|
|
|
|
|
|
Object size identified by <object> is given in bytes, and right-justified
|
|
|
|
with minimum width of 7 characters. Object size is given only for blobs
|
|
|
|
(file) entries; for other entries `-` character is used in place of size.
|
|
|
|
|
2017-03-02 19:03:52 +00:00
|
|
|
Without the `-z` option, pathnames with "unusual" characters are
|
|
|
|
quoted as explained for the configuration variable `core.quotePath`
|
|
|
|
(see linkgit:git-config[1]). Using `-z` the filename is output
|
|
|
|
verbatim and the line is terminated by a NUL byte.
|
|
|
|
|
2005-05-10 21:32:30 +00:00
|
|
|
GIT
|
|
|
|
---
|
2008-06-06 07:07:32 +00:00
|
|
|
Part of the linkgit:git[1] suite
|