Is it possible to restrict certain git users to merge git branches on GitHub? I want to let users commit, pull and push changes in current branch, switch to another existing branch, but do not allow to merge branches. Is it possible on GitHub.com or standalone git repository?
If your repository is under an organization on Github, you can add the developers to a read-access team. That way they can see and check out the repository but can't commit to it. They can also fork the repository, which lets them do their work in their fork then submit pull requests to get their work committed to the main repository.
You can then grant write access to only certain developers who will be in charge of reviewing and merging pull requests.
No. The only way to prevent things like this are git's internal pre-commit or update hooks. Those hooks get called before to push is accepted.
GitHub itself doesn't support pre-commit or update hooks. Only web hooks are supported. But these are called after the push. So too late to prevent certain types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With