git-show-branch - Linux


The git-show-branch command displays local branch information and their relationship to remote branches. It visualizes the history of commits made on a branch, allowing for easy identification of the common ancestor between two branches.


git show-branch [options] [--help] [--version]


  • --all: Display all branches (default).
  • --current: Show only the current branch.
  • --remote: Display only remote branches.
  • --merge: Display merge commits (with the --graphs option).
  • --topo-order: Display branches in topological order (with the --graphs option).
  • --abbrev: Use abbreviated commit hashes.
  • --points-at: Specify a commit to display branches pointing at it.
  • --no-name: Do not display branch names.
  • --reflog: Include reflog entries in the output.
  • --not-contains: Show branches that do not contain the specified commit.
  • --contains: Show branches that contain the specified commit.
  • --color: Colorize the output (auto-detected by default).
  • --no-color: Disable colorization of the output.


  • Display all branches: git show-branch
  • Display only the current branch: git show-branch --current
  • Display remote branches: git show-branch --remote
  • Display merge commits in a graphical format: git show-branch --merge --graphs
  • Display branches in topological order: git show-branch --topo-order --graphs

Common Issues

  • Command not found: Ensure the git package is installed and added to the path.
  • No branches found: Verify the presence of any local or remote branches in the current repository.


git-show-branch can be used in conjunction with other commands for advanced tasks:

  • git branch --merged origin to list local branches that have been merged into a remote branch.
  • git cherry-pick $(git show-branch --contains COMMIT_HASH) to cherry-pick commits from a specific branch.

Related Commands

  • git branch
  • git merge
  • git cherry-pick