What if you need to undelete a file or bunch of files that at some point have been deleted from TFS? Naive option would be to get the content of the file, copy it, create a new file, and paste the copied content to just created file. Of course, this is not a good option because history of changes to the file(s) will be lost.

Solution

Go to Source Control window and locate the file(s) that need restoring. If you can’t see deleted items, go to Tools > Options > Source Control > Visual Studio Team Foundation Server and check ‘Show deleted items in the Source Control Explorer’ (see the screenshot below). This way, in Source Control explorer you should be able to locate both existing and deleted items.

Now, in Source Control window, right click the item(s) you want to restore and select Undelete. The file(s) will be marked with undelete chage in Pending Changes window. All you need to do now is to check in the change. Complete history of changes to the restored files will be saved.