Get Command

Retrieves a read-only copy of a file from the server for Team Foundation version control to the workspace and creates folders on disk to contain it.

Required Permissions

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] [/login:username,[password]]





File or folder to retrieve. If no itemspec is provided, Team Foundation Server performs a recursive get operation on all items that are mapped in the current workspace.

You can specify more than one Itemspec argument.


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 (Version Control).


Provides a value to the /login option. You can specify a username value as either DOMAIN\UserName or UserName.




Optional version specification. The versionspec is the version of the item you want to retrieve. You can specify a version by:

  • Date/time (D2008-01-21T16:00)

  • Changeset version (C1256)

  • Label (Lmylabel)

  • Latest version (T)

  • Workspace version (Wworkspacename;owner)

  • If no version is provided, Team Foundation Server retrieves the latest server version of the specified itemspec into your workspace.


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.


Suppresses any dialog boxes that would otherwise be displayed during this operation.


Updates local mapping on the server and re-downloads the file faster if you already have downloaded the same file from another branch.

This option is best used when you do not have a complex local mapping and you must frequently switch between branches.


Specifies the user name and password to authenticate the user with Team Foundation Server.


The get command retrieves items from the server into a workspace. If no other version is provided, the latest server version is retrieved.

If you work in a team development environment, get is the command you use most frequently because getting every file in the current project synchronizes with your team and makes sure that you have the very latest copy of shared work. The get command does not overwrite files that you have checked out in the local directory. The more frequently you perform the get command in a collaborative working environment, the more current the local files are with that of your team. That is because a get operation populates the local workspace with changes that have been checked into the server by your teammates. If you keep your workspace up-to-date by performing a get operation whenever you see a check-in notification (from project alerts, for example), you can quickly resolve differences between your version of a project and the server version of the project. You can avoid making changes that might not be easy to reconcile with the server when you check in your pending changes.

During a get operation, if your workspace version is the same as the requested server version, Team Foundation Server does not replace the file on disk unless the /all option is specified. You can use the /overwrite option to forcibly overwrite the writable current workspace version with a specified server version in order to restore your workspace to a consistent state when it becomes unmanageable, such as sometimes occurs when you delete or accidentally overwrite multiple files on disk. When you pass the /force option, Team Foundation Server overwrites all checked out items in the workspace with the latest server version unless you provide a specific version.

When you perform a get operation, Team Foundation Server deletes any checked-in files from the local workspace that have been deleted from the server after the last time that you synchronized your workspace to the server version. Files that have been renamed or moved on the server are relocated on disk to match the changes on the server.

You can use the /preview option to issue the get command without making updates to the local workspace in order to see what would occur if you were to perform an actual get operation.

Checkout operation does not perform a get latest operation on files being checked out

As a developer working in a workspace, you are isolated from the changes that were made by other developers. You control when you accept changes from other developers by performing a get operation as appropriate. Ideally, you can update the complete configuration of version-controlled files and not just one or two files because changes in one file typically depend on corresponding changes to other files. You must make sure that you have a consistent snapshot of the version-controlled files that can be built and tested.

Therefore the check-out operation does not perform a get latest on the files checked out. Updating one file being checked out would violate the consistent snapshot and could give you a configuration of version-controlled files that cannot be built or tested. Alternatively Team Foundation Server forces you to perform the get latest operation at some point before you check-in your changes so that when you try to check-in your changes, and you do not have the latest copy, you are prompted with the resolve conflicts dialog box.

You can also configure Team Foundation Server to automatically get latest on check-out. For more information, see Configure Check-Out Settings.

For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.

The Get Process

When you issue a get command for an item from the server and that is already checked out in your workspace and the server version has changed, you are prompted to resolve file conflicts between the workspace and the retrieved server version. For more information, see the Resolve Command.


The following example retrieves the latest version of 314.cs from the server. If you have pending changes against 314.cs, Team Foundation Server initiates the Resolve process that helps you decide how to handle 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.

C:\projects>tf get

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

See Also


Cloak and Uncloak Folders in a Workspace


Resolve Command

Merge Command

Checkout and Edit Commands

Checkin Command

Unshelve Command

Workfold Command

Other Resources

Tf Command-Line Utility Commands

Get the Source for Your Team Project