Accidentally deleted branch from TFS – Undelete and Rollback not available

branchtfsvisual-studio-2015

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

enter image description here

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?

Best Answer

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).

If you delete this branch in Visual Studio,

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.

If you delete this branch from your dev machine outside of Visual Studio,

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.

Related Topic