Share via


Undo Command

Removes pending changes from a workspace.

tf undo [/workspace:workspacename[;workspaceowner]] 
[/server:servername] [/recursive] itemspec [/noprompt]

Parameters

Argument Description

workspacename

The user-provided value for the /workspace option.

workspaceowner

Specifies the name of the user who created the workspace.

servername

The user-provided value for the /server option. Example: teamfoundation2.

itemspec

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.

Option Description

/workspace

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.

/server

Identifies the Team Foundation Server. This option is required if the command is invoked from a directory that is not mapped to a workspace.

/recursive

Recursively undo changes according to the itemspec.

/noprompt

Suppresses any prompts for input from you.

Remarks

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 source 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.

Examples

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

Security

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.

See Also

Reference

Command-Line Syntax
Shelve Command
Undelete Command
Command-Line Options

Concepts

Pending Changes

Other Resources

Tf Command-Line Utility Commands