Working With Pull Requests in Visual Studio Code and Azure DevOps
Working With Pull Requests in Visual Studio Code and Azure DevOps
Prerequisites
6. The New Pull Request form should already contain the key information reviewers will
need, as well as who those reviewers should be (if any). If not, select release as the
branch to merge into master.
7. You can customize any of this, and some of it may be required based on policy. Also note
that the work item associated with the branch when created is referenced. Click Create.
Task 2: Managing pull requests
3. Select the pull request you just created. This will open it a new browser tab.
4. The Overview tab contains all of the key information specified in the creation form, as
well as options to approve and complete the request.
6. Note that you can select a specific update from the dropdown if you like.
7. Click the Add comment button next to the source file. Enter a comment using markdown
and click Comment to save it. Note that there is a live preview of your comment before
you commit to it.
8. The new comment is placed in line with the code. This makes it very easy to have
discussions about lines and sections of code within their proper context.
9. The new comment is also tracked as part of the pull request. It’s expected that every
comment will be resolved before a pull request will be completed, so this convenient
marker lets you know if there’s anything else that needs to be reviewed.
12. Select the Updates tab. This contains details on the updates in the branch.
13. Select the Commits tab, where you can review the commits made to the branch.
17. When the merge completes, the pull request should be marked as Completed.
19. Select the Completed tab and click the pull request as though you were visiting it fresh.
20. You can review the pull request, as well as Cherry-pick or Revert it if needed. Cherry-
picking is the process of selecting specific commits from one branch to apply to another,
conceptually similar to a copy/paste operation.
22. Note that the work item has now been marked as Done.
23. Under the Development tab, you can see the commit and pull request have been
associated with the work item.
Task 3: Managing Git branch and pull request policies
As projects and teams scale in complexity, it becomes help to automate more of the processes
put in place to ensure quality.
1. Open Project settings.
2. Select Repositories under Repos.
3. Select the PartsUnlimited repo. Like everything else in Azure DevOps, you can manage
security to a great level of detail. Select the Options tab. This allows you to set some
useful policies, such as whether or not you want to allow users to fork the repo, whether
discussed work items are automatically linked, and so on.
4. Select the master branch. Like the repo, you have a great deal of control over its security
settings. You can also define a wide variety of policies for the branch to enforce.
Click Branch Policies.
5. Azure DevOps branch policies are very effective in enforcing a level of quality control in
the repo. For example, you can control pull requests by requiring a minimum number of
reviewers, checking for linked work items, requiring that all comments have been
resolved, and more. You can even require validation through a successful build and
configure external approval services. If there are certain sections of code that require their
own approvers to be included, you can include them here as well.
6. Check Require a minimum number of reviewers. By default, this requires at least two
reviewers to approve a pull request, and also requires (by default) that the original author
is not one of them.
7. Click Add automatic reviewers.