How to do it...

  1. Open the branches view for the myWebApp Git repository in the parts unlimited team portal. Select the master branch, and from the pull-down context menu, choose Branch policies:
  1. In the policies view, check the option to protect this branch:
  1. This presents the out-of-the-box policies. Check this option to select a minimum number of reviewers. Set the minimum number of reviewers to 1 and check the option to reset the code reviewer's votes when there are new changes:
The Allow users to approve their own changes option allows the submitter to self-approve their changes. This is OK for mature teams, where branch policies are used as a reminder for the checks that need to be performed by the individual. 
  1. Use the review policy in conjunction with the comment resolution policy. This allows you to enforce that the code review comments are resolved before the changes are accepted. The requester can take the feedback from the comment and create a new work item and resolve the changes. This at least guarantees that code review comments aren't just lost with the acceptance of the code into the master branch:
  1. A code change in the team project is instigated by a requirement. If the work item that triggered the work isn't linked to the change, it becomes hard to understand why the changes were made over time. This is especially useful when reviewing the history of changes. Configure the Check for linked work items policy to block changes that don't have a work item linked to them:
  1. Select the option to automatically add code reviewers when a pull request is raised. You can map which reviewers are added based on the area of the code being changed: