Бөлісу құралы:


Restore a deleted Git branch from the web portal

TFS 2018

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.

Note

There is no retention policy on deleted branches. A deleted Git branch can be restored at any time, regardless of when it was deleted.

  1. Open your repo on the web and select the Branches view.

  2. Search for the exact branch name using the Search all branches box in the upper right.

  3. Click the link to Search for exact match in deleted branches. If there is a deleted branch that matches your search, you will be able to see which commit it pointed to when it was deleted, who deleted it, and when it was deleted.

    Search for exact match in deleted branches in the Azure DevOps Services/TFS web portal

  4. To restore the branch, select the ... icon next to the branch name and then select Restore branch from the menu. The branch will be recreated at the last commit to which it pointed. Note that branch policies and permissions will not be restored.

    Restore your deleted branch in the Azure DevOps Services/TFS web portal

If you've re-used the same branch name for different commits, you may not see all the commits you're expecting when you restore the deleted branch. In that case, navigate to the Pushes page of the restored branch to see the entire history of the branch.

View all pushes for your restored branch

You can navigate to a specific commit, then select New branch from the ... icon. From there, you can use a pull request, cherry-pick, or merge to get the commits back into the desired branch.

New branch from commit