231 lines
5.0 KiB
HTML
231 lines
5.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GIT-LS-TREE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GIT-LS-TREE</H1>
|
|
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
git-ls-tree - List the contents of a tree object
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<PRE>
|
|
<I>git ls-tree</I> [-d] [-r] [-t] [-l] [-z]
|
|
[--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]
|
|
<tree-ish> [<path>...]
|
|
</PRE>
|
|
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
Lists the contents of a given tree object, like what "/bin/ls -a" does in the current working directory. Note that:
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
•
|
|
|
|
|
|
the behaviour is slightly different from that of "/bin/ls" in that the
|
|
<I><path></I>
|
|
denotes just a list of patterns to match, e.g. so specifying directory name (without
|
|
<B>-r</B>) will behave differently, and order of the arguments does not matter.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
•
|
|
|
|
|
|
the behaviour is similar to that of "/bin/ls" in that the
|
|
<I><path></I>
|
|
is taken as relative to the current working directory. E.g. when you are in a directory
|
|
<I>sub</I>
|
|
that has a directory
|
|
<I>dir</I>, you can run
|
|
<I>git ls-tree -r HEAD dir</I>
|
|
to list the contents of the tree (that is
|
|
<B>sub/dir</B>
|
|
in
|
|
<B>HEAD</B>). You don't want to give a tree that is not at the root level (e.g.
|
|
<B>git ls-tree -r HEAD:sub dir</B>) in this case, as that would result in asking for
|
|
<B>sub/sub/dir</B>
|
|
in the
|
|
<B>HEAD</B>
|
|
commit. However, the current working directory can be ignored by passing --full-tree option.
|
|
</DL>
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<P>
|
|
|
|
<tree-ish>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
Id of a tree-ish.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
-d
|
|
<DL COMPACT><DT id="4"><DD>
|
|
Show only the named tree entry itself, not its children.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
-r
|
|
<DL COMPACT><DT id="5"><DD>
|
|
Recurse into sub-trees.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
-t
|
|
<DL COMPACT><DT id="6"><DD>
|
|
Show tree entries even when going to recurse them. Has no effect if
|
|
<B>-r</B>
|
|
was not passed.
|
|
<B>-d</B>
|
|
implies
|
|
<B>-t</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
-l, --long
|
|
<DL COMPACT><DT id="7"><DD>
|
|
Show object size of blob (file) entries.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
-z
|
|
<DL COMPACT><DT id="8"><DD>
|
|
\0 line termination on output and do not quote filenames. See OUTPUT FORMAT below for more information.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
--name-only, --name-status
|
|
<DL COMPACT><DT id="9"><DD>
|
|
List only filenames (instead of the "long" output), one per line.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
--abbrev[=<n>]
|
|
<DL COMPACT><DT id="10"><DD>
|
|
Instead of showing the full 40-byte hexadecimal object lines, show only a partial prefix. Non default number of digits can be specified with --abbrev=<n>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
--full-name
|
|
<DL COMPACT><DT id="11"><DD>
|
|
Instead of showing the path names relative to the current working directory, show the full path names.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
--full-tree
|
|
<DL COMPACT><DT id="12"><DD>
|
|
Do not limit the listing to the current working directory. Implies --full-name.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
[<path>...]
|
|
<DL COMPACT><DT id="13"><DD>
|
|
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.
|
|
</DL>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>OUTPUT FORMAT</H2>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
<mode> SP <type> SP <object> TAB <file>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
This output format is compatible with what <B>--index-info --stdin</B> of <I>git update-index</I> expects.
|
|
<P>
|
|
When the <B>-l</B> option is used, format changes to
|
|
<P>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
<mode> SP <type> SP <object> SP <object size> TAB <file>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
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 <B>-</B> character is used in place of size.
|
|
<P>
|
|
Without the <B>-z</B> option, pathnames with "unusual" characters are quoted as explained for the configuration variable <B>core.quotePath</B> (see <B><A HREF="/cgi-bin/man/man2html?1+git-config">git-config</A></B>(1)). Using <B>-z</B> the filename is output verbatim and the line is terminated by a NUL byte.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>GIT</H2>
|
|
|
|
<P>
|
|
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="16"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="19"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="20"><A HREF="#lbAF">OUTPUT FORMAT</A><DD>
|
|
<DT id="21"><A HREF="#lbAG">GIT</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:14 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|