How do I see the commit differences between branches in git?

Avery picture Avery · Dec 20, 2012 · Viewed 207.6k times · Source

I'm on branch-X and have added a couple more commits on top of it. I want to see all the differences between MASTER and the branch that I am on in terms of commits. I could just do a

git checkout master
git log

and then a

git checkout branch-X
git log

and visually diff these, but I'm hoping for an easier, less error-prone method.

Answer

Pablo Fernandez heelhook picture Pablo Fernandez heelhook · Dec 20, 2012

You can easily do that with

git log master..branch-X

That will show you commits that branch-X has but master doesn't.