码迷,mamicode.com
首页 > Web开发 > 详细

[TFS教程]TFS: Get Command

时间:2016-01-21 10:28:59      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:

Get Command

Visual Studio 2012
 

 

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]]

Parameters

 
 

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

See phkelley‘s blog: tf get /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.

Examples

 

In all the following examples, assume that $/SiteApp/Main/ is mapped to c:\code\SiteApp\Main\ in the workspace.

Get the latest version of all items in a workspace

 
 
 
c:\code\SiteApp\Main\SolutionA>tf get

Gets the latest versions of all items in the workspace. For example, the above command would recursively get all files in $/SiteApp/Main/ including all its child folders.

Recursively get the latest version of items of a certain type in a folder

 
 
 
c:\code\SiteApp\Main\SolutionA\Project1>tf get *.cs /recursive

Gets the latest version of all C# (.cs) files in c:\code\SiteApp\Main\SolutionA\Project1.

Get the latest version of a file

 
 
 
c:\code\SiteApp\Main\SolutionA\Project1>tf get program.cs

Gets the latest version of program.cs in Project1.

Get a specific version of a file

 
 
 
c:\code\SiteApp\Main\SolutionA\Project1>tf get program.cs;8

Gets version 8 of program.cs in Project1.

Get the latest version of two files

 
 
 
c:\code\SiteApp\Main\SolutionA\Project1>tf get file1.cs file2.cs

Gets the latest version of file1.cs and file2.cs in Project1.

Synchronize a workspace to match a version of the team’s codebase

 
 
 
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.

Synchronize a workspace to match a labeled version of the team’s codebase

 
 
 
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.

Work in Visual Studio

 

Tips

 
  • 技术分享 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.

[TFS教程]TFS: Get Command

标签:

原文地址:http://www.cnblogs.com/Alenliu/p/5147184.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!