There is any way I could enforce that some people could contribute by one branch only by pull request I want them to be able to accept pull request but not to direct push changes.
This would be useful because we have some branch polices in place that for someone to accept a pull request for example the build must pass. The problem is if we allow someone to accept pull request we would be allowing them to push direct to the branch. There it is any way to give permissions to a branches to only receive changes trough pull request, or at least give permissions to someone to only accept pull requests but not to push directly to the branch.
I need to do that on visual studio online.
What I need it is to remove the permission of someone to direct push commits to a branch without a pull request.
The UI has changed since this question has been asked, the feature is still there:
Yes this is possible with the last release of Visual Studio Online by setting a Git Branch Policy:
Branch policies
To help teams using Git improve the quality of code going into their repo, we’ve added a new capability to set policies on branches. These new policies enable teams to configure requirements for their development branches that are enforced by the server when pushing or merging pull requests. Build breaks can be prevented by using the build policy to require that all changes entering a branch pass a configured build.
Code review policies can be used to set a minimum number of reviewers for pull requests, or even require specific users to review changes made to specific portions of your codebase.
https://www.visualstudio.com/en-us/news/2015-may-15-vso
There are two things that must be set:
Set a Policy on the branch(es) you want protected, the simplest is to set "Require a minimum number of reviewers". See Microsoft Git Branch Policies
Ensure that Contributors are set not to be exempt from policy enforcement - Example
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