Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Pull Request to a new Upstream Branch

Tags:

git

github

My workflow: I have a fork (origin) of a remote project (upstream). I have created a branch, topic/TICKET. I want to create a pull request of my origin branch to the upstream project in a same-named, brand new "topic/TICKET" branch. In other words, I don't want my pull request toward the master branch or any existing branch.

When using BitBucket I have this option. When I create my PR, I select my origin branch and then the remote branch selection allows "Create new branch (topic/TICKET)".

In GitHub I don't appear to have this option. I can type in the new branch name; but then the option to continue greys out until I select a valid, existing branch upstream.

The annoying work-around is creating the branches upstream before I perform the PR; but it requires asking someone who can commit upstream -- it seems to me like there must be an easier way to do this.

So, is there any way with GitHub to create a pull request to create a new upstream branch, or is this just a known limitation?

like image 298
Andrew Kandels Avatar asked Mar 20 '12 23:03

Andrew Kandels


People also ask

Does a pull request need a new branch?

Pull requests can only be opened between two branches that are different. Note: To open a pull request in a public repository, you must have write access to the head or the source branch or, for organization-owned repositories, you must be a member of the organization that owns the repository to open a pull request.


2 Answers

I was trying a similar thing, and the only solution I got is to have an user with push permission to upstream.

That way you could do a first push to upstream. Right after that, you also do a push to origin; and afterwards you can make your pull requests from branch to branch as you wish in first place.

Just be careful when you create the pull request, because the default selected branch for upstream is always "master"

like image 174
AntonioHS Avatar answered Sep 28 '22 02:09

AntonioHS


I don't think you can do that on Github. And also think is okay like that, because you shouldn't be able to "create" a new branch on a project you don't necessarily have push access. Even if you do have push access to the upstream project i don't see it as a clean workflow.

like image 31
grzuy Avatar answered Sep 28 '22 01:09

grzuy