git-show-tree
Display git tree objects
TLDR
Show a decorated tree graph for all branches annotated with tags and branch names
SYNOPSIS
git-show-tree [options] <tree-ish>
PARAMETERS
<tree-ish>
The object to inspect. This can be a tree object's hash, or a commit or tag object that ultimately resolves to a tree. It specifies which tree's contents should be displayed.
-d
Only show tree entries (subdirectories) and do not show blob entries (files). This helps in focusing on the directory structure itself.
-r
Recursively list the contents of sub-trees. This option allows for a deep listing of all files and directories nested within the specified tree-ish.
--name-only
Show only the names of the entries, one per line. This omits mode, type, and object hash for a more concise output, useful for scripting.
--full-name
When used with -r, show the full path of the entries from the root of the repository, rather than just their base names within their respective sub-directories.
-t
Show the type of object ('blob', 'tree', or 'commit') alongside its mode and name, providing more context about each entry.
-l
Show the size of blob entries in bytes. This option is useful for understanding the disk space consumed by files within the tree, especially for large repositories.
-z
Terminate entries with a NUL character instead of a newline. This is highly beneficial for scripting, particularly when handling paths that may contain unusual characters (like spaces or newlines), by allowing unambiguous parsing.
DESCRIPTION
The git-show-tree command was an early, low-level Git plumbing command used to inspect the contents of a Git tree object. A tree object in Git represents a directory's state at a specific point in time, containing references to other tree objects (subdirectories) and blob objects (files).
Historically, git-show-tree served a purpose similar to the ls command in a filesystem, listing the entries within a given tree object. This included displaying their mode (permissions), type (blob, tree, or commit), Git object SHA-1 hash, and name. However, for consistency with other Git commands, particularly git ls-files, this command was officially renamed to git ls-tree.
In modern Git versions, git-show-tree is no longer a directly callable command and will typically result in an error or 'command not found'. Its functionality has been fully superseded by git ls-tree, which provides identical and enhanced capabilities, serving as the standard method for listing tree contents.
CAVEATS
git-show-tree is a deprecated and internal Git command. It is not available for direct use in modern Git distributions, having been fully replaced by git ls-tree. Attempting to run git-show-tree directly on a current Git installation will almost certainly result in a 'command not found' or similar error. Users interested in listing tree contents should always use git ls-tree.
PLUMBING COMMAND
git-show-tree (and its modern successor git ls-tree) is categorized as a 'plumbing' command within Git. Plumbing commands are low-level operations that directly interact with Git's internal data structures, such as tree objects, blob objects, and commit objects. They are primarily designed for scripting, automation, or advanced debugging purposes, offering granular control over the repository's components. This stands in contrast to 'porcelain' commands (e.g., git commit, git status), which are high-level, user-friendly commands built upon these underlying plumbing functionalities for everyday repository management.
HISTORY
The git-show-tree command was one of the earliest plumbing commands in Git, a foundational tool for inspecting the repository's object database. It was an integral part of Git from its inception, developed by Linus Torvalds himself. The renaming to git ls-tree occurred to standardize Git's command-line interface, aligning its nomenclature with other list-related commands like git ls-files and making it more intuitive for users familiar with Unix-like ls utilities. Despite the change in name, its core functionality of listing tree contents remains a vital component of Git's plumbing layer.
SEE ALSO
git ls-tree(1), git cat-file(1), git rev-parse(1)