共用方式為


Checkout (or Edit) command

TFS 2017 | TFS 2015 | TFS 2013

Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | Visual Studio 2013

Checks out a file and changes its pending change status to Edit. You can call this command using either Checkout or Edit.

Prerequisites

See Default TFVC permissions.

Syntax

tf checkout [/lock:(none|checkin|checkout)] [/recursive] [/encoding:encoding] itemspec [/login: username,[password]]

Parameters

Parameter Description
/encoding Ignore this parameter.
itemspec Specifies the scope of the items to check out. For syntax, see Use Team Foundation version control commands.
/lock Applies or removes a lock. See Use Team Foundation version control commands.
/login:username,[password] Specifies the user account to run the command. See Use Team Foundation version control commands.
/recursive Recursively checks out items in the specified directory and any subdirectories.

Examples

Check out a single item

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

Checks out program.cs.

Check out two items

c:\code\SiteApp\Main\SolutionA\Project1\>tf checkout program1.cs program2.cs

Checks out the files program1.cs and program2.cs.

Work in Visual Studio

Tips

  • Tip If you are beginning a new task, it's probably a good idea for you to download the latest files from the server before you check out files and begin your work. See Get command.

  • Tip When you begin editing a file in a local workspace, it is automatically checked out for you.

  • Tip You can view a list of your pending changes:

    • And work with related data such as Comments and Associated Work Items in the Check In dialog box using the Checkin command.

    • At the command prompt by using the Status command.

  • Tip When you are ready to check in your changes to the team's codebase on the server, use the Checkin command.

  • Tip If you need to set aside changes (and perhaps also want to clean your workspace for another task), use the Shelve Command.

  • Tip If you use a server workspace, files that you have not checked out are read-only.