Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git change the source branch of a pull request

Instead of making changes in another branch and making a pull request from that branch, i made the changes in the master branch and made the pull request.Now, i want to edit the pull request.

  • I want to copy the changes made to the master branch to another branch.
  • I want the master branch be updated with the upstream branch
  • I want to update my pull request so that the commits are now made from the other branch rather than my master branch. Thank you.
like image 993
Anish Hota Avatar asked Jul 01 '17 19:07

Anish Hota


People also ask

Can we change the source branch in git?

We can create a new branch with parent master branch and use git cherry-pick command to move each commit from one branch to another. This solution is OK, when you don't have many commits, because for each commit you need to do git cherry-pick .

What is base branch in git pull request?

Base Branch: The "Base Branch" is the branch where your new changes should be applied / integrated into. Head Branch: The "Head Branch" is the branch that contains the changes you want to integrate. Title: A short title that describes what this Pull Request is about.

How do I edit a pull request?

To edit a pull request, select the pull request on the Pull requests page, go to its detail page and click "Edit". The target branch (the base branch) and the pull request branch (the branch that will be merged) cannot be changed.


1 Answers

I want to update my pull request so that the commits are now made from the other branch rather than my master branch.

I'm afraid this is not possible. The GitHub interface only allows to change the destination branch* to merge into, not the source branch.

* This was added in 2016 August. I find the title of the announcement misleading, because what they call the "base branch", is the branch to merge into, not the source branch to merge from. I don't know if there are plans to add support for this.

like image 149
janos Avatar answered Oct 25 '22 03:10

janos