How to undo a pending change in a workspace you no longer have
Not that it’s a huge deal to have stale workspaces lying around, but if you’ve ever wondered how to undo a pending change on a workspace you no longer have (e.g. if you repaved your computer to install Windows 7 and didn’t delete your TFS workspaces first), here’s how to do it:
1. Fire up the Visual Studio command prompt (Start –> Visual Studio –> Visual Studio Tools, Visual Studio Command Prompt)
2. If you have a valid workspace against the server of interest, change into that directory.
3. Run the following tf.exe command:
tf undo /workspace:OLDWORKSPACENAME <filespec…>
For example:
tf undo /workspace:VistaLaptop $/Spark/WidgetBox/ /r
In this example, the name of the old workspace I’m trying to undo changes from is “VistaLaptop”. The filespec for the changes I’m undoing is “$/Spark/WidgetBox”, which is a folder name. To undo all the changes I had pending against that tree, I added the “/r” (recursive) switch.
If you don’t have a valid workspace against that server anymore, you can just add the /server switch to specify the server name or URL.
Comments
- Anonymous
August 10, 2009
You could also do the undo from the result screen of the "Find by status" power toy, directly inside of Visual Studio.