git-show-unmerged-branches
Show branches that have unmerged changes
TLDR
Print all branches which are not merged into the current HEAD
SYNOPSIS
git branch [-r | -a] [--no-merged [<commit>]] [--sort=<key>] [--color[=<when>]] [--column[=<options>]]
PARAMETERS
--no-merged [<commit>]
Lists branches whose tips are not reachable from the specified <commit> (or HEAD if omitted) via a merge. These are branches that contain commits not yet integrated into the target.
-r
Lists remote-tracking branches instead of local ones.
-a
Lists both remote-tracking and local branches.
--sort=<key>
Sorts the output branches by the specified <key> (e.g., 'committerdate', 'refname').
--color[=<when>]
Enables colored output. <when> can be 'always', 'never', or 'auto'.
--column[=<options>]
Displays branches in columns. <options> can include 'always', 'never', 'auto', 'row', 'dense', 'clear', etc.
DESCRIPTION
git-show-unmerged-branches is not a standard Git command. The functionality implied by this name—identifying branches that have not yet been fully integrated into another branch—is natively provided by the git branch command using its --no-merged option.
When executed as git branch --no-merged (or git branch --no-merged <commit>), the command lists all branches whose tips are not reachable from the specified <commit> (or the current HEAD if no commit is specified) via merge commits. This effectively shows branches that contain unique work that has not yet been incorporated into the target branch. It is a crucial tool for developers to track ongoing feature work, identify stale branches, or clean up completed branches in a repository.
CAVEATS
git-show-unmerged-branches itself is not a standard Git command distributed with Git. Any command with this exact name is likely a custom script or an alias created by a user or distribution.
The behavior of git branch --no-merged depends on the current HEAD or the explicitly provided <commit>. It lists branches that have commits not yet merged into the target branch. A branch might appear in the list even if parts of it were merged, as long as its tip has unmerged commits relative to the target.
COMMON ALIASES/SCRIPTS
Many users create custom Git aliases or scripts named show-unmerged or similar to quickly access this functionality. For example, a common alias is git config alias.unmerged 'branch --no-merged'. More complex scripts might filter by age, author, or allow for interactive deletion.
USE CASES
Identifying branches that are ready for deletion, tracking long-running feature branches, finding branches that need to be rebased, and cleaning up local repositories are common uses for this command.
HISTORY
The core git branch command has been a fundamental part of Git since its inception. The --no-merged and --merged options were introduced early in Git's development to provide robust capabilities for managing and identifying the merge status of branches, greatly simplifying repository maintenance tasks.
SEE ALSO
git branch(1), git merge(1), git log(1)