How to change branch name in Azure DevOps
Asked Answered
W

5

106

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.

branches

Wirth answered 22/11, 2018 at 14:18 Comment(0)
M
142

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).
Magen answered 22/11, 2018 at 15:0 Comment(2)
Just be aware that this method just creates a copy of the repo with a new name. That means the date of the branch will change too. So if you are trying to correct historic names, it may cause some confusion.Senhorita
@Senhorita I think you mean copy of the branch... not repo?Warga
P
6

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.

Pilpul answered 15/6, 2022 at 12:8 Comment(0)
M
2

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

Monkfish answered 3/8, 2022 at 6:55 Comment(0)
D
0

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)
De answered 23/5, 2019 at 7:52 Comment(2)
Could you elaborate what you mean by Adding a link ? Is this specific to Devops ?Glomerate
@ArthurAttout yes, In Azure DevOps, inside a ticket (e.g. task, bugfix, etc.), on the right, under Development, you have a textual button named "+ Add link". Click on it and you'll be able to link your ticket to a git branch.De
C
0

You can cut a new branch with the desired name from existing one. then create a PR from existing one to newly created, by opting delete after merge functionality.

Caryloncaryn answered 28/9, 2023 at 4:57 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.