eoinoc eoinoc - 1 year ago 85
Git Question

Merge pull request to a different branch than default, in Github

A pull request comes into my repo hosted on Github. By default it is merged into the


Is there any way for me to change which branch the changes would be merged into?

Answer Source

The submitter can change that when they issue the pull request, but once they issue it you can't change it.

On the other hand, you can manually merge their branch and push, which I semi-regularly do for mistargetted pull requests.

You may find the hub gem helpful in working with the components of the pull request.

That gem wraps up the manual process, which is:

  1. Add a remote for the fork to your local checkout.
  2. Fetch that remote.
  3. git checkout ${target_branch} && git merge ${remote}/${branch}
  4. git push origin ...