Search code examples
gitbranch

How to list all unmerged changes in Git?


Creating a branch for various topics, and not regularly deleting them when I don't need them any more, I have now ended up with about 50 branches.

I tried deleting branches but some of them have unmerged changes.

What I want is the ability to see exactly what changes are there in any branch on my repo that are not in master. Is there a way to do that?


Solution

  • To list branches with commits not merged into master:

    git branch --no-merged master
    

    To include remote branches:

    git branch -a --no-merged master
    

    To list the relevant commits:

    git cherry -v master <branch>