How to protect “master” branch in GitHub?

与世无争的帅哥 提交于 2019-12-02 04:03:33

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/34131617/how-to-protect-master-branch-in-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!