Get Command
Gets (downloads) either the latest version or a specified version of one or more files or folders from Team Foundation Server to the workspace. Although the Get command provides a different user interface than Visual Studio (see Download (get) files from the Server), the process is fundamentally the same.
Requirements: See Team Foundation Server Permissions.
tf get [itemspec] [/version:versionspec] [/all] [/overwrite] [/force] [/remap] [/recursive] [/preview] [/noautoresolve] [/noprompt] [/login:username,[password]]
Parameter |
Description |
---|---|
/all |
If you use a local workspace (recommended), then it‘s unlikely you will have to use this option. You can use this option to restore an item that you have accidentally deleted from a server workspace. Your Team Foundation Server maintains an internal record of all the items the workspace contains, including the version of each. By default, when you get files, if the internal record on the server indicates the workspace already has the version you are getting, then it does not retrieve the item. This option gets the items regardless of the data contained in this internal record. |
/force |
Combines /all and /overwrite. |
itemspec |
Specifies the scope of the items to get. You can specify more than one itemspec argument. If no itemspec is provided, the system recursively gets all items in the current workspace. For syntax, see Team Foundation Version Control Command Reference. |
/login:username,[password] |
Specifies the user account to run the command. See Team Foundation Version Control Command Reference. |
/noautoresolve |
By default, the system automatically attempts to AutoResolve All (see Resolve File Conflicts). Specify this option to disable this default behavior. |
/noprompt |
Suppresses the display of windows and dialog boxes and redirects output data to the command prompt. See Team Foundation Version Control Command Reference. |
/overwrite |
If you use a local workspace (recommended), then it is unlikely you will have to use this option. By default, the system does not retrieve an item if it is writable (that is, if its read-only attribute is cleared) on the client machine. This option overrides the default behavior and overwrites a writable item, unless the item is checked out. |
/preview |
Displays what would occur, without actually performing the Get operation. |
/recursive |
Recursively gets items in the specified directory and any subdirectories. If you do not specify an itemspec, then this option is implied. |
/remap |
|
/version:versionspec |
Specifies the maximum version, or the minimum and the maximum versions, to display in the history data. The default is /version:T (the latest version). For syntax, see Team Foundation Version Control Command Reference. |
In all the following examples, assume that $/SiteApp/Main/ is mapped to c:\code\SiteApp\Main\ in the workspace.
c:\code\SiteApp\Main>tf get /v:15
Synchronizes the workspace to match the codebase as it existed when changeset 15 was created:
-
The name and content of every item in the workspace is changed to match the state it was in on the server.
-
Items that were deleted after that changeset are restored to the workspace.
-
Items that were added after that changeset are deleted from the workspace.
c:\code\SiteApp\Main>tf get /v:LLastKnownGood
Synchronizes the workspace to match the items in the codebase that are labeled LastKnownGood:
-
The name and content of every labeled item in the workspace is changed to match the state it was in on the server.
-
Labeled items that were deleted are restored to the workspace.
-
Items that are not labeled on the server are deleted from the workspace.
-
If you are beginning a new task, it’s probably a good idea for you to run tf get (you can do so from any directory in your workspace) to download the latest files from the server before you check out files and begin your work.
-
As needed, this command creates folders on disk to contain the child items that the command is downloading.
-
You can view information about the history of an item using the History Command and the Changeset Command.
-
If you are concerned about what changes might occur to the files in the workspace, you can use the /preview option to see the changes that would occur without actually implementing them.
-
Conflicts could block your get. A typical cause of conflicts is trying to get an item on which you have pending changes. You can use the Resolve Command to resolve these conflicts.