Wednesday, December 20, 2023

Restoring a Deleted Branch in Azure DevOps

Following a branching strategy is useful to ensure smooth version control and deployments. Based on the nature of the project and other operational considerations, organizations define several branches in their version control systems. However, what if you accidentally deleted an important branch from the version control system? This blog explains how to recover a deleted branch in Azure DevOps

Prerequisites: Azure DevOps project with multiple branches. In this blog, I will use main branch and two branches named releases/1.0.0 and releases/1.0.1

Go to "Branches" section in Azure DevOps. Initially, the branches are displayed as follows. the main branch and two release branches. 


First, I will delete the releases/1.0.0 branch. In the subsequent steps of this blog post, I will explain how to recover it.




Now, there are only two branches available. main and releases/1.0.1



To recover the deleted branch, go to the "All" pipelines section and search for the release by providing the exact release name. otherwise, the branch will not be searchable.

The following image demonstrate that the branch name is not searchable when only part of the release name is provided.



When you provide the exact branch name, the deleted branch name will be listed.




Find the deleted branch and click on restore branch.



The deleted branch will be restored, and you will be able to find the restored branch in branch list.


No comments:

Post a Comment