I'm using Visual Studio 2015 and have deleted a branch from our TFS source control. Looking at other guides there's mention of being able to recover the branch by opening Source Control Explorer, right-click and select 'Undelete' or 'Rollback'. These options are not available
I have not got this branch mapped on any workspace. Clicking on 'Undo Pending Changes...' brings up a message saying there are no pending changes. How can I restore a branch on TFS? Is there a way I can enable Undelete or Rollback?
A deleted Git branch can be restored at any time, regardless of when it was deleted. 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. Click the link to Search for exact match in deleted branches.
Restore an item deleted from the serverFrom the menu bar choose Tools, Options. On the Options dialog box, navigate to Source Control, Visual Studio Team Foundation Server. Select Show deleted items in the Source Control Explorer, and then choose OK.
What work is restored when the deleted branch is recovered? The files which were stashed and saved in the stash index list will be recovered back. Any untracked files will be lost. Also, it is a good idea to always stage and commit your work or stash them.
First, please make sure you or your teammates haven't destroyed this branch (After doing this, there is no way to recover it in TFS server).
To restore an item deleted from the server
From the menu bar choose Tools, Options.
On the Options dialog box, navigate to Source Control, Visual Studio Team Foundation Server.
Select Show deleted items in the Source Control Explorer, and then choose OK.
From the menu bar choose View, Other Windows, Source Control Explorer.
In Source Control Explorer, navigate to the folder that contains the item you want to restore.
Open the item’s context menu (select the item and right-click it) and then choose Undelete.
Please check the solution from MSDN link Delete or restore files and folders
Morever, you can also try to use the undelete command restores items that were previously deleted. For Example:
tf undelete [/noget] [/lock:(none|checkin|checkout)]
[/recursive] itemspec[;deletionID] [/login:username,[password]]
Update:
Note: To be able to undelete a branch you must first map the parent folder/branch to your workspace. Now, the undelete option will be enable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With