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


I have an old branch, which I would like to delete. However, before doing so, I want to check that all commits made to this branch were at some point merged into some other branch. Thus, I'd like to see all commits made to my current branch which have not been applied to any other branch [or, if this is not possible without some scripting, how does one see all commits in one branch which have not been applied to another given branch?].


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

Can "git pull --all" update all my local branches?

Get changes from master into branch in Git