git-show-branch
Visualize branch relationships and commit history
TLDR
Show a summary of the latest commit on a branch
Compare commits in the history of multiple commits or branches
Compare all remote tracking branches
Compare both local and remote tracking branches
List the latest commits in all branches
Compare a given branch with the current branch
Display the commit name instead of the relative name
Keep going a given number of commits past the common ancestor
SYNOPSIS
git show-branch [options] [<rev> ...]
PARAMETERS
-a, --all
Show both remote-tracking and local branches.
-r, --remotes
Show only remote-tracking branches.
--topo-order
Sort commits by topological order (default).
--date-order
Sort commits by date.
--current
Include the current branch.
--sparse
Omit merged/similar branches from output.
--more=<n>
Extend output by <n> more commits.
--list
List branches without commit details.
--independent
Show only commits unique to each branch.
--merge-base
Show merge bases instead of branch tips.
--no-name
Suppress branch names in output.
--sha1-name
Use full SHA-1 instead of short names.
-t, --topics[=<regex>]
Show only commits with subjects matching regex.
--reflog[=<n>[,<n>]]
Show recent reflog entries.
--subject
Use commit subjects (default).
--body
Use full commit message body.
--oneline
Show abbreviated output.
--color[=<when>]
Enable colored output (auto, always, never).
--no-color
Disable colored output.
--color-whitespace
Highlight whitespace errors.
DESCRIPTION
The git show-branch command provides a compact, text-based graphical representation of the commit history across multiple branches. It displays branches as vertical columns and commits as points along a timeline, using ASCII characters to denote branch heads (!), merges (+), and common ancestors. This visualization helps developers quickly identify branch divergences, merges, and the relative positioning of commits without needing graphical tools.
By default, it shows the first few commits where branches differ, but options like --more allow deeper inspection. It's particularly useful for analyzing complex branch topologies, such as feature branches merged into mainlines, or tracking remote vs. local branch states. Compared to git log --graph, it offers a tabular multi-branch view but is less flexible for customization.
Output includes branch names at the top, commit SHAs or subjects below, and markers indicating unique commits per branch. It's efficient for terminal use and scripting, though modern alternatives like git log with --graph have largely superseded it for everyday workflows.
CAVEATS
Limited scalability with many branches; output can become cluttered. Largely replaced by git log --graph --oneline for modern use. Does not support decoration or ref tips like newer graph views.
OUTPUT LEGEND
! = branch head
+ = merge point
* = common ancestor
Columns represent branches left-to-right.
EXAMPLE USAGE
git show-branch --all - shows all branches.
git show-branch main feature - compares two branches.
HISTORY
Introduced in early Git (v1.0.13, 2005) by Linus Torvalds as one of the original visualization tools. Designed for quick terminal-based branch analysis before graphical tools proliferated. Evolved minimally; remains stable but sees low active development.
SEE ALSO
git-log(1), git-branch(1), git-rev-list(1), gitk(1)


