LinuxCommandLibrary

git-show-merged-branches

Show branches already merged into current branch

TLDR

Print all branches which are merged into the current head

$ git show-merged-branches
copy

SYNOPSIS

git show-merged-branches

PARAMETERS

-q, --quiet
    Suppresses the output of the merged branches; only prints the count.

DESCRIPTION

The `git-show-merged-branches` command displays a list of branches that have been fully merged into the current branch (usually `HEAD`). It helps identify branches that are no longer needed and can be safely deleted. This utility simplifies branch management by providing a concise overview of integration status. It uses `git branch --merged` command to find the branches which have been merged into `HEAD`.

CAVEATS

This command relies on accurate branch tracking and may not be reliable if the repository's reflog is incomplete or if there are manual merges that haven't been properly recorded.

IMPLEMENTATION NOTES

This command is typically implemented as a shell script or git alias. It often uses `git branch --merged` internally and then formats the output.

EXAMPLE USAGE

git show-merged-branches
Shows all branches merged into HEAD.

git show-merged-branches -q
Only prints the count of merged branches.

HISTORY

The `git-show-merged-branches` command appears to be a convenience script or alias commonly used to streamline the process of identifying merged branches, rather than a core git command. Its development likely arose from the need for developers to easily clean up their repositories after feature branches have been integrated.

SEE ALSO

git branch(1), git merge(1), git branch --merged(1)

Copied to clipboard