Comparing two branches in Git?

isuruanu picture isuruanu · Mar 23, 2012 · Viewed 1.6M times · Source

I have two branches, branch_1 and branch_2.

How can I see the differences between the two branches in Git?

Answer

Lazy Badger picture Lazy Badger · Mar 23, 2012
git diff branch_1..branch_2

That will produce the diff between the tips of the two branches. If you'd prefer to find the diff from their common ancestor to test, you can use three dots instead of two:

git diff branch_1...branch_2