TFS: Restore deleted folders and items

有些话、适合烂在心里 提交于 2019-11-28 07:54:11

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

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.

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:

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!