git GitHub 拉取请求到一个新的上游分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9796370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:38:58  来源:igfitidea点击:

GitHub Pull Request to a new Upstream Branch

gitgithub

提问by Andrew Kandels

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.

我的工作流程:我有一个远程项目(上游)的分支(起源)。我创建了一个分支,topic/TICKET。我想在同名的全新“topic/TICKET”分支中创建我的源分支到上游项目的拉取请求。换句话说,我不希望我的拉取请求指向主分支或任何现有分支。

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)".

使用 BitBucket 时,我有这个选项。当我创建我的 PR 时,我选择我的源分支,然后远程分支选择允许“创建新分支(主题/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.

在 GitHub 中,我似乎没有这个选项。我可以输入新的分支名称;但是在我选择一个有效的、现有的上游分支之前,继续的选项会变灰。

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.

令人讨厌的解决方法是在执行 PR 之前创建上游分支;但这需要询问可以向上游提交的人 - 在我看来必须有一种更简单的方法来做到这一点。

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?

那么,GitHub 有没有办法创建一个拉取请求来创建一个新的上游分支,或者这只是一个已知的限制?

采纳答案by grzuy

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 dohave push access to the upstream project i don't see it as a clean workflow.

我认为你不能在 Github 上做到这一点。并且认为这样也可以,因为您不应该能够在您不一定具有推送访问权限的项目上“创建”一个新分支。即使您确实有对上游项目的推送访问权限,我也不认为它是一个干净的工作流程。

回答by antonienko

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

我正在尝试类似的事情,我得到的唯一解决方案是让用户拥有对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.

这样你就可以第一次推送到upstream。在那之后,您还可以推送到origin;之后,您可以按照自己的意愿从一个分支到另一个分支发出拉取请求。

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

创建拉取请求时要小心,因为上游的默认选择分支始终是“master”