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 [-a | --all] [-d | --describe] [--more=n] [--topics] [--current] [--independent] [--merge-base] [--no-name] [--sha1-name] [--stdin] [--list] [
PARAMETERS
-a, --all
Show all branches, even remote ones.
-d, --describe
Show the description associated with each branch.
--more=
Show
--topics
Show only topic branches. Topic branches are assumed to be any branch other than master, develop, next, or pu.
--current
Mark the current branch with an asterisk (*).
--independent
Show only branches that are not ancestors of any other listed branch.
--merge-base
Instead of showing the commit graph, output the merge base(s) of the given commits.
--no-name
Do not show branch names.
--sha1-name
Show branch names as SHA1 expressions.
--stdin
Read branch names from standard input.
--list
List only the names of the branches, without the graph information.
Limit the branches shown to only those reachable from the given commits. Can specify branch names, commit SHAs, or other commit references.
DESCRIPTION
The `git show-branch` command is a powerful tool for visualizing the relationships between different branches in a Git repository. It displays a list of branches and their commit history in a way that makes it easy to see which branches are ahead of or behind others, and where they diverge. It helps understand complex branch merges or rebases. The output shows which commits are unique to a branch and which commits are shared. This tool is useful for debugging merge conflicts, understanding the branching strategy, and keeping track of development progress. It's especially beneficial in collaborative environments where multiple developers are working on different features concurrently. It supports filtering of the branches shown and can highlight which commits are contained in which branches. By default, it shows all branches, but you can specify a subset of branches to focus on.
CAVEATS
The output can be overwhelming with a large number of branches. Consider using filtering options to narrow the scope.
INTERPRETING THE OUTPUT
The output consists of branch names followed by commits. A '*' indicates the current branch. '+' symbols in the commit graph indicate commits reachable from a branch, while '-' symbols indicate commits not reachable from a branch. The common commits shared between branches are marked with a space. The merge base is a key point to understand branch divergence.
EXAMPLES
Show all branches: git show-branch --all
Show only specific branches:git show-branch feature/branch1 feature/branch2
Show branches and their descriptions:git show-branch -d
Find merge base:git show-branch --merge-base branch1 branch2
SEE ALSO
git log(1), git branch(1), gitk(1)