Merge a transfer request to a different branch than the default in Github

My repo hosted on Github includes a port request. By default, it is merged into the master branch.

Is there any way to change which branch changes will be merged with?

+82
git github pull-request
Feb 03 2018-12-12T00:
source share
6 answers

The applicant can change this when they issue a transfer request, but once they issue it, you cannot change it.

On the other hand, you can manually merge your branch and click on what I do semi-regularly for erroneous requests for traction.

You may find the gem hub useful when working with tensile request components.

This stone completes a manual process that:

  • Add remote for plug to local check.
  • Remove this remote.
  • git checkout ${target_branch} && git merge ${remote}/${branch}
  • git push origin ...
+50
Feb 03 '12 at 22:14
source share

Starting August 15, 2016 , GitHub allows you to change the target branch of a tensile request through the graphical user interface:

screenshot

Now you can change the base request branch to an open click. After you have created the transfer request, you can change the base branch so that the changes in the stretch request are compared with another branch. By changing the base branch of the original retrieval request, rather than opening a new one with the correct base branch, you can save valuable work and discussion.

+22
Aug 16 '16 at 23:30
source share

An alternative to using the hub gem mentioned in other answers is to use the command line to combine local pull requests , which allows you to do:

 $ git fetch origin $ git checkout *target_branch* $ git merge pr/XXX $ git push origin *target_branch* 



The commands above work directly if you first added the following line to your .git/config file:

 fetch = +refs/pull/*/head:refs/remotes/symbolic_name_origin_or_upstream/pr/* 

What this means is that you can download ALL queries. Since this may not be desirable for large repositories, GitHub modified the instructions to use the git fetch origin pull/ID/head:BRANCHNAME , which avoids changing the configuration file and only loads this request with a single click.

+12
Jan 13 '14 at 21:29
source share

There is nothing wrong with Daniel Pittman's solution, however, I would consider these mergers as "not fast forward", i.e. changing step 3 for:

 git checkout ${target_branch} && git merge --no-ff ${remote}/${branch} 

Using --no-ff , the story will be easier to read. He will clearly say that $n makes transactions from $branch , and it will also make your life easier if you need to return something in this branch.

To answer the eoinoc question and give additional advice:

After the merge is completed, your git cli will prompt you to write a message, as a rule, a general message will appear saying something like

Merge the remote "user / branch" branch into your branch

Be sure to edit this message and include a link to the pull request number. That is: (Assuming the pull request number is 123)

Merge the remote "user / branch" branch into your branch

refs # 123 to solve something ...

So, the next time you go to the github issues / pull-requests page and check for this particular pull request, you will see your message with a link for fixing where you merged.

Here is a screenshot of what I mean.

enter image description here

+7
Nov 25 '13 at 4:50
source share

Although you cannot modify an existing transfer request because it does not belong to you, you can easily create a new one if the corresponding source repository still exists - yes, even if it is foreign.

Go to the creator's repository, then create a new migration request in your repository using the same commits, but be sure to configure the correct branch correctly.

Then go back to your own repository and accept the new pull request. Voila!

+7
Sep 11 '14 at 20:37
source share

To do this, go to the main repository page, click branches and change the default branch from the wizard to something else, in my case "dev".

After that, whenever someone creates a stretch request, the merge button automatically merges the request into "dev" rather than master.

enter image description here

+5
Jul 09 '15 at 7:42
source share



All Articles