git: find not merged branches
To find branches that were not merged with master, use the --no-merged flag:
# or git branch -a --no-merged master
git branch -a --no-merged
Branches that were merged with feature:
git branch -a --merged feature
Branches that were not merged with feature:
git branch -a --no-merged feature
Reference
The git-branch(1) command:
- with the
--containsflag shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit). - with
--mergedshows only branches merged into the named commit (i.e. the branches whose tip commits are reachable from the named commit). - with
--no-mergedshows only branches not merged into the named commit. - if the
<commit>argument is missing, it defaults to HEAD (i.e. the tip of the current branch).