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:
- Abandon the Pull Request (UI Method)
- Delete the Source Branch
- Use the REST API to Delete Pull Requests
Abandon the Pull Request (UI Method)
Steps to Abandon a Pull Request:
- Open your Azure DevOps project.
- Navigate to the Pull Requests section and select the repository.
- Find the pull request you wish to remove and click on it.
- Click the three-dot menu in the top-right corner of the pull request details page.
- 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.
Get in Touch With Us
Submitting the form below will ensure a prompt response from us.