Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS: Restore deleted folders and items

Tags:

tfs

I deleted some files and some folders in TFS. Many check in's later I found out that I need the deleted functionality back in my project.

How can I restore the deleted files and folders?

like image 776
hwcverwe Avatar asked May 07 '12 09:05

hwcverwe


People also ask

How do I undo a delete in Visual Studio?

So, Right click on deleted files and select-> Restore option then your deleted files will be automatically restored in your VS code.

Does team save deleted?

Any member of the Teams channel can recover content from the SharePoint bin. Any other member of the same SharePoint file will have the same view. This means you can recover files deleted by other users – and they can recover files you've deleted.


2 Answers

In Team Explorer (in Visual Studio): Tools | Options | Source Control | Visual Studio Team Foundation Server and select Show Deleted Items...

Then in source control explorer you'll see the items greyed out. You can right click on them and Undelete. (This option will only be available if they, after the undelete, will be included in your current workspace).

NB. in newer versions of Visual Studio (eg. 2013) there is now a button to switch on display of deleted items in the Source Control Explorer's toolbar. Its the second button (here with the VS dark theme):

enter image description here

Alternatively using the TFS PowerToys you can look at history and right click to select "Rollback Entire Changeset": this will create pending changes to revert the changes of the selected changeset.

Edit: Added paragraph on newer versions of VS.

like image 186
Richard Avatar answered Sep 21 '22 21:09

Richard


Assuming you successfully undelete as per @Richard's answer, there might still be an issue with the item appearing in Solution Explorer (at least it was for me using Visual Studio 2015). That is to say, the file is restored on your hard drive, in the proper place in your project's folder structure--but it's not showing in VS.

To resolve this, click the Show All Files button in Solution Explorer:

enter image description here

You will see your file, in a ghostly white icon. Right-click on it and select "Include in project". Save and check-in changes. You are back in business.

like image 26
BCA Avatar answered Sep 18 '22 21:09

BCA