共用方式為


Get Files from the Server to Your Workspace (Team Explorer Everywhere)

As a general rule, you should get the latest versions of files from the server on a regular basis. Using the latest versions makes sure that the code you develop is compatible with the code developed by others on your team. It also minimizes the risk of creating bugs when you check in your code. You can download the latest version or a previous version of one or more files from your Team Foundation Server to your workspace on your dev machine.

Required permissions

You must be one of the Contributors for your team project. See TFS default groups, permissions, and roles [redirected].

What do you want to do?

  • Get the latest version of some files

  • Get a specific version of some files

  • Get tips

Get the latest version of some files

You should get the latest versions of files from your server after you set up your dev machine. Then you can begin developing your app.

Later, as you develop functionality in the workspace on your dev machine, your code is isolated from the changes that are made by other developers. But when you are ready (for example, you have completed and checked in the code that completes a task), you should get the latest version of your team’s files.

To get the latest version of some files

  • In Package Explorer or Project Explorer, select one or more resources, open their shortcut menu, and choose Team, Get Latest Version. Or,

    In Source Control Explorer, browse to the files or the folders that contain the files that you want to get, select them, open their shortcut menu, and choose Get Latest Version.

    Get latest version

Get a specific version of some files

In special cases (for example, to fix a regression bug), you might need to get and work with a specific version of one or more files.

Note

Keep in mind that if you get an older version of a file, make changes to it, and then try to check it in, there is an increased chance that you will need to resolve conflicts before you can complete the check-in.

To get a specific version of some files from the History window

  1. In Package Explorer or Source Control Explorer, browse to the folder or file, open its shortcut menu, and choose View History.

    View history

  2. In the History window, open the shortcut menu of a version and choose Get This Version.

    Get this version

To get a specific version of some files from Source Control Explorer

  1. In Source Control Explorer, browse to the files or the folders that contain the files you want to get, select them, open their shortcut menu, and choose Get Specific Version.

    Get specific version

    The Get dialog box appears.

    Get changeset

  2. Choose an option from the Type drop-down list:

    • Changeset   Get a version by specifying a changeset.

    • Date   Get a version by specifying a date. If selected, select a date in the Date list.

    • Label   Get a version by specifying a label.

    • Latest Version   Select this option to get the latest version on the server.

    • Workspace Version   Get a version by specifying a workspace

  3. (Optional) Select the Overwrite writable files that are not checked out option.

    If selected, files from the server will overwrite all files that do not have the read-only attribute associated with them and are not checked out. Only files on the server, which are different, will overwrite the files in the local workspace. By default, this option is not selected.

    Tip

    This option is equivalent to running the following command: tf get-overwrite.

  4. (Optional) Select the Overwrite all files even if the local version matches the specified version option.

    If selected, files from the server overwrite all files.

    Tip

    This option is equivalent to running the following command: tf get-force.

  5. Choose Get.

    Source Control Explorer appears. If you chose Latest Version in step 5, the system updates the Latest column with the status of Yes.

Tips

  • Tip The system does not get files that you have checked out.

  • Tip When you get files and folders from the server, the system also deletes any checked-in files from your local workspace that have been deleted from the server. Files that have been renamed or moved on the server are changed in your workspace to match the changes on the server.

  • Tip In Source Control Explorer, you can verify whether you have the latest version of a file in the Latest column. You can see specific version information about an item by opening its shortcut menu and choosing Properties.

  • Tip If you are using a server workspace, and you have accidentally deleted some files that you want to restore, you must use the tf get-all command to restore the deleted files.

See Also

Concepts

Team Foundation Server Plug-in for Eclipse - Beginner's Guide