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

前端 未结 6 1008
误落风尘
误落风尘 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:49

    Not a direct answer: consider using repos instead of branches for this. Imagine three repos: local, dev, and blessed. Local = your own repo where you work. Dev = the repo you push all your commits to and the one that your build process is monitoring for changes. Blessed = the repo that only the build process can push to and which you pull from. Thus you commit into local and push changes to dev. Auto-build does all it's testing of the commits you pushed and on success, pushes them to blessed. Then you (or anyone else) can pick them up from blessed and continue work from there.

提交回复
热议问题