GitHub Pull Request to a new Upstream Branch

GitGithub

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

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"

Solution 2 - Git

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrew KandelsView Question on Stackoverflow
Solution 1 - GitAntonioHSView Answer on Stackoverflow
Solution 2 - GitgrzuyView Answer on Stackoverflow