Creating patch from merge request

We have several teams merging changes to the same branch. I have to recommit selective merge requests to another branch. Is there a way to create patch from individual merge requests in git hub?

Upvotes: 4

Views: 7742

Answers (2)

YurkinPark
YurkinPark

Reputation: 179

If you have MR url like https://git.drupalcode.org/project/drupal/-/merge_requests/622/diffs you always can add just .patch to the end of MR link (like https://git.drupalcode.org/project/drupal/-/merge_requests/622/diffs.patch ) and you will get patch :). Use accuracy because source branch can be rebased before MR is applied. enter image description here

Upvotes: 18

Destrif
Destrif

Reputation: 2134

You can do:

 # Perform the merge:
git checkout master
git merge feature
 ... resolve conflicts or whatever ...
git commit, # Format a patch: git log -p --pretty=email --stat -m --first-parent origin/master..HEAD > feature.patch
git am feature.patch

From:

Git: How to create patches for a merge?

Upvotes: 0

Related Questions