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 the Branch2 files relative to the Branch1 diff (which is where the original files are).
How can I do that?
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 the Branch2 files relative to the Branch1 diff (which is where the original files are).
How can I do that?
2
It’s okay if the commits are in different branches. What you need is just to know the hash of each commit. And then just turn 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
0
I couldn’t apply the patch with the command
$ git apply --check <nome-do-patch>.patch
So, I searched here and found another one, which worked for me
$ patch -p1 < <nome-do-arquivo>.patch
Thank you for sharing =)
good that it helped you! D
Browser other questions tagged git
You are not signed in. Login or sign up in order to post.
Thanks, but a doubt: I’ve been researching, to generate the patch would not be something like:
git format-patch master --stdout > [nome do arquivo].patch
? Or the same?– Raul3k
It’s probably the same thing, but as I’ve used the
git diff
and I know it generates a patch, I preferred to trust what I already knew :)– Rodrigo Rigotti
Okay, no problem, I’ll test it here, then I’ll come back and tell you whether it worked or not.
– Raul3k
Thank you, that’s right!
– Raul3k