Abandon a pull request in Azure DevOps, and reactivate it
Abandon closes a pull request without merging it. The source branch stays where it is, the pull request stays linked to its work items, and you can reactivate it later. Below is where to find it and what happens around it, from Microsoft's Complete, abandon, or revert pull requests.
Where Abandon is
On the pull request page, open the arrow next to Complete and choose Abandon. The same menu has Set auto-complete and Mark as draft. There is no Delete in it: Abandon is how you close a pull request you will not merge. Abandoned pull requests are listed under the Abandoned tab of the repository's Pull requests page, and you can still open and read them there.
On Azure DevOps Services, the Azure CLI does the same (it does not support Azure DevOps Server):
az repos pr update --id 21 --status abandoned
With the REST API, on Services and on your own server alike, send the new status to the pull request. The token needs Code (Read & write).
PATCH https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repository}/pullrequests/21?api-version=7.1
{"status": "abandoned"}
On a server, use its own address and the newest api-version it knows: 7.0 on Azure DevOps Server 2022, 6.0 on 2020, 5.0 on 2019 and 4.1 on TFS 2018 (what a server answers to a newer one).
Reactivating
Open the pull request from the Abandoned tab and select Reactivate at the upper right. From the CLI or the REST API, set the status back to active: az repos pr update --id 21 --status active, or {"status": "active"} in the same PATCH.
Reactivating needs both branches. If the source or the target branch was deleted after the pull request was abandoned, Azure DevOps refuses with TF401398 (find which branch is missing). Push the branch again under the same name, then reactivate.
What changes while it is abandoned
An abandoned pull request cannot be voted on, completed or edited; a call that tries answers TF401181 (see who closed it). It also no longer counts as the active pull request for its pair of branches, so you can open a new one from the same source branch into the same target without hitting TF401179 (when it does). The commits stay on the source branch either way.
If you only want to stop reviews for a while, Mark as draft is the softer choice: the pull request stays open, its votes are reset, and Publish brings it back (draft pull requests).
Abandon in IntelliJ IDEA and Rider
Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, lists the pull requests of Azure DevOps Services and Azure DevOps Server in an IDE tool window. Abandon is a button on the pull request, and it asks once before it closes anything ("Abandon pull request !21?"). It is a paid feature with a 30-day free trial; reading stays free. If a colleague abandoned the pull request while you were looking at it, the plugin says who did, makes no change, and reloads the list; reactivate it in the browser.
Get it on JetBrains Marketplace
Azure DevOps is a trademark of Microsoft Corporation; IntelliJ IDEA and Rider are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.
More: merge types · auto-complete · draft pull requests · work items linked to a pull request · 日本語