About pull requests and permissions - Azure Repos (2024)

  • Article

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Pull requests (PRs) are a way to change, review, and merge code in a Git repository on Azure Repos. PRs can come from branches within the same repository or from branches in forks of the repository. Teams use PRs to review code and give feedback on changes before merging the code into the main branch. Reviewers can step through the proposed changes, leave comments, and vote to approve or reject the code.

This article describes pull request guidelines and management considerations. For instructions on how to create, view, review, and complete pull requests, see the following articles:

  • Create pull requests
  • View and open pull requests
  • Review pull requests
  • Complete pull requests

Note

For performance and stability reasons, the number of reviewers that can be added to a pull request must be 1000 or less. New pull requests will not be created when adding more than 1000 reviewers, and existing pull requests won't allow you to add more than 1000 reviewers.

Permissions and prerequisites

  • Repos must be enabled on your project. If the Repos hub and associated pages don't display, see Turn an Azure DevOps service on or off to reenable Repos.

  • To view or review PRs, you must be a member of an Azure DevOps project with Basic access or higher.

    • If you don't have a project, create one or sign up for free.
    • If you aren't a project member, get added.
  • To contribute to a PR, you must be a member of the Readers security group or have the corresponding permissions.

  • To create and complete a PR, you must be a member of the Contributors security group or have the corresponding permissions.

  • Repos must be enabled on your project. If the Repos hub and associated pages don't display, see Turn an Azure DevOps service on or off to reenable Repos.
  • To view or review PRs, you must be a member of an Azure DevOps project with Basic access or higher. If you aren't a project member, get added.
  • To contribute to a PR, you must be a member of the Readers security group or have the corresponding permissions.
  • To create and complete a PR, you must be a member of the Contributors security group or have the corresponding permissions.

To learn more about permissions and access, see Default Git repository and branch permissions and About access levels.

Quality feedback for pull requests

High-quality reviews start with high-quality feedback. Here are some keys to great PR feedback:

  • The PR owner should have the right people review the PR, and make sure that reviewers know what the code does.
  • Reviewers should give actionable, constructive feedback.
  • Owners and reviewers should comment and reply quickly.

PR owners should:

  • Make sure to select the right reviewers to assign to a PR.
  • Include reviewers that know how the code works.
  • Ask developers working in other areas to share their ideas.
  • Give a clear description of changes.
  • Provide reviewer guidance with pull request templates.
  • Provide a build of the code with the fix or feature running in it.
  • Reply to comments, accepting the suggestion or explaining why the suggested change isn't ideal.
  • For good suggestions outside the scope of the PR, create new work items, branches, and PRs to make those changes.

Reviewers should do the following tasks.

  • Provide feedback on changes they don't agree with
  • Identify issues and give specific suggestions on what to do differently
  • Make sure the feedback has clear intent and is easy to understand
  • Leave comments or vote on changes

For more information, see Get feedback with Git pull requests.

Branch policies and pull requests

Your team might rely on critical branches in your repo, such as the main branch, to always be in good shape. You can set branch policies to require PRs for any changes on these protected branches, and reject any changes pushed directly to the branches.

You can add more policies to PRs to enforce better code quality in key branches. Extra requirements like a clean build of the proposed code or approval from multiple reviewers can help protect key branches.

You can set the number of required approvals for a PR in a branch policy. You can also set certain reviewers to be required or optional on all or certain PRs. A PR can be set to autocomplete with the required number of approvals, even if other reviewers reject the changes. However, required reviewers must approve PRs before the PRs can merge. It's best practice for at least two reviewers to review and approve changes in a significant PR.

To reset votes whenever a PR author pushes new changes, select Reset code reviewer votes when there are new changes in the Require a minimum number of reviewers branch policy.

The following table summarizes the policies you can define to customize a branch. For an overview of all repository and branch policies and settings, see Git repository settings and policies.

Policy

Default

Description

Require a minimum number of reviewers

Off

Require approval from a specified number of reviewers on pull requests.

Check for linked work items

Off

Encourage traceability by checking for linked work items on pull requests

Check for comment resolution

Off

Check to see that all comments have been resolved on pull requests.

Limit merge types

Off

Control branch history by limiting the available types of merge when pull requests are completed.

Add Build Validation policies

Off

Add one or more policies to validate code by pre-merging and building pull request changes. Can also enable or disable policies.

Add Status Check policies

Off

Add one or more policies to require other services to post successful status to complete pull requests. Can also enable or disable policies.

Automatically included reviewers

Off

Add one or more policies to designate code reviewers to automatically include when pull requests change certain areas of code. Can also enable or disable policies.

For more information, see:

  • Branch policies overview
  • How to configure branch policies
  • Branch permissions
  • Use Azure Functions to create custom branch policies

Define status checks to improve code quality

Pull requests and branch policies let teams enforce best practices for reviewing code and running automated builds. Many teams have further requirements and validations to do on code. To cover these needs, you can integrate PR status checks into the PR workflow. With PR status checks, external services can programmatically sign off on code changes by associating success or failure information with the PR.

For more information, see the following articles:

  • Customize and extend pull request workflows with pull request status
  • Create a PR status server with Node.js
  • Configure a branch policy for an external service

Multiple merge base issue

In some cases, a PR has more than one true merge base, and this situation can cause security issues. If the files in the PR have different versions between the merge bases, a multiple merge base warning happens. For more information and remediation, see Multiple merge bases.

Next steps

  • Improve code quality with branch policies
  • Customize and extend pull request workflows with pull request status
  • Pull request update notifications
  • Change the default branch
  • Copy changes with cherry-pick
  • Merge strategies and squash merge
  • Multiple merge bases
About pull requests and permissions - Azure Repos (2024)

FAQs

What is meant by the pull requests in Azure DevOps repos? ›

Pull requests (PRs) are a way to change, review, and merge code in a Git repository on Azure Repos. PRs can come from branches within the same repository or from branches in forks of the repository. Teams use PRs to review code and give feedback on changes before merging the code into the main branch.

How to resolve pull request comments in Azure DevOps? ›

To reply to and resolve the comment, type your response in the Write a reply field, and select Reply & resolve.

How do I see all pull requests in Azure DevOps project? ›

List pull requests. You can list PRs by using the Azure DevOps project website, Visual Studio, or the Azure DevOps command line. To list PRs in a specific repository in a project, go to that project in the web portal and select Repos > Pull requests.

What is the status policy of pull request in Azure DevOps? ›

Status policy - provides a mechanism to block pull request completion until the pull request status indicates success. Custom actions - provides a way to extend the status menu using Azure DevOps Services extensions.

What is the purpose of pull requests? ›

A pull request is a proposal to merge a set of changes from one branch into another. In a pull request, collaborators can review and discuss the proposed set of changes before they integrate the changes into the main codebase.

How do I deploy a pull request in Azure DevOps? ›

Pull request deployment
  1. Navigate to your Azure DevOps project, select Pipelines > Releases and then select your release pipeline.
  2. Select the Continuous deployment trigger icon in the Artifacts section.
  3. Select the toggle button to enable the Pull request trigger.
  4. Select your Target Branch from the dropdown menu.
Feb 14, 2023

Can I delete a pull request in Azure DevOps? ›

While an abandoned pull request cannot currently be permanently deleted in Azure DevOps, it can be closed. The comment/update history will remain, but the pull request will not show up in the "Abandoned" list. Delete the pull request's source branch if it still exists.

How to change target branch in pull request Azure? ›

Change the target branch of an active pull request
  1. Select More actions at upper-right on the PR Overview page, and then select Change target branch from the dropdown menu.
  2. In the Change target branch pane, select Choose a target branch, select the new branch, and then select Change.
Mar 25, 2024

How to export pull request from Azure DevOps? ›

Azure DevOps does not have a built-in feature to export pull request data to a PDF or other offline formats directly. However, you can use the Azure DevOps REST API to retrieve the pull request data and then create a script to export that data into the desired format, such as a PDF file.

How to open a pull request in Azure? ›

To access PRs from Visual Studio 2019 Team Explorer:
  1. Connect to your project from Visual Studio.
  2. Select View > Team Explorer to open Team Explorer. ...
  3. From Home, select Pull Requests to view lists of PRs opened by you or assigned to you.
  4. To open a PR in the web portal, right-click the PR and select Open in browser.
Mar 25, 2024

How do I resolve Azure DevOps pull request conflict? ›

Quick steps to get started
  1. After installing the extension, select the Conflicts tab from within a pull request.
  2. Look through the list of files with conflicts and select a file to resolve.
  3. Select a resolution type for that file.
  4. Navigate to the conflicted section.
  5. Edit the file to manually merge.
  6. Submit the merged file.
Nov 3, 2023

What is the difference between a pull request and a merge request? ›

A Git pull request is essentially the same as a Git merge request. Both requests achieve the same result: merging a developer's branch with the project's master or main branch. Their difference lies in which site they are used; GitHub uses the Git pull request, and GitLab uses the Git merge request.

What is pull request in CICD? ›

When a developer wants to contribute code or a code segment to a project, they create a copy of the project's code in a branch repository, make changes to the code, and then request changes to be reviewed against the target branch. This is called a Pull Request.

What is the difference between pull and fetch in Azure DevOps? ›

The key difference between git fetch and pull is that git pull copies changes from a remote repository directly into your working directory, while git fetch does not.

What is pulling a repository? ›

The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.

Top Articles
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 5588

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.