简体   繁体   中英

How to change branch name in Azure DevOps

Is there a way to change branch name in Azure DevOps. As shown in SS i have named my branch as Developer branch, now i want to change it to a specific request-id. Is this possible.

分支机构

Unfortunately, you are not able to rename a branch. However, you can create a new branch from the branch which you want to rename then you can delete that branch.

As per the design, the rename of azure repo branches is not implemented. You can see this existing similar thread

Microsoft's documentation page "Rename old branches" gives the following instructions:

  1. open repo > Branches view.
  2. locate the old branch.
  3. hover over the old branch > ...(More) icon > + New Branch.
  4. enter the new branch name > Create branch.
  5. hover over the old branch > trash icon (Delete branch).

You can do this by following these steps:

  • Rename the branch using git from X to Y
  • In Azure:
    • Delete the linked branch (X)
    • Add a link to your new branch (Y)

Unfortunately, you will not be able to rename a branch. However, you can create a new branch from the branch which you want to rename then you can delete that branch.

Ref link: https://docs.microsoft.com/en-us/azure/devops/repos/git/require-branch-folders?view=azure-devops&tabs=browser&viewFallbackFrom=vsts#rename-old-branches

Steps:

  1. open repo > Branches view.
  2. locate the old branch.
  3. hover over the old branch > ...(More) icon > + New Branch.
  4. enter the new branch name > Create branch.
  5. hover over the old branch > trash icon (Delete branch).

Best way to do is, create a new branch from the original branch, give the new name to it and then delete the original branch.

For example: Rename Branch A to B

  1. Create New branch From A (Based on A)
  2. Enter the New branch Name as B
  3. Delete the branch A.

Note: If you are following this steps, you will have the full history of the branch and also you can rename the branch. You will not have the history of the branch if you are deleting the branch and then creating the new branch.

There is no direct way to delete the branch in azure DevOps but the alternate is to delete the branch and rename it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM