How to list all unmerged changes in Git?
Solution 1:
To list branches with commits not merged into master:
git branch --no-merged master
To list the relevant commits:
git cherry -v master <branch>
Solution 2:
I came across this question when I was trying to remember the syntax of...
git log <branch> --not master --stat
This will show commits to <branch> that have not been merged to master. The --stat will include the files that were changed with the commits. You can also use this to compare any two branches by replacing master with a different branch name.
Solution 3:
This question is already well answered, but there is one more answer I think is worth documenting:
List all commits on any branch not already merged with master:
git log --all --not master
or, equivalently:
git log --all ^master
The --all
picks up all branches, so you don't have to list them, then --not master
or ^master
remove master from the selection.