Documentation / git-ls-tree.txton commit gitweb: link to patch(es) view in commit(diff) and (short)log view (75bf2cb)
   1git-ls-tree(1)
   2==============
   3
   4NAME
   5----
   6git-ls-tree - List the contents of a tree object
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git ls-tree' [-d] [-r] [-t] [-l] [-z]
  13            [--name-only] [--name-status] [--full-name] [--abbrev=[<n>]]
  14            <tree-ish> [paths...]
  15
  16DESCRIPTION
  17-----------
  18Lists the contents of a given tree object, like what "/bin/ls -a" does
  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.
  33
  34OPTIONS
  35-------
  36<tree-ish>::
  37        Id of a tree-ish.
  38
  39-d::
  40        Show only the named tree entry itself, not its children.
  41
  42-r::
  43        Recurse into sub-trees.
  44
  45-t::
  46        Show tree entries even when going to recurse them. Has no effect
  47        if '-r' was not passed. '-d' implies '-t'.
  48
  49-l::
  50--long::
  51        Show object size of blob (file) entries.
  52
  53-z::
  54        \0 line termination on output.
  55
  56--name-only::
  57--name-status::
  58        List only filenames (instead of the "long" output), one per line.
  59
  60--abbrev[=<n>]::
  61        Instead of showing the full 40-byte hexadecimal object
  62        lines, show only handful hexdigits prefix.
  63        Non default number of digits can be specified with --abbrev=<n>.
  64
  65--full-name::
  66        Instead of showing the path names relative to the current working
  67        directory, show the full path names.
  68
  69paths::
  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 argument.
  73
  74
  75Output Format
  76-------------
  77        <mode> SP <type> SP <object> TAB <file>
  78
  79When the `-z` option is not used, TAB, LF, and backslash characters
  80in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
  81
  82When the `-l` option is used, format changes to
  83
  84        <mode> SP <type> SP <object> SP <object size> TAB <file>
  85
  86Object size identified by <object> is given in bytes, and right-justified
  87with minimum width of 7 characters.  Object size is given only for blobs
  88(file) entries; for other entries `-` character is used in place of size.
  89
  90
  91Author
  92------
  93Written by Petr Baudis <pasky@suse.cz>
  94Completely rewritten from scratch by Junio C Hamano <gitster@pobox.com>,
  95another major rewrite by Linus Torvalds <torvalds@osdl.org>
  96
  97Documentation
  98--------------
  99Documentation by David Greaves, Junio C Hamano and the git-list
 100<git@vger.kernel.org>.
 101
 102GIT
 103---
 104Part of the linkgit:git[1] suite