2555
votes

I have two branches, branch_1 and branch_2.

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

1
You want something different from the straightforward git diff branch_1 branch_2? (Note, if the names branch_1 and branch_2 also name files, you need git diff branch_1 branch_2 --)torek
The cited duplicate does not answer the question... Determining which files have changed with git diff --name-status master..branchName is markedly different than seeing the exact differences between branches with something like git diff branch_1 branch_2. Or maybe I'm missing something obvious...jww
Not only is the "duplicate" a different question, this question is the number one google match for "git diff two branches".Rob Osborne
git difftool branch..otherBranch lets you SEE the differences in the Visual tool that you choose. e.g. Meld. This is the answer.Greg Rundlett

1 Answers

3481
votes
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