First you need the name of the workspace that is locking your file on the server. To accomplish this you can run the following code in the Visual Studio Command Prompt:
tf workspaces /owner:<developers_logonname> /computer:* /server:<your TFS server>
After you have found your workspace name, you can undo the changes for the file with the following code:
tf undo "$/<Path to file to undo>" /workspace:<Workspace name>;<Domain and username> /s:<your TFS server>
- Your TFS servername must be with http and the portnumber to succeed.
- You can find the path to file simply by clicking the properties on the file in the “Source Control Explorer” window