Complete, abandon, or revert pull requests

Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018

Visual Studio 2022 | Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015

Once all required reviewers approve your pull request (PR) and the PR meets all branch policy requirements, yous can merge your changes into the target branch and complete the PR. Or if you lot make up one's mind not to proceed with the changes in the PR, you can abandon the PR.

To accost reviewers' changes, and respond to and resolve review comments, run across Accost comments.

Prerequisites

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

  • To complete your PR, you lot must be a member of the Contributors security grouping, or have the corresponding permissions, in the projection the PR is in.

  • To contribute to a PR, y'all must exist a member of the Readers security group or take the corresponding permissions.

  • To view or review PRs, y'all must have Basic or higher access to the Azure DevOps project.

  • If you aren't a member of the project you want to contribute to, get added.

    Annotation

    For public projects, users granted Stakeholder access have full admission to Azure Repos.

  • 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 complete a PR, you must be a member of the Contributors security group, or have the corresponding permissions, in the projection you lot want to change.
  • To contribute to a PR, you must exist a member of the Readers security group or have the respective permissions.
  • To view or review PRs, yous must be a fellow member of the Azure DevOps project with Basic access or higher. If you aren't a project member, get added.
  • To complete a PR, you lot must be a member of the Contributors security group for the Azure DevOps project, or have the corresponding permissions.
  • To view or review PRs, yous must be a member of the Azure DevOps projection with Basic access or college. If you aren't a project fellow member, get added.
  • To contribute to a PR, you must be a member of the Readers security group for the Azure DevOps projection or take the corresponding permissions.
  • To learn more about permissions and access, see Default Git repository and branch permissions and About access levels.
  • In Azure DevOps Services, you lot tin can manage PRs and other resources from the Azure command-line interface (CLI) with the azure-devops extension. To acquire how to piece of work with the Azure DevOps Services CLI, see Get started with Azure DevOps CLI. Azure Repos CLI commands for PRs use az repos pr.

Cheque merge changes

When you complete a PR, Git adds a new merge commit to the end of the main co-operative. This merge commit links the earlier histories of the main branch and the PR source branch. To encounter the preview merge commit and bank check for merge conflicts, select the More options menu at upper right on a PR Overview page, and and then select View merge changes.

If yous inverse the target branch after creating the PR, select Restart merge to create a new preview merge commit and update the merge change diff view.

Screenshot that shows the View merge and Restart merge options in the More options menu of the P R.

Review branch policies

Teams can ready branch policies that require PRs in protected branches to meet specific criteria before the PRs can merge. You can see the branch policies in effect for your PR, whether they're required for merge, and whether the PR is passing or failing.

  • Browser
  • Visual Studio
  • Azure DevOps CLI

The PR Overview tab summarizes branch policies that are passing or failing for the PR. The overview lists only failed policies, but you tin can run across all the policy checks by selecting View <n> checks.

On the PR Overview page, branch policy requirements have an icon. Select More options adjacent to the requirement and and then select View policy to get to the co-operative'south Branch Policies page in Project Settings.

Screenshot that shows View policy next to a branch policy requirement in a P R.

Complete a pull request

Later yous resolve whatever merge conflicts, and the PR meets all branch policies and has all required approvals, you can complete the PR.

  • Browser
  • Visual Studio
  • Azure DevOps CLI
  1. Select Complete at upper right to complete the PR. Or select the dropdown pointer side by side to the Consummate button, and select i of the options.

    Screenshot that shows the Complete button options for the P R.

    • Complete: Complete the PR now, and merge the changes to the target branch.
    • Ready auto-complete: Configure the PR to complete and merge in one case it meets all required branch policies.
    • Mark every bit draft: Return the PR to typhoon status and remove all votes.
    • Carelessness: Shut the PR without merging the changes.
  2. In the Consummate pull request pane, under Merge type, select one of the merge options.

    Screenshot that shows the complete P R dialog.

    • Merge (no fast forward): Merge with a non-linear history that preserves all commits.
    • Squash commit: Merge with a linear history that combines all source commits into a single commit on the target, or squash merges the PR.
    • Rebase and fast-forrard: Rebase the source commits onto the target and fast-forward.
    • Semi-linear merge: Rebase source commits onto the target and create a two-parent merge.

    Note

    Existing policies are enforced. For instance, if your co-operative currently has a "squash merge simply" policy, you have to change that policy if you want to employ another merge type.

  3. Select whatever of the following mail-completion options. Some options aren't available for some merge types.

    • Complete associated work items after merging: Complete any linked work items.
    • Delete <branch proper noun> afterwards merging: Delete the PR's source branch after merging.
    • Customize merge commit message: Add a custom merge commit bulletin. If you select this pick, update the merge commit message.
    • Override branch policies and enable merge. Forcefulness the merge even if the PR doesn't satisfy all branch policies. This choice is only bachelor if yous accept Exempt from policy enforcement permission.
  4. Select Complete merge.

  1. Select Complete at upper right to complete the PR. Or, select the dropdown arrow adjacent to the Complete button, and select one of the following options:

    Screenshot that shows the Complete button options for the PR.

    • Complete: Consummate the PR now, and merge the changes to the target branch.
    • Set car-consummate: If you accept branch policies, configure the PR to complete and merge once it meets all required co-operative policies.
    • Abandon: Shut the PR without merging the changes.
  2. On the Complete pull request screen, enter the message for the merge commit and update the PR description.

    Complete pull request dialog

  3. Select any of the following options:

    • Consummate linked work items subsequently merging to complete any linked work items.

    • Delete <branch proper noun> later on merging to delete the source branch from the PR.

    • Squash changes when merging to squash merge your PR.

    • Override branch policies and enable merge to force a branch to merge fifty-fifty if it doesn't satisfy all branch policies. This choice is only available if you have Exempt from policy enforcement permissions.

      Note

      Existing policies are still enforced. For example, if your branch currently has a "squash merge only" policy in place, you have to edit that policy in order to use the other merge types.

  4. Select Complete merge.

When you consummate the merge, whatsoever linked work items automatically update to testify the PR completion.

Screenshot of linked work items showing completed P Rs.

  1. Select Complete in the upper correct of the PR view to complete your PR after the reviewers approve of the changes.

    Complete button for the PR with its drop-down options

    • Consummate: Consummate the PR now and merge the changes to the target branch.
    • Set auto-consummate: If you accept branch policies, yous tin can choose Set automobile-complete to configure the PR to shut once it meets all branch policies.
    • Carelessness: Close the PR without merging the changes.
  2. In Consummate pull request, enter the message for the merge commit and update the PR clarification.

    Complete PR dialog

  3. Select any of the following postal service-completion options:

    • Complete linked work items later merging to complete whatever linked work items.
    • Delete <branch name> after merging to delete the source branch from the PR.
    • Squash changes when merging to squash merge your PR.
    • Override branch policies and enable merge to strength a co-operative to merge even if information technology doesn't satisfy all branch policies. This option is only available if you accept Exempt from policy enforcement permissions.
  4. Select Complete merge.

Linked work items are likewise updated showing the PR completion.

Linked Work Items showing completed PRs

Rebase during PR completion

There are a few situations when rebasing during PR completion isn't possible:

  • If a policy on the target branch prohibits using rebase strategies, y'all demand Override co-operative policies permission to rebase.
  • If the PR source branch has policies, you lot tin't rebase it. Rebasing would change the source co-operative without going through the policy approval process.
  • If you lot used the Merge Disharmonize Extension to resolve merge conflicts, yous can't rebase. Conflict resolutions applied to a 3-mode merge are seldom successful or valid when rebasing all the PR commits individually.

In all these cases, you can still rebase your branch locally and so push button upstream, or squash-merge your changes when y'all complete the PR.

Multiple merge base effect

In some cases, a PR has more than one true merge base of operations, and this state of affairs can cause security bug. 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.

Resolve merge conflicts

File changes in your branch can conflict with changes in another branch. When it isn't articulate how to merge changes, Git shows the files that disharmonize on the PR's Overview page. Yous must resolve any merge conflicts between the PR branch and the target co-operative before you can merge a PR or set the PR to autocomplete. For instructions on resolving merge conflicts, see Resolve merge conflicts.

Screenshot that shows merge conflicts on the Overview tab of a P R.

Set a pull request to autocomplete

  • Browser
  • Visual Studio
  • Azure DevOps CLI

Select Ready car-consummate from the Consummate dropdown list to consummate and merge the PR changes as before long as conditions satisfy all branch policies. When the PR is completed, you receive an e-mail notification. If a disharmonize or error prevents PR completion, email notifies you of the result.

Note

The Set up auto-complete option is available in Azure Repos and TFS 2017 and college when you accept co-operative policies. If yous don't see Set motorcar-complete, y'all don't accept any co-operative policies. For more than information, meet Branch policies.

Past default, a PR that'south set to autocomplete waits only on required policies. In the Enable automatic completion console, you can choose to wait on optional policies likewise.

Screenshot that shows changing an optional policy to required in the Enable automatic completion panel.

Starting with TFS 2018 Update 2, the PR Overview page displays the listing of outstanding policy criteria the PR is waiting for. If you set a policy to be required in the Enable automated completion panel, you can prepare it dorsum to optional on the Overview folio.

Select Cancel auto-complete to turn off autocomplete.

Screenshot of a PR in autocomplete state.

Screenshot of a PR in autocomplete state.

A PR ready to autocomplete displays an Auto-complete badge on the Pull requests page.

Screenshot showing an autocomplete PR in the PR list.

Abandon or reactivate a pull request

  • Browser
  • Visual Studio
  • Azure DevOps CLI

To abandon your changes and your PR without merging, select Abandon from the dropdown list on the Complete push. You lot can yet view the abandoned PR, and it stays linked to work items.

To reactivate an abased PR at whatever time, open the PR from the Abased tab in the Pull Request view, and select Reactivate at upper right.

Revert a completed pull request

To undo the changes from a PR, follow these steps. For more information, see Undo changes.

  1. Open the completed PR and select Revert. This action creates a new branch with changes that undo the PR in an existing target branch in your repo.

  2. In the Revert pull request pane:

    1. Under Target branch, select the branch where you want to undo the PR changes.
    2. Nether Topic co-operative name required, alter the revert PR branch name if you want.
    3. Select Revert.
  3. On the New pull asking screen, select Create.

  4. Merge the new PR to complete the revert.

Notation

The branch created during this revert has a single commit that reverts all the file changes from the original PR. The branch doesn't contain a reverted commit for each of the commits in the original PR.

Next steps

  • Pull asking update notifications
  • Almost pull requests and permissions