git git-diff

How do I see the differences between two branches?


How do I see the differences between branches branch_1 and branch_2?


  • 33

    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

    Mar 23, 2012 at 5:53

  • 7

  • 67

    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

    Aug 19, 2016 at 8:14

  • 52

    Not only is the “duplicate” a different question, this question is the number one google match for “git diff two branches”.

    Jun 6, 2017 at 13:08

  • 6

    git difftool branch..otherBranch lets you SEE the differences in the Visual tool that you choose. e.g. Meld. This is the answer.

    Jan 30, 2018 at 2:18


Go to a branch (e.g. main), then run diff against another branch (e.g. branch2):

git checkout main
git diff branch2


  • 1

    this didn’t work for me, it showed no changes. I only had local commits though.

    – rob

    Mar 4 at 11:46


git diff master..develop


  • Add --name-only to only see the names of the files.
  • Add -- folderOrFileName at the end to see the changes of specific files or folders.
  • To compare the local branch with the remote one, then run git fetch --all to fetch all remote branches, and run:
    git diff --name-only [branchName]..origin/[branchName]

    Example: git diff --name-only develop..origin/develop.