Some of my feature/user branches got deleted by someone in VSO as part of repository cleanup by mistakenly.
IS there a way to retain what branches deleted by whom and also is there any way to retain the deleted branch from vso git repository
Some of my feature/user branches got deleted by someone in VSO as part of repository cleanup by mistakenly.
IS there a way to retain what branches deleted by whom and also is there any way to retain the deleted branch from vso git repository
Yes, you can restore the deleted branches and find who and when deleted the branches in VSTS.
First, you should get the deleted branch names so that you can restore them in VSTS.
In your local repo (hasn't used git fetch
after the branches deleted), use git branch -r
, it will list all the remote branches. Then you can compare with the branches listed in VSTS, the branches show in local repo but not show in VSTS are the deleted branches.
Then get the deleted branches’ info and restore them.
To restore a deleted branch (such as stage
branch), you can follow below steps:
In VSTS Code Tab -> branches (https://account.visualstudio.com/project/_git/repo/branches) -> search a deleted branch by name (such as stage) -> Then there will show No branches match the filter: stage
-> open the link Search for exact in deleted branches -> it will list the extact match deleted branch and the detail information -> restore branch by clicking …
button.
And you can also refer the document Restore a deleted Git branch from the web portal.
Besides, you can also restore the deleted branches in local repo ((hasn't executed git fetch
after the branches deleted) by:
git checkout <a deleted branch in remote>
git push -u origin branchname