git show-branch

Inspection & Comparison

Show branches and which commits each one contains


The 'git show-branch' command lines branches up side by side: one column per branch, one row per commit, down to the commit they all share. In each column, * marks commits on the current branch, + commits on another branch and - merge commits. A compact text alternative to git log --graph for comparing a few branches.

Synopsis

git show-branch [<options>] [<rev>...]
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

All local branches

git show-branch

Every branch in a column.


Two branches

git show-branch main feature/login

Compare just these two.

Workflow Examples

1
git show-branch main feature/login

Commits unique to each side

2
git merge feature/login

Merge when ready

Troubleshooting

The output is very long

Cause: Branches share little history

Compare fewer branches, or use git log --oneline main..feature

Tips & Pitfalls

Best Practices

  • ✓Name the two or three branches you care about.

Common Mistakes

  • ✗Running it with many branches: the table gets too wide to read — name the branches you want.

FAQ

A:

* current branch contains the commit, + another branch contains it, - it is a merge commit.