Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022 | Azure DevOps Server 2020
This article addresses how to restore a deleted Git branch using the web portal in Azure Repos. If you need to restore a Git branch in your own repo from Visual Studio or the command line, push your branch from your local repo to Azure Repos to restore it.
Prerequisites
Note
There's no retention policy on deleted branches. You can restore a deleted Git branch at any time, regardless of when it was deleted.
Restore branch
Open your repo on the web and select the Branches view.
Search for the exact branch name using the Search all branches box in the upper right.
Select the link to Search for exact match in deleted branches. If there's a deleted branch that matches your search, you can find which commit it pointed to when upon deletion, who deleted it, and when.

To restore the branch, select the ... icon next to the branch name and then select Restore branch from the menu. The branch gets recreated at the last commit to which it pointed. Branch policies and permissions do not get restored.

If you reused the same branch name for different commits, you might not see all the commits you're expecting when you restore the deleted branch. In that case, go to the Pushes page of the restored branch to see the entire history of the branch.