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

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.

Leave a Comment