git - find not merged branches

Branches that were not merged with master:

git branch -a --no-merged  (or git branch -a --no-merged  master)

Branches that were merged with feature:

git branch -a --merged feature

Branches that were merged not with feature:

git branch -a --no-merged feature

Reference

The git-branch(1) command:

  • with --contains flag shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit).
  • with --merged shows only branches merged into the named commit (i.e. the branches whose tip commits are reachable from the named commit) will be listed.
  • with --no-merged shows only branches not merged into the named commit will be listed
  • if the argument is missing, it defaults to HEAD (i.e. the tip of the current branch).
profile for Boris Serebrov on Stack Exchange, a network of free, community-driven Q&A sites