How to Set Up a Pull Request in Azure DevOps

When several developers are working on the same project, we need to merge our code into a single branch. Before we do that, it’s important to ensure that the new feature we just created is built correctly.

What is a Pull Request?

A pull request (PR) is more than just a notification. It’s a dedicated forum for discussing the proposed feature.

If there are any problems with the changes, teammates can post feedback in the pull request and the feature by pushing follow-up commits, which allows you to save your changes to the repository. This task is monitored directly within the pull request (PR).

Why you should make a Pull Request?

For a successful project collaboration, it's crucial for every developer to grasp the project's architecture and comprehend the functionality of the remaining code.

In this scenario, a pull request (PR) proves beneficial due to the following reasons.

  • It guarantees that team members are familiar with sections of the code they did not author.
  • Developers can learn from each other.
  • Avoids some wrong architecture implementation.
  • Enhances the code as the project advances.
  • Identity potential bugs early.

Set Up a Pull Request in Azure

Navigate to Azure DevOps in the "Repos" section, find the "Branches" section, and then click on the 3 dots on your reference branch to set up policies.

Azure DevOps

The Reviewers

Those responsible for conducting the review, aside from the author, are referred to as "reviewers."

There should be a minimum of 1 reviewer is needed, but if we have 2, it’s better. We need to disable the ability to auto-approve your work because, if we don’t do that, the PR won’t work.

Number of reviews

To facilitate the review process and enhance the reviewers' understanding of the code changes, it is advisable to request linked work items. This practice helps prevent the inclusion of code that may not precisely align with the user story or associated task.

Work linked items

Reviewers will have the ability to "approve”, “approve with suggestions", "wait for the author", or "reject".

If necessary for your project, you can furnish a list of designated reviewers who will receive automatic notifications upon the creation of a new pull request. This can be particularly valuable for individuals such as the project architect or technical leader.

Reviews

Review Comments

After receiving feedback in the form of comments during a PR review, it is crucial to verify whether the developer has acknowledged them before closing the PR. Marking the comment resolution checkbox helps ensure that the comments are duly acknowledged.

Comment resolution

 

If not, all comments are marked as 'resolved,' the PR cannot be merged with the rest of the code.

Comments serve as an effective means of communication among developers, allowing you to tag someone to direct their attention to a specific point.

Build the Project

Ensure that the project is not solely built on the developer's machine; it is beneficial to incorporate build validation using Azure DevOps pipelines.

Once we have configured the pipeline, click on 'build validation' and choose the desired pipeline to execute.


Similar Articles