Reputation: 2958
Say I have branchA
with the latest features and then I have the branchB
which has the hotfixes not yet sync into branchA
.
What I want to do is merged all hotfixes into that latest features (branchA
) but only the diff.
I saw that git log branchA..branchB
actually shows the commits in branchB
not yet existing in branchA
. Unfortunately I don't know the command how to merged the branchB
diff commits into branchA
Upvotes: 13
Views: 8142
Reputation: 1509
If you want to apply changes from branch X to current branch:
git diff ..X | git apply -
This is simply a shorter version of the accepted answer.
Upvotes: 10
Reputation: 2826
You're very close. You can do it as a patch:
git diff branchA..branchB > mypatch.patch
Then apply the patch to the desired branch:
git apply mypatch.patch
Upvotes: 14