仅对 visual studio 团队服务执行拉取请求

Enforce only pull request on visual studio team services

我可以通过任何方式强制某些人只能通过拉取请求在一个分支中做出贡献我希望他们能够接受拉取请求但不能直接推送更改。

这会很有用,因为我们有一些分支策略,让某人接受拉取请求,例如构建必须通过。问题是如果我们允许某人接受拉取请求,我们将允许他们直接推送到分支。有任何方法可以授予分支机构仅通过拉取请求接收更改的权限,或者至少授予某人仅接受拉取请求但不直接推送到分支机构的权限。

我需要在 visual studio 在线完成。

我需要的是取消某人在没有拉取请求的情况下将提交直接推送到分支的权限。

UI自从问了这个问题后已经改变了,功能仍然存在:

是的,通过设置 Git 分支策略,Visual Studio 在线的最新版本是可能的:

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

有两件事必须设置:

  1. 在您要保护的分支上设置策略,最简单的是设置"Require a minimum number of reviewers"。参见 Microsoft Git Branch Policies

  2. 确保贡献者设置为不免除政策执行 - Example