Lesstep
Azure DevOps Services · Azure DevOps Server · Pull requests · November 2, 2026

Azure DevOps did not delete the source branch after completing

Azure DevOps deletes a pull request's source branch on completion only when it is asked to. Deleting it then follows the same rules as deleting any branch on Azure DevOps. When the branch is still there, it is usually one of these: the option was off, the Force push permission on that branch is missing, the branch has required policies, it is the default branch or is locked, or it is gone from Azure DevOps and only your local Git still lists it. Below is from Microsoft's Complete, abandon, or revert pull requests, Delete a Git branch and Branch permissions.

Asking for it at completion

PATCH https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests/21?api-version=7.1
{
  "status": "completed",
  "lastMergeSourceCommit": { "commitId": "<head of the source branch you reviewed>" },
  "completionOptions": { "deleteSourceBranch": true, "mergeStrategy": "squash" }
}

If the source branch got new commits after that head was read, Azure DevOps refuses the completion with TF401192 and nothing is merged or deleted.

What keeps a branch from being deleted

Microsoft's Delete a Git branch lists what a remote branch needs before it can be deleted, "whether you delete the remote branch in the web portal, Visual Studio, or from the command line":

What to check

  1. Is it gone from Azure DevOps? Look at Repos > Branches. If it is gone there, your Git only keeps a remote-tracking copy: git fetch --prune removes copies of branches that no longer exist on the server.
  2. Was the option on? The completed pull request's completionOptions in the REST API shows what it was completed with.
  3. The four conditions above: Microsoft's advice when Delete branch is not offered is to check your effective Force push permission and that the branch has no required policies, is not the default branch and is not locked.
  4. To delete it by hand: the branch's More options > Delete branch on Repos > Branches, or git push origin --delete feature/login, by someone who has Force push on it.

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. Its Complete dialog has Delete {branch} after merging, starting from a setting you choose once (Delete source branch after completing), and it sends deleteSourceBranch with every completion and with auto-complete, so the choice is never left to a default. It completes with the source commit it showed you, so new commits are not merged unseen. The four conditions above still decide whether Azure DevOps can delete the branch. Completing is a paid feature with a 30-day free trial; the review inbox, diffs and branch policies stay free.

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 · TF402455 · the same on Bitbucket · 日本語