Delete Command (Team Foundation Version Control)
VSTS | TFS 2018 | TFS 2017 | TFS 2015 | VS 2017 | VS 2015 | VS 2013
Removes files and folders from the Team Foundation version control server and deletes them from the disk.
The results of this command are not visible in other workspaces until you perform a check-in operation. For more information, see Check In Pending Changes.
To use the delete command, you must have the Check out permission set to Allow. If you include the /lock option with a value other than none, you must have the Lock permission set to Allow. Additionally, you must own the workspace or have the global Administer workspaces permission set to Allow. For more information, see Permissions and groups reference.
tf delete [/lock:(none|checkin|checkout)] [/recursive] [/login:username,[password]] itemspec
Identifies the file or folder to delete from the Team Foundation version control server. For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Options.
Note: You can specify more than one Itemspec argument.
Provides a value to the /login option. You can specify a username value as either DOMAIN<em>UserName or UserName.
Prevents other users from checking in or checking out the specified items. For more information, see Understanding Lock Types.
Deletes all files and/or folders and subfolders that match the itemspec from the specified directory.
Specifies the user name and password to authenticate the user with Visual Studio Team Foundation Server.
The delete command records a pending change of type "delete" in your workspace for the items that you have specified. When you commit a pending change of type "delete" to the Team Foundation version control server by using the** checkin** command, Team Foundation removes the item from the Team Foundation version control server but does not delete it permanently. You can locate deleted items in the Team Foundation version control server by using the Dir Command and you can restore deleted items using the Undelete Command.
If you have deleted an item in your workspace but have not checked in the change, you can restore the item to your workspace and remove the deletion from your list of pending changes using the Undo Command.
You cannot delete an item for which another pending change exists. For example, a checked out file cannot be deleted. To delete such items, you must undo the current pending change using the undo command.
When you check in a pending deletion, Team Foundation marks the file as deleted in the Team Foundation version control server. Subsequently running a get of the item from other workspaces (either by you or other users) deletes the item from those workspaces.
When your itemspec specifies a folder, Team Foundation deletes all its files and subfolders and the files they contain, by default.
For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.
The following example deletes 314.cs on disk in the specified local workspace folder and then, when you check in the change, removes 314.c from the version control system non-permanently.
c:\projects>tf delete 314.cs