Complete, cancel, or reset pull requests - Azure Repos (2023)

  • Article
  • 16 minutes to read

Azure DevOps-Dienste | Azure DevOps-Server 2022 – Azure DevOps-Server 2019 | TF 2018

Visual Studio 2019 | Visual Studio 2022

Once all required reviewers have approved your pull request (PR) and the PR satisfies everyonebranch policyRequirements, you can merge your changes into the target branch andcomplete the PR. Or if you decide not to proceed with the changes in PR, you cangive up the PR.

To respond to reviewers' changes and to reply to and resolve review comments, seeaddress comments.

requirements

  • Reposmust be activated in your project. If theReposHub and associated pages are not displayed, seeTurn on or off an Azure DevOps serviceto re-enable repos.

  • To complete your PR, you must be a member ofcontributorsSecurity group or have the appropriate permissions in the project where the PR resides.

  • To contribute to a PR, you must be a member of theReadersecurity group or have the appropriate permissions.

  • To view or review PRs, you mustBasicor higher Access to the Azure DevOps project.

  • If you are not a member of the project you wish to contribute to,to be added.

    note

    Users are granted for public projectsInterest Groupsaccess have full access to Azure repos.

  • Reposmust be activated in your project. If theReposHub and associated pages are not displayed, seeTurn on or off an Azure DevOps serviceto re-enable repos.
  • To complete a PR, you must be a member ofcontributorssecurity group or have the appropriate permissions in the project you want to modify.
  • To contribute to a PR, you must be a member of theReadersecurity group or have the appropriate permissions.
  • To view or review PRs, you must be a member of the Azure DevOps projectBasicaccess or higher. If you are not a project member,to be added.
  • To complete a PR, you must be a member ofcontributorsSecurity group for the Azure DevOps project or have the appropriate permissions.
  • To view or review PRs, you must be a member of the Azure DevOps projectBasicaccess or higher. If you are not a project member,to be added.
  • To contribute to a PR, you must be a member of theReaderSecurity group for the Azure DevOps project or have the appropriate permissions.
  • For more information on permissions and access, seeDefault Git repository and branch permissionsandAbout Access Levels.
  • In Azure DevOps Services you can manage PRs and other resourcesAzure Command Line Interface (CLI)with theAzure developerRenewal. For information about working with the Azure DevOps Services CLI, seeGet started with the Azure DevOps CLI. Azure Repos CLI commands for use by PRsaz repos pr.

Review the merge changes

When you complete a PR, Git adds a new onemerge committo the end of the main branch. This merge commit links the previous histories of the main branch and the PR source branch. To preview and check the merge commitmerge conflicts, chooseMore optionsMenu at the top right of a PRoverviewPage and then selectShow merge changes.

(Video) Azure devops Repos New repo, commits, pull requests

If you changed the target branch after creating the PR, selectRestart mergeto create a new preview merge commit and update the merge change diff view.

Complete, cancel, or reset pull requests - Azure Repos (1)

Check branch policies

Teams can hirebranch policywhich require PRs in protected branches to meet certain criteria before the PRs can be merged. You can see the branch policies that apply to your PR, whether they are required for the merge, and whether the PR passes or fails.

  • Browser
  • Studio visuals
  • Azure DevOps-CLI

The public relationsoverviewTab summarizes branch policies that passed or failed for the PR. The overview only lists failed policies, but you can view all policy checks by selectingShow <n> exams.

On the PR overview page, the branch office policy requirements have aComplete, cancel, or reset pull requests - Azure Repos (2)Symbol. ChooseMore optionsnext to the requirement, and then selectView policygo to the branchStore Policiesside inproject settings.

Complete, cancel, or reset pull requests - Azure Repos (3)

Complete a pull request

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

  • Browser
  • Studio visuals
  • Azure DevOps-CLI
  1. ChooseCompletelytop right to complete the PR. Or select the drop-down arrow next toCompletelyand select one of the options.

    Complete, cancel, or reset pull requests - Azure Repos (4)

    • Completely: Complete the PR now and merge the changes into the target branch.
    • Set auto-completion: Configure the PR to complete and merge once it meets all required branch policies.
    • Mark as draft: Reset PR to draft status and remove all votes.
    • To give up: Close PR without merging the changes.
  2. ImFull pull requestdisc, undermerge type, select one of the merge options.

    Complete, cancel, or reset pull requests - Azure Repos (5)

    • Merge (no fast forward): Merge to a nonlinear history that preserves all commits.
    • Squash-Commit: Merge with a linear history that combines all source commits into a single commit on the target, orPumpkin mergesthe public relations. Note that a new commit is created on the target branch without keeping the commit history from the source branch.
    • Rebase and fast forward: Switch source commits to target and fast forward.
    • Semi-Linear Merge: Rebase source commits to target and create a two-parent merge.

    note

    Existing policies are enforced. For example, if your branch For example, if you currently have a "Squash Merge Only" policy, you must change that policy if you want to use a different merge type.

  3. Select one of the following options upon completion. Some options are not available for some merge types.

    • Complete associated work items after merging: Complete all associated work items.
    • Delete <branch name> after merging: Delete the source branch of the PR after merging.
    • Customize merge commit message: Add a custom merge commit message. If you select this option, update themerge commitMessage.
    • Override branch policies and enable merging. Force the merge even if the PR doesn't meet all branch policies. This option is only available if you have done soExcluded from policy enforcementPermission.
  4. ChooseFull merge.

    (Video) PULL REQUEST WORKFLOW in AZURE DEVOPS - Raising a PR, Reviewing and Setting up Branch Policies

  1. ChooseCompletelytop right to complete the PR. Or select the drop-down arrow next toCompletelyand select one of the following options:

    Complete, cancel, or reset pull requests - Azure Repos (6)

    • Completely: Complete the PR now and merge the changes into the target branch.
    • Set auto-completion: If you have branching policies, configure the PR to complete and merge once it meets all required branching policies.
    • To give up: Close PR without merging the changes.
  2. On theFull pull requestEnter the message for the on the screenmerge commitand update the PR description.

    Complete, cancel, or reset pull requests - Azure Repos (7)

  3. Choose one of the following options:

    • Complete linked work items after mergingto complete all linked work items.

    • Extinguish<branch name>after mergerto delete the source branch from the PR.

    • Squash changes when mergedtoMerge Pumpkinyour PR. Note that a new commit is created on the target branch without keeping the commit history from the source branch.

    • Override branch policies and enable mergingto force a branch to merge even if it doesn't meet all branch guidelines. This option is only available if you have done soExcluded from policy enforcementPermissions.

      note

      Existing policies will continue to be enforced. For example, if your branch currently has a "Squash Merge Only" policy, you must edit that policy to use the other merge types.

  4. ChooseFull merge.

When you complete the merge, alllinked work itemsupdate automatically to show the PR close.

Complete, cancel, or reset pull requests - Azure Repos (8)

  1. ChooseCompletelyat the top right of the PR view to finalize your PR after the reviewers have approved the changes.

    (Video) 13 Azure Repos - Pull Request (workflows, approval process and others), Branch Policies

    Complete, cancel, or reset pull requests - Azure Repos (9)

    • Completely: Now complete the PR and roll out the changes to the target branch.
    • Set auto-completion: If you have branching policies, you can chooseSet auto-completionto configure the PR to close once it meets all branch policies.
    • To give up: Close PR without merging the changes.
  2. InFull pull request, enter the message for themerge commitand update the PR description.

    Complete, cancel, or reset pull requests - Azure Repos (10)

  3. Select one of the following post-completion options:

    • Complete linked work items after mergingto complete all linked work items.
    • Extinguish<branch name>after mergerto delete the source branch from the PR.
    • Squash changes when mergedtoMerge Pumpkinyour PR. Note that a new commit is created on the target branch without keeping the commit history from the source branch.
    • Override branch policies and enable mergingto force a branch to merge even if it doesn't meet all branch guidelines. This option is only available if you have done soExcluded from policy enforcementPermissions.
  4. ChooseFull merge.

Linked work items are also updated to reflect PR completion.

Complete, cancel, or reset pull requests - Azure Repos (11)

Rebase during PR close

There are some situations where rebase is not possible during PR close:

  • If a policy in the target branch prohibits the use of rebase strategies, you mustOverride branch policiesPermission to rebase.
  • If the PR source branch has policies, you cannot rebase it. Rebasing would change the source branch without going through the policy approval process.
  • If you used the Merge Conflict Extension to resolve merge conflicts, you cannot use a rebase. Conflict resolutions applied to a three-way merge are rarely successful or valid if all PR commits are rebased individually.

In all of these cases, you can always rebase your branch locally and then push it up or squash-merge your changes when you complete the PR.

Issue with multiple merge base

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 are of different versions between the merge bases, a multiple merge base warning is issued. For more information and remedies, seeMultiple merge bases.

Resolve merge conflicts

File changes on your branch can conflict with changes on another branch. If it's not clear how to merge changes, Git will show the conflicting files on the PRsoverviewPage. You must solve allmerge conflictsbetween the PR branch and the target branch before you can merge a PR or set the PR to autocomplete. For instructions on resolving merge conflicts, seeResolve merge conflicts.

Complete, cancel, or reset pull requests - Azure Repos (12)

Set a pull request to autocomplete

  • Browser
  • Studio visuals
  • Azure DevOps-CLI

ChooseSet auto-completionof theCompletelyDrop-down list to finalize and merge the PR changes once the conditions all meetbranch policy. When the PR is complete, you will receive an email notification. If a conflict or error prevents PR closure, you will be notified of the issue via email.

note

DieSet auto-completionOption is available in Azure Repos and TFS 2017 and later if you have branch policies. If you don't seeSet auto-completion, you have no branching rules. For more information, seebranch policy.

By default, a PR set to autocomplete only waits for required policies. in theTurn on auto-completionyou can also wait for optional policies.

(Video) 16 Azure Repos - Pull Request Merge Conflict Extension, Tags, Lock, Branch Security and Policies

Complete, cancel, or reset pull requests - Azure Repos (13)

Starting with TFS 2018 Update 2, the PRoverviewPage displays the list of pending policy criteria that the PR is waiting for. If you set a policy as required, in theTurn on auto-completionpanel, you can reset it to optional on theoverviewPage.

ChooseCancel autocompleteto turn off auto-completion.

Complete, cancel, or reset pull requests - Azure Repos (14)

Complete, cancel, or reset pull requests - Azure Repos (15)

A PR set to autocomplete displays aAutocompletebadge on thePull-RequestsPage.

Complete, cancel, or reset pull requests - Azure Repos (16)

Cancel or reactivate a pull request

  • Browser
  • Studio visuals
  • Azure DevOps-CLI

To discard your changes and your PR without merging, selectTo give upfrom the drop-down list on theCompletelyButton. You can still view the canceled PR and it remains associated with work items.

To reactivate a canceled PR at any time, open the PR from theleavingtab in thepull requestview and selectReactivatetop right.

Roll back a completed pull request

Follow these steps to undo changes from a PR. For more information, seeundo changes.

  1. Open the completed PR and selectTo return. This action creates a new branch with changes reverting the PR in an existing target branch in your repo.

  2. ImReset pull requestFeld:

    1. Undertarget branch, select the branch where you want to undo the PR changes.
    2. UnderTopic branch name required, change the name of the Revert-PR branch if you like.
    3. ChooseTo return.
  3. On theNeuer Pull-Requestscreen, selectCreate.

  4. Merge the new PR to complete the restore.

note

The branch created during this reset has a single commit that rolls back all file changes from the original PR. The branch does not contain a reverted commit for any of the commits in the original PR.

Next Steps

Copy changes with Cherry-Pick

(Video) Azure DevOps - Pull Request "VS Code"

Related articles

  • Pull request update notifications
  • About pull requests and permissions

FAQs

How do I cancel a pull request in Azure repository? ›

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. In the Revert pull request pane: Under Target branch, select the branch where you want to undo the PR changes.

Can you delete 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 do I 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 you reset a pull request? ›

Reverting a pull request
  1. Under your repository name, click Pull requests.
  2. In the "Pull Requests" list, click the pull request you'd like to revert.
  3. Near the bottom of the pull request, click Revert. ...
  4. Merge the resulting pull request.

Is it OK to delete pull request? ›

Deleting a branch used for a pull request

You can delete a branch that is associated with a pull request if the pull request has been merged or closed and there are no other open pull requests referencing the branch.

Is it okay to close a pull request? ›

You may choose to close a pull request without merging it into the upstream branch. This can be handy if the changes proposed in the branch are no longer needed, or if another solution has been proposed in another branch.

What is the purpose of a pull request in Azure 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 do I resolve conflict in Azure pull request? ›

In the Branches view of Team Explorer, checkout the target branch. Then right-click the source branch and choose Merge From. Verify the merge options and then click Merge. Visual Studio will notify you if Git halted the merge due to conflicts.

How do I remove changes from a pull request? ›

Now, if you have write permission, you can click on the 'trash' icon for a file right in the pull request's “Files changed” view to make a commit and remove it.

Who should resolve pull request comments? ›

That is, if the last post was a comment or answer, then the recipient (who doesn't otherwise respond) should mark the conversation as resolved (as an acknowledgement of the last post and in lieu of any other response).

How do I override pull request Azure DevOps? ›

With your new-found security, you will also have a section for Policy override options. To proceed and bypass the policies check the Override branch policies and enable merge checkbox, enter your reason for overriding, and click the Override and complete button.

How do I resolve a pull request review? ›

You can resolve a conversation in a pull request if you opened the pull request or if you have write access to the repository where the pull request was opened. To indicate that a conversation on the Files changed tab is complete, click Resolve conversation.

Can I make changes after pull request? ›

In the "Pull Requests" list, click the pull request you'd like to modify. Next to the pull request's title, click Edit. In the base branch drop-down menu, select the base branch you'd like to compare changes against. Read the information about changing the base branch and click Change base.

Can you close and reopen a pull request? ›

You need the rights to reopen pull requests on the repository. The pull request hasn't been merged, just closed. Go to Pull requests add filter `is:closed` choose PR you want to reopen. Select from checkbox and mark as Open.

Is it possible to update a pull request? ›

You can update a pull request with further code changes by pushing commits to the source branch of an open pull request. For more information, see Create a commit in AWS CodeCommit.

How long is too long for a pull request? ›

How can we determine the perfect pull request size? A study of a Cisco Systems programming team revealed that a review of 200-400 LOC over 60 to 90 minutes should yield 70-90% defect discovery. With this number in mind, a good pull request should not have more than 250 lines of code changed.

How do I remove unnecessary Files from a pull request? ›

Here are the steps:
  1. delete file from your remote/origin branch and commit (won't be possible without it)
  2. git stash.
  3. git pull.
  4. git stash pop.

Are pull requests a bottleneck? ›

These pull requests can create bottlenecks because they are more likely to become stale, require rework, or lead to painful merge conflicts. We built a Lead Time Dashboard to help teams uncover which pull requests are causing delays and prioritizing reviews.

What does completing a pull request do? ›

Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

What does completing a pull request mean? ›

In their simplest form, pull requests are a mechanism for a developer to notify team members that they have completed a feature. Once their feature branch is ready, the developer files a pull request via their Bitbucket account.

How do you avoid conflict in a pull request? ›

Pay attention and communicate
  1. creating branches.
  2. creating pull requests.
  3. Avoid allowing pull requests to become stale.
  4. Make sure you're not changing the same lines of code before merging a prior change.
  5. Establish and follow formatting rules.
Jun 14, 2022

What is a pull request for dummies? ›

A pull request – also referred to as a merge request – is an event that takes place in software development when a contributor/developer is ready to begin the process of merging new code changes with the main project repository.

What is difference between pull request and 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.

How do I force a pull request in Azure repos? ›

From the branches list in Azure Repos, click the ellipses next to the desired branch (in this case, develop) and select Branch Policies. You will be taken to a screen with a lot of options. There is one checkbox to require pull requests: From now on code will be entering the branch through a pull request.

How do you resolve a pull conflict? ›

One (simple*) way to handle this without branching or stashing:
  1. stage/commit your changes locally.
  2. pull remote.
  3. at this point you'll be notified of any merge conflicts. ...
  4. commit your merge, push your merge and commits remote master.

How do you handle conflict with Pull Requests? ›

How To Resolve Merge Conflicts In Git Pull Requests?
  1. We will make sure that code on both the branches is updated with the remote. If not, first take pull of both the branches or push your local changes if any.
  2. Switch to the branch you want to merge using git checkout command.
  3. Try to merge locally like this:
Dec 1, 2021

How do I revert changes in Azure Devops? ›

From the commit page, select More actions, and then choose Revert. Confirm that you want to revert. Choose Revert in the dialog. A branch is created with the reverted changes.

How many people should review a PR? ›

In my team, all of the PRs require approval by at least one other developer. Only exception is when the PR is from a junior dev; then it must be reviewed by at least one senior developer.

What happens if a pull request is rejected? ›

Declining a pull request has no impact on the source or destination branches of the pull request. You can continue to comment on a declined pull request, but new changes pushed to the branch no longer update the pull request.

When should you review a pull request? ›

The pull request must be reviewed and approved again before it can be merged. When several open pull requests each have a head branch pointing to the same commit, you won't be able to merge them if one or both have a pending or rejected review.

How do you improve Pull requests? ›

Best Practices for Reviewing Pull Requests in GitHub
  1. Respect People's Time. ...
  2. Always Provide Constructive Feedback. ...
  3. Keep Your Ego Out of Code Reviews. ...
  4. Be Precise About What Needs to be Improved. ...
  5. Don't Just Hope for the Code to Work. ...
  6. Reinforce Code Submission Best Practices. ...
  7. Be Strict About Temporary Code.
Nov 10, 2022

How do you override pipeline variables in Azure DevOps? ›

A variable defined at the stage level will override a variable set at the pipeline root level. A variable set in the pipeline root level will override a variable set in the Pipeline settings UI. You can use variables with expressions to conditionally assign values and further customize pipelines.

How do I undo a pull request approval? ›

In Repositories, choose the name of the repository where you want to edit or delete an approval rule for a pull request. In the navigation pane, choose Pull Requests. Choose the pull request where you want to edit or delete an approval rule. You can only edit and delete approval rules for open pull requests.

How do I edit a pull request in Azure? ›

In the Git menu, select Manage Branches. Right-click a branch and select Create Pull Request. Edit the source and target branches as needed, enter a title and optional description, and select Create.

How do I cancel a git pull? ›

You can use the git reset command to undo a git pull operation. The git reset command resets your repository to a particular point in its history. If you made changes to files before running git pull that you did not commit, those changes will be gone.

Videos

1. Azure DevOps Repos - Pull Requests
(Azure DevOps by RajeshkumarM)
2. Azure DevOps - Pull Request and Release approvals
(Azure DevOps by RajeshkumarM)
3. 5 Azure devOps stage change commits changes and pull requests
(Software Development Engineer in Test)
4. Azure DevOps - Pull Requests & Merging Feature branches
(Shariq Nasir Khan)
5. Azure DevOps Latest Training Videos 2022 Day-5 Azure Repos with Pull Request, Git Bash,Policies
(Vanaja Tutorials)
6. #vstssprints 107 - Cherry pick and revert
(Azure DevOps Sprints)
Top Articles
Latest Posts
Article information

Author: Pres. Carey Rath

Last Updated: 06/03/2023

Views: 6477

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Pres. Carey Rath

Birthday: 1997-03-06

Address: 14955 Ledner Trail, East Rodrickfort, NE 85127-8369

Phone: +18682428114917

Job: National Technology Representative

Hobby: Sand art, Drama, Web surfing, Cycling, Brazilian jiu-jitsu, Leather crafting, Creative writing

Introduction: My name is Pres. Carey Rath, I am a faithful, funny, vast, joyous, lively, brave, glamorous person who loves writing and wants to share my knowledge and understanding with you.