Git – Diff Between Branches

When you are working with multiple branches in Git, it’s important to be able to compare them and contrast the differences.

In this short note i will show how to compare two branches in Git using the git diff command.

I will show how to git diff between any two branches, e.g. current branch and master or git diff between master and staging and how to list only files that are different between two branches (without changes themselves).

Cool Tip: How to git diff staged and unstaged files! Read more →

Git – Diff Between Branches

Diff between current branch and master:

$ git diff master

Diff between two branches, e.g. master and staging:

$ git diff master..staging

Show only files that are different between the two branches (without changes themselves):

$ git diff --name-status master..staging

One Reply to “Git – Diff Between Branches”

  1. Just a quick note – the diff will not work if you put a “..” between the names of the branches; should just be a space.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.