LinuxCommandLibrary

git-show-tree

Display git tree objects

TLDR

Show a decorated tree graph for all branches annotated with tags and branch names

$ git show-tree
copy

SYNOPSIS

git-show-tree [options] [ref]

PARAMETERS

-h, --help
    Show help message and exit

--pager
    Pipe output through pager like less

ref
    Commit-ish object (default: HEAD)

DESCRIPTION

git-show-tree is a command from the git-extras toolkit that renders a visual, ASCII-art tree diagram of a Git repository's directory structure at a specific commit. It provides an intuitive overview of files and folders, similar to the Unix tree command but tailored for Git tree objects.

By default, it displays the tree for HEAD. Specify a commit reference (e.g., branch, tag, or hash) as an argument to view any point in history. The output shows directories with expandable-like nesting using lines and branches, listing files with their paths. This is ideal for quickly inspecting repo layout without cloning or browsing GUIs.

Unlike git ls-tree, which outputs flat listings, git-show-tree emphasizes hierarchy for better readability. For large repos, use --pager to scroll comfortably. It's lightweight, recursive, and excludes Git internals like .git unless specified.

CAVEATS

Not a core Git command; requires git-extras installed. Output uses fixed-width font for alignment; may truncate deep/long paths.

INSTALLATION

Debian/Ubuntu: sudo apt install git-extras
macOS: brew install git-extras
Fedora: sudo dnf install git-extras

EXAMPLE

git show-tree (current tree)
git show-tree main~1 (previous commit)

HISTORY

Part of git-extras project by Oscar Bartra, started 2012 on GitHub. Enhanced over time for better visuals and compatibility.

SEE ALSO

git ls-tree(1), tree(1), git ls-files(1), git log --graph(1)

Copied to clipboard