Using Git, show all commits that are in one branch, but not the other(s)

To see a list of which commits are on one branch but not another, use git log:

git log --no-merges oldbranch ^newbranch

…that is, show commit logs for all commits on oldbranch that are not on newbranch. You can list multiple branches to include and exclude, e.g.

git log  --no-merges oldbranch1 oldbranch2 ^newbranch1 ^newbranch2

Note: on Windows command prompt (not Powershell) ^ is an escape key, so it needs to be escaped with another ^:

git log --no-merges oldbranch ^^newbranch

Leave a Comment