如何保护“主人”分支在GitHub? [英] How to protect "master" branch in GitHub?

查看:1541
本文介绍了如何保护“主人”分支在GitHub?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是一个由少数人组成的团队。每个人都可以在功能分支上工作,并在准备就绪时通过GitHub UI将他的东西合并到 master 中。

可以防止直接推送到 master ,但是每当一个新功能准备合并时,可以创建一个 pull request ?此外,它会要命限制合并到仅开发者的一个子集


解决方案

此外它会仅限于合并到开发者的一个子集。


您可以限制推送到分支机构到特定用户或团队。这将允许你建立一个可以合并回 master 的团队。





另外,对于一个小团队,您可以考虑让每个开发人员设置客户端挂钩以防止推送到远程 master



最后,如果您使用提供预接收挂钩的GitHub Enterprise, A HREF = https://github.com/github/platform-samples/blob/master/pre-receive-hooks/restrict-master-to-gui-merges.sh 相对= nofollow noreferrer>强制代码通过公关合并


We are a team of a few people. Everyone works on a feature branch and merges his stuff through GitHub UI into master when one is ready.

Now is it possible to prevent direct pushes to master, but instead create a pull request whenever a new feature is ready to be merged? Additionally it would be awsome to restrict merges to a subset of devs only.

解决方案

Additionally it would be awsome to restrict merges to a subset of devs only.

You can restrict pushes to a branch in an Organization to specific users or teams. This will allow you to set up a team that can merge back into master.

Alternatively, for a small team, you can consider having each developer set up client-side hooks to prevent pushing to a remote master.

Lastly, if you use GitHub Enterprise that offers pre-receive hooks, you can enable one that enforces code to be merged through a PR

这篇关于如何保护“主人”分支在GitHub?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆