Identify merged branches
Rationale
You might want to delete a branch (e.g. a feature branch).
Before you do that, you might want to check whether that branch is fully merged.
In others, you should know which branches are fully included in the current branch.
Command
git branch --mergedshow the branches merged with the current branch.git branch --no-mergedsimilar, but show the NOT mergedBoth can be used with the
-rto include the remote tracking branch.
Notes
From officials, merged branches means
Branches whose tips are reachable from the specified commit (
HEADif not specified).If you traverse backwards from the commit specified (default:
HEAD), do you see the tip (end) of those commits?If so, then it's merged.
You can provide the commit to travers from.
git branch --merged <name>git branch --merged origin/<name>
Last updated