Retrieves a read-only copy of a file from the Team Foundation server to the workspace and creates folders on disk to contain it.
To use the get command, you must have the Read permission set to Allow for every retrieved item and you must either own the destination workspace or have the global Administer workspaces permission. For more information, see Team Foundation Server Permissions.
tf get itemspec [/version:versionspec] [/all] [/overwrite] [/force] [/preview] [/recursive] [/remap] [/noprompt]
File or folder to retrieve. If no itemspec is provided, Team Foundation Server performs a recursive get operation of the current workspace.
The user-provided value for the /version option. For more information about how Team Foundation Server parses a version specification to determine which items are within its scope, see Command-Line Syntax (Team System).
Optional version specification. The versionspec is the version of the item you want to retrieve. You can specify a version by:
Forces all files to be retrieved, not just those that are out-of-date.
Overwrites writable files that are not checked out.
Combines /all and /overwrite.
Displays what would occur, without actually performing the Get operation.
Recursively retrieves all items that match your itemspec.
For use only with the Service Pack 1 version of Microsoft Visual Studio Team System 2008 Team Foundation Server.
Updates the database references of the local remapped branch for all items where the content on the local disk is the same as the content you are downloading from the version control branch.
Suppresses any dialog boxes that would otherwise be displayed during this operation.
The get command retrieves items from the server into a workspace. If no version is specified, the latest server version is retrieved. When you perform a get operation, Team Foundation Server deletes from the server any files that were locally marked for deletion and that were checked in since the last time that you synchronized your workspace to the server. Files that have been renamed or moved on the server are relocated on disk to match the changes that were made to the server. Files that have been renamed or moved on the server are also moved in the local workspace to match the changes that were made to the server.
The get command does not overwrite files that you have checked out in the local workspace directory. When you issue a get command for an item that is already checked out in your workspace and the server version has changed, you are prompted to resolve file conflicts between the workspaceand the server version. For more information, see the Resolve Command.
Use the /all option if your workspace version is the same as the requested server version and you want to replace the file on disk.
Use the /overwrite option to forcibly overwrite the writable current workspace version with a specified server version.
Use the /force option, to overwrite all checked out items in the workspace with the latest server version. You can also use the /force option to overwrite a specific version.
Use the /preview option to view what changes will occur during the next get operation.
Use the get command frequently to keep your workspace up-to-date so that you can quickly resolve differences between your version of a project and the server version of the project.
For information about how to find the tf command-line utility, see Tf Command-Line Utility Commands.
Using Get with the /remap option
The /remap option saves download time when you remap a local folder to a new or different branch. For example:
You map $/branch1 to D:\branch on your computer.
You run tf get to get a copy of all the items from $/branch1 to the local folder.
You change the mapping of $/branch1, and then map $/branch2 to the local folder previously mapped as $/branch1 (D:\branch).
You run tf get with the /remap option to only download the content in $/branch2 that differs from content in $/branch1 on the local folder (D:\branch).
This feature is only available if you have installed the Service Pack 1 version of Microsoft Visual Studio Team System 2008 Team Foundation Server.
The following example retrieves the latest version of 314.cs from the server. If you have pending changes against 314.cs, Team Foundation Server prompts you to resolve any conflicts.
C:\projects>tf get 314.cs
The following example retrieves version 8 of 1256.cs from the server.
Using 1256.cs;8 is equivalent to using 1256.cs;C8. By default, the changeset version is used if you specify only a number after the semicolon.
C:\>tf get 1256.cs;8
The following example retrieves the latest versions of all uncloaked items from the server folder and subfolders to the C:\projects directory and creates local folders where they are required. For more information about how to cloak and uncloak folders, see Workfold Command.
The following examples provide alternative ways of retrieving the version of 1256.cs that was checked in with changeset 1999.
c:\projects>tf get /version:C1999 1256.cs
c:\projects>tf get 1256.cs;C1999
The following example retrieves the version of all uncloaked items from the server as they existed in the server when changeset 271 was created.
c:\projects>tf get /version:C271
The following example retrieves build42, labeled as "build42." This matches your workspace to the label as long as there are no pending changes. Any files not in the label are removed from the local disk.
c:\projects>tf get /version:Lbuild42
The following example retrieves the version on the server from a specific date and time.
c:\projects>tf get /version:D2008-01-21T16:00