2

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?

Ruggero Turra
  • 16,929
  • 16
  • 85
  • 141
  • Possible duplicate of [Git: How to create patches for a merge?](http://stackoverflow.com/questions/2285699/git-how-to-create-patches-for-a-merge) – Destrif Jul 05 '16 at 12:14
  • The link does not answer my exact problem. Can you please be specific. – Aruna Sathiyanarayanan Jul 05 '16 at 12:27
  • Which in turn means in concrete steps: # 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 Did you almost read the whole post? – Destrif Jul 05 '16 at 12:29
  • oops missed that answer. Thanks for the help ,it answered my question. – Aruna Sathiyanarayanan Jul 06 '16 at 03:48

2 Answers2

12

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

YurkinPark
  • 121
  • 1
  • 5
0

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?

Community
  • 1
  • 1
Destrif
  • 2,104
  • 1
  • 14
  • 22