Generate diff patch between two branchs

2

I have to generate a Patch of the changes I made.

The problem is that I have 2 branchs and I have to generate the patch of Branch2 files in relation to Branch1 diff (which is where the original files are).

How can I do this?

    
asked by anonymous 14.01.2015 / 12:49

2 answers

2

No problem if commits are on different branches. What you need is just knowing the hash of each commit. And then just run the following command:

git diff <hash-1> <hash-2> > <nome-do-patch>.patch

To apply the patch, the command is:

git apply --check <nome-do-patch>.patch
    
14.01.2015 / 13:00
0

I could not patch with the

$ git apply --check <nome-do-patch>.patch

So, I went looking for it here and found another one that worked for me.

$ patch -p1 < <nome-do-arquivo>.patch
    
15.09.2015 / 20:03