git 将 develop 分支设置为拉取请求的默认分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14858075/
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 08:10:25  来源:igfitidea点击:

Set the develop branch as the default for a pull request

gitgithubgit-flowpull-requesthubflow

提问by ton.yeung

I want to make the pull request merge into develop from the feature branch by default.

我想让拉取请求默认从功能分支合并到开发中。

I'm advocating the use of git flow, so when a pull request is submitted for a feature, the pull request needs to get merged into develop, and not master.

我提倡使用 git flow,所以当为一个特性提交一个 pull request 时,这个 pull request 需要合并到 develop 中,而不是 master 中。

Some of the managers commented that being human, there is a possibility that the team leads could overlook that fact and merge the pull request into master by mistake, causing issues with the release later on.

一些经理评论说,作为人类,团队领导可能会忽略这一事实,并错误地将拉取请求合并到 master 中,从而导致以后的发布出现问题。

We want to mitigate the risks of merge hell so this would go a long way in achieving this goal.

我们希望降低合并地狱的风险,因此这对实现这一目标大有帮助。

Edit: I'm using a fork of gitflow called hubflow(http://datasift.github.com/gitflow/). By default, when a feature branch is created git hf feature start [tik-123] the feature branch is created per spec but also gets pushed up to origin. We want this for collaboration. Once the feature is complete, the dev will go to the feature branch in github and issue a pull request. The team leads will then review the pull request and merge the feature into dev if the feature is slated for release in the sprint.

编辑:我正在使用一个名为 hubflow(http://datasift.github.com/gitflow/)的 gitflow 分支。默认情况下,当创建git hf feature start [tik-123] 功能分支时,功能分支是根据规范创建的,但也会被推送到原点。我们希望通过这种方式进行合作。功能完成后,开发人员将转到 github 中的功能分支并发出拉取请求。然后,如果该功能计划在 sprint 中发布,团队负责人将拉取请求并将该功能合并到开发中。

采纳答案by Ian Stapleton Cordasco

Alternatively make developthe default branch that everyone sees when visiting the project. The downside is that anyone who clones it will get an unstable branch by default but all pull requests will go to the develop branch by default too.

或者创建develop每个人在访问项目时看到的默认分支。缺点是任何克隆它的人默认都会得到一个不稳定的分支,但默认情况下所有拉取请求也会转到开发分支。

回答by Josef Kufner

Instead of using masterand developbranches, use stableand master.

而不是使用masterdevelop分支,使用stablemaster

Then it is usually good to merge them before tagging a new version, so there is none or only little diversion. I use this schema and usually stablefollows masterwith small delay and merges are mostly fast-forward.

然后在标记新版本之前合并它们通常是好的,因此没有或只有很少的转移。我使用这个模式并且通常stable跟随master有很小的延迟并且合并大多是快进的。

To keep masterbranch deployable, merge feature branches when they are ready. But since you have stablebranch, new features does not have to be well tested.

为了保持master分支可部署,请在准备好时合并功能分支。但是既然你有stable分支,新功能就不必经过很好的测试。

回答by xero

The github has their own suggested workflow called github flow, by convention all pull requests default to masterbut you can now edit it to any branch you like.

github 有自己建议的工作流程,称为github flow,按照惯例,所有拉取请求都默认为,master但您现在可以将其编辑到您喜欢的任何分支。