89

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

Salman
  • 1,573
  • 3
  • 13
  • 24

4 Answers4

117

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).
Foo Bar
  • 328
  • 3
  • 20
Jayendran
  • 9,638
  • 8
  • 60
  • 103
  • 1
    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. – Talon Jun 21 '23 at 12:24
3

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.

Aswathi PS
  • 39
  • 1
3

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

Andy
  • 773
  • 2
  • 6
  • 22
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)
Liran H
  • 9,143
  • 7
  • 39
  • 52
  • 2
    Could you elaborate what you mean by _Adding a link_ ? Is this specific to Devops ? – Arthur Attout Jan 08 '20 at 09:10
  • @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. – Liran H Jan 08 '20 at 13:41