Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enforce only pull request on visual studio team services

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.

like image 365
Gabriel Monteiro Nepomuceno Avatar asked Jun 19 '15 11:06

Gabriel Monteiro Nepomuceno


2 Answers

The UI has changed since this question has been asked, the feature is still there:

enter image description here

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.

Setting branch pull request policies

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.

Setting code review requirements

https://www.visualstudio.com/en-us/news/2015-may-15-vso

like image 193
jessehouwing Avatar answered Nov 16 '22 16:11

jessehouwing


There are two things that must be set:

  1. 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

  2. Ensure that Contributors are set not to be exempt from policy enforcement - Example

like image 21
dph Avatar answered Nov 16 '22 15:11

dph