How do I recover a deleted file in Visual Studio?
In Visual Studio, a solution is loaded, a file is changed and checked in e.g. Form1.cs, change is then undone using the 'undo' command, outgoing change set is now empty - how do I recover the deleted contents? In general how do I see the check-in history of the current active change set, showing check-in's undo's etc?
2 answers
Check-in history of a change set works only in the context of history on a file. In your use case, although the change set maintains the check-in history of the file state that was deleted by "scm undo", you are not able to view it since the change set no longer appears in the history of the file.
If you make any change to the same file and check-in again to the same change set, it will start appearing in the file's history, and then you can also view the content that was deleted earlier in the check-in history of the change set.
In order to see an "undone" change in the history view of a file:
- In the history view:
- click the View-menu tool button (the downward triangle on the right side of the tool button bar that is at the top of the history view), and select "Preferences" (it really should be "Preferences ..." :-). Then select the bottom radio button for "Include change sets with matching intermediate states when showing all in repository".
- click the "Show all in repository" tool button.
Note: This is for changes that were "undone" from a change set. It will not show you unresolved changes in the sandbox that were undone, because those changes never made it into a change set.
Note: This is in the Eclipse client ... someone needs to verify this is also available in the Visual Studio client.
- In the history view:
- click the View-menu tool button (the downward triangle on the right side of the tool button bar that is at the top of the history view), and select "Preferences" (it really should be "Preferences ..." :-). Then select the bottom radio button for "Include change sets with matching intermediate states when showing all in repository".
- click the "Show all in repository" tool button.
Note: This is for changes that were "undone" from a change set. It will not show you unresolved changes in the sandbox that were undone, because those changes never made it into a change set.
Note: This is in the Eclipse client ... someone needs to verify this is also available in the Visual Studio client.
Comments
Lily Wang
Dec 15 '14, 4:10 a.m.I don't think it's possible to restore the change deleted by "scm undo".