Prevent direct commits on master branch in git repository and accept merges only?

前端 未结 6 1005
误落风尘
误落风尘 2021-02-05 02:10

My git repository has two branches, \'master\' and \'dev\'.

Code committed to \'dev\' goes through an automated build process before it is tested. Code that passes this

6条回答
  •  太阳男子
    2021-02-05 02:30

    If you're using GitHub, they have a feature to protect branches. Go to the GitHub settings for the repository, then branches and see the protected branches settings.

    You can choose which branches you want to protect, and for each branch how you want to protect it. You can just prevent force pushes, require changes to be merged from another branch, or even require that your automated tests have passed.

    See https://help.github.com/articles/defining-the-mergeability-of-pull-requests/

    Bitbucket offer a similar feature.

提交回复
热议问题