Get in Touch With Us

Submitting the form below will ensure a prompt response from us.

Azure DevOps allows you to manage pull requests effectively, but it doesn’t provide a direct “delete” option for pull requests. Instead, there are three primary ways to handle this:

  1. Abandon the Pull Request (UI Method)
  2. Delete the Source Branch
  3. Use the REST API to Delete Pull Requests

Abandon the Pull Request (UI Method)

Steps to Abandon a Pull Request:

  1. Open your Azure DevOps project.
  2. Navigate to the Pull Requests section and select the repository.
  3. Find the pull request you wish to remove and click on it.
  4. Click the three-dot menu in the top-right corner of the pull request details page.
  5. Select “Abandon” to remove it from the active list.

Azure DevOps Delete Source Branch

If you want to delete the branch associated with the pull request, follow these steps:

Delete the Remote Branch

To delete the branch remotely, use this Git command:

bash

git push origin --delete

Delete the Local Branch

To remove the branch from your local repository, use:

bash

git branch -d

Delete Pull Request Using REST API

Azure DevOps provides a REST API to automate pull request management. Here’s a simple example to delete a pull request:

  • Use the DELETE HTTP method on the Azure DevOps REST API endpoint for pull requests:

bash

DELETE https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}?api-version=6.0
  • Replace placeholders (organization, project, repositoryId, pullRequestId) with actual values from your Azure DevOps account.
About Author

Jayanti Katariya is the CEO of Moon Technolabs, a fast-growing IT solutions provider, with 18+ years of experience in the industry. Passionate about developing creative apps from a young age, he pursued an engineering degree to further this interest. Under his leadership, Moon Technolabs has helped numerous brands establish their online presence and he has also launched an invoicing software that assists businesses to streamline their financial operations.

Related Q&A