Removes pending changes from a workspace.
To use the undo command, you must be the owner of the specified workspace or have the global Administer workspaces permission set to Allow. For more information, see Team Foundation Server Permissions.
tf undo [/workspace:workspacename[;workspaceowner]] [/recursive] itemspec [/noprompt] [/login:username, [password]] [/collection:TeamProjectCollectionUrl]
The user-provided value for the /workspace option.
Specifies the name of the user who created the workspace.
The URL of the team project collection that contains files from which you want to remove pending changes (for example, http://myserver:8080/tfs/DefaultCollection).
Identifies the file or folder from which to remove pending changes. For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Options.
You can specify more than one Itemspec argument.
Provides a value to the /login option. You can specify a username value as either DOMAIN\UserName or UserName.
Specifies the name of the workspace in which you want to undo pending changes. If this option is not specified and you are running the command from a directory that has been added to a workspace, the current workspace is used.
Recursively undo changes according to the itemspec.
Suppresses any prompts for input from you.
Specifies the team project collection.
Specifies the user name and password to authenticate the user with Team Foundation Server.
The undo command checks to see whether files that have pending edits being undone have been modified on disk. If modifications are detected, the undo command without /noprompt displays a prompt asking whether to continue with undoing the changes. You may respond with Yes, No, or All.
The undo command returns all checked-out files to a read-only, unmodified state. It discards all pending changes to files and folders and restores the items to the Team Foundation version control server version.
The undo command removes check-in and check-out locks so that other users can check out the file and make pending changes against it in their own workspaces.
If you use the undo command to undo a pending change on another user's computer, you must perform a get operation in that workspace to update the local disk. Not only must get be run, but you may have to run get /all for the files that were undone in order to download the correct content for files that were being edited.
For more information about how to obtain a list of pending changes in a workspace, see Status Command.
For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.
The following example removes all pending changes against 314.cs in the current workspace.
c:\projects>tf undo 314.cs
The following example removes all pending changes in the c:\projects folder and all its subfolders.
c:\projects>tf undo /recursive c:\projects
The following removes the pending change for the specified file in Ivan's WS_Juan workspace.
c:\projects>tf undo /workspace:WS_Juan;Ivan $/math/271.cs