Get the difference between two branches in Git

Let's assume that you started on the branch master. Then you can do:

git diff master Branch1 > ../patchfile
git checkout Branch2    
git apply ../patchfile

Alternatively, if your goal is to rewrite history, then you could use an interactive rebase to squash commits.


This is a simple git diff

git diff --name-only SHA1 SHA2

Where SHA1/2 are the hashes of the 2 commits at the top of each branch.

Or you can do

git diff --name-only develop...

To compare your branch against the develop branch