Undelete command (Team Foundation Version Control)
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018
Visual Studio 2019 | Visual Studio 2022
The Team Foundation Version Control (TFVC)
undelete command restores items that were previously deleted.
The results of this command aren't visible in other workspaces until you perform a check-in operation. For more information, see Develop code and manage pending changes.
To use the
- You must have the Check out permission set to Allow.
- If you include the
/lockoption with a value other than
None, you must have the Lock permission set to Allow.
- You must own the workspace or have the global Administer workspaces permission set to Allow.
For more information, see Default TFVC permissions.
tf undelete [/noget] [/lock:(none|checkin|checkout)] [/recursive] <item-specification>[;<deletion-ID>] [/login:<username>,[<password>]]
The following sections describe arguments and options of the
||Identifies the file or folder to restore. For more information about how TFVC parses
||Specifies a unique identifier that disambiguates multiple deleted items that have the same name.|
||Provides a value to the
Restores the deleted item to your workspace. Pending completion of a check-in operation, this option then restores the item on the server but doesn't immediately retrieve a physical copy of the item to disk.
Prevents other users from checking in or checking out the specified files. For more information, see Understand lock types.
None: This option is the default value. No lock is applied.
Checkin: Other users can check out the specified items but they can't check in revisions to locked files until you release the lock by checking in the locked files. If any other users have locked any of the specified items, the lock operation fails.
Checkout: This option prevents other users from checking in or checking out any of the specified items until you release the lock by checking in the locked files. If any other users have locked any of the specified items, the lock operation fails.
Restores all files and subfolders from the specified directory.
Specifies the username and password to authenticate the user with Azure DevOps.
undelete command of the
tf command-line feature schedules specified files or folders for restoration pending the completion of a check-in operation. It also retrieves the specified items from the server to the local disk unless you explicitly include the
When files or folders that have the same name have been deleted from the same server folder, you must include a value for the
<deletion-ID> parameter to indicate which of the deleted items you want to restore. You can obtain a
<deletion-ID> by using the
If you want to change a file after restoring it, check out the file for editing by using the
checkout command as usual.
<item-specification> value specifies a folder, TFVC restores by default all the folder's files and subfolders and the files that they contain. If you don't want to restore all the items in a folder, you must first undelete the folder and its items and then delete the items that you don't want to keep.
For more information about how to use the
tf command-line utility, see Use Team Foundation version control commands.
The following example restores 314.cs to the server folder that 314.cs was deleted from. The command also retrieves a read-only copy of the latest version in the current workspace.
C:\projects>tf undelete c:\math\314.cs
The following example displays deletion IDs for all items on the server that have been deleted more than one time:
c:\projects>tf dir $/ /deleted
Output from the previous command might look like the following sample:
The following example restores the X11 version of 314.cs to the server folder that the file was deleted from. The command also retrieves a read-only copy of the latest version in the current workspace.
c:\projects>tf undelete 314.cs;X11
Submit and view feedback for