How can I get my changes back after clicking “Undo pending changes…” in Visual Studio 2013 and TFS

后端 未结 4 1948
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 09:11

Using Visual Studio 2013 and TFS I did a lot of work before checking in. Then I accidentally clicked undo pending changes... thinking it would only apply to one of the proje

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 10:05

    Unbelievable! After giving up and rewriting all of the code I lost, I was able to recover the files. After pressing "Undo pending changes" I never built the solution again. Then, I closed the solution, copied the entire workspace and saved it under a different name. Next, I reopened the original solution. I then used "Add existing item" from the original locations of the files I lost. Then, (and here's the cool part) I navigated to the copied workspace and found the lost files in-tact and in their original locations. Great! I only wish I did this before I rewrote my code!

    For me, this solution was found purely by happenstance, but I hope someone else can use this information in the future. Please note that I never built the solution after I undid the changes so that may be the reason why the files were still in their original locations but not visible in the solution itself.

提交回复
热议问题