แก้ไข

Delete a Git branch

Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022

Visual Studio 2019 | Visual Studio 2022

This article describes how to delete a Git branch by using two different methods: in Visual Studio and from the command line.

Note

Deleting a branch in your local repo doesn't remove the branch on the remote.

Prerequisites

Category Requirements
Project access Member of a project.
Permissions - View code in private projects: At least Basic access.
- Clone or contribute to code in private projects: Member of the Contributors security group or corresponding permissions in the project.
- Set branch or repository permissions: Manage permissions for the branch or repository.
- Set branch policies, status checks, or change the default branch: Edit policies permission for the repository or branch, or membership in the Project Administrators security group.
- Import a repository: Member of the Project Administrators security group or Git project-level Create repository permission set to Allow. For more information, see Set Git repository permissions.
Services Repos enabled.
Tools Optional. Use az repos commands: Azure DevOps CLI.
Category Requirements
Project access Member of a project.
Permissions - View code: At least Basic access.
- Clone or contribute to code: Member of the Contributors security group or corresponding permissions in the project.
Services Repos enabled.

Delete branch

  1. View your repo's branches by selecting Repos > Branches while viewing your repo on the web.

    Screenshot that shows how to access your branches.

  2. Select the More options button at the end of the row of the branch you want to delete.

    Screenshot that shows how to access the menu to delete a branch.

  3. In the options menu, select Delete branch.

  4. In the Delete branch dialog box, select Delete.

Next steps