Reputation: 18247
I have versions from A to E. Two branch heads, Branch1 and Branch2.
E <- Branch2
|
D
|
C
|
B
|
A <- Branch1
Now I want to apply the difference between say C and D, to Branch1, such that the difference between A and A1, is exactly the same between C and D.
E <- Branch2
|
D
|
C
|
B A1 <- Branch1
| /
A
Two questions.
git diff C D > patch.diff
to make a patch and
then git apply patch.diff
to apply and somehow I don't see the
difference in it.Upvotes: 1
Views: 50
Reputation: 522626
I believe you can just cherry-pick commit D
from Branch2 onto your Branch1:
git checkout Branch1
git cherry-pick <SHA-1 for commit D>
The reason this should work is that commit D
is essentially represents a diff between commits C
and D
. You wish to apply this change set on a different commit, in this case commit A
on Branch1.
Upvotes: 2