zoukankan      html  css  js  c++  java
  • Visual Studio Team System Get Command

    Visual Studio Team System Get Command

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

    tf get itemspec [/version:versionspec] [/all] [/overwrite] [/force]

    [/preview] [/recursive] [/noprompt]

    Parameters

    Argument

    Description

    Itemspec

    File or folder to retrieve. If no itemspec is provided, Team Foundation Server performs a recursive get operation of the current workspace.

    Versionspec

    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.

    Option

    Description

    /version

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

    • Date/time (D10/20/2005)
    • 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.

    /all

    Forces all files to be retrieved, not just those that are out-of-date.

    /overwrite

    Overwrites writable files that are not checked out.

    /force

    Implies /all and /overwrite.

    /preview

    Displays what would occur without actually performing the Get operation.

    /recursive

    Recursively retrieves all items that match your itemspec.

    /noprompt

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

    Remarks

    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 Latest operation whenever you see a check-in notification, 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 or when your computer is infected by a virus. When you pass the /force option, Team Foundation Server overwrites all 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.

    Note

    Be careful when retrieving single file revisions into a workspace, especially if its timestamp differs significantly from other related workspace items.

    Workspaces that contain chronologically inconsistent file revisions can be more difficult to synchronize with the latest Team Foundation source control server version and when checked in, increase the chance that future check-ins can unintentionally introduce bugs into the build.

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

    When you perform a get operation to populate your workspace with a set of files, you are setting yourself up with a consistent snapshot from source control. Typically, the configuration of source on the system is a snapshot of files from the Team Foundation source control server that are known to work together, and can be built and tested.

    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 source 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 source 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 source 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.

    The Get Process

    When you perform a get operation, the version number of each item is recorded in the workspace definition and saved on the Team Foundation Server. This version of an item is referred to as the base workspace version.

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

    Examples

    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.

    Copy Code

    C:\projects>tf get 314.cs

    The following example retrieves version 8 of 1256.cs from the server.

    Note

    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.

    Copy Code

    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.

    Copy Code

    C:\projects>tf get

    The following examples provide alternative ways of retrieving the version of 1256.cs that was checked in with changeset 1999.

    Copy Code

    c:\projects>tf get /version:C1999 1256.cs

    —or—

    Copy Code

    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.

    Copy Code

    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.

    How to synchronize your computer with TFS

    - J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

    To synchronize your computer with the version control server, use the tf get command. This is a quick way of ensuring that your computer is synchronized with the rest of your team to ensure that you have the latest copy of shared work. To download all files and not just those that are out of date, run the following command from a Visual Studio 2005 command prompt window:

    tf get /all

    When you use this command, any local writable files that you might have on your computer are not overwritten. If you want to overwrite local writable files to completely synchronize your computer with the server, use the /force switch as follows:

    tf get /force

    Although this command overwrites local writable files, it does not overwrite writable files for which you also have pending edits. If you have pending edits on a file that you need to keep, check in or shelve your edits prior to re-synchronizing with the server.

    To perform the same operation from Visual Studio:

    1. In Team Explorer, double-click the Source Control folder, right-click your server or team project, and then click Get Specific Version.
    2. Select Overwrite writable files that are not checked out and Force get of file versions already in workspace.
    3. In the Type drop-down list, ensure that Latest Version is selected, and then click Get.


    If you want to completely synchronize your computer with the version control server, do not use the Get Latest Version option available in Visual Studio. Because this command only downloads those files that are not already in your workspace and does not overwrite writable files that you have checked out in your local directory, your computer remains out of synchronization with the server.

    Additional Resources

     

  • 相关阅读:
    题解 SP27102/UVA1747 【Swap Space】
    题解 P1453 【城市环路】
    题解 P5587 【打字练习】
    题解 P5594 【【XR-4】模拟赛】
    git add 的一点说明
    理解 Git 的基本概念 ( Merging Collaborating Rebasing)
    windows 上 Python 通过 SCP 连接linux server
    Neo4j CQL | WITH用法
    Neo4j CQL |create &merge
    Item 4: Prefer Interpolated F-Strings Over C-style Format Strings and str.format(请使用f-string格式化字符串)
  • 原文地址:https://www.cnblogs.com/snowball/p/855257.html
Copyright © 2011-2022 走看看