Checkout and Edit Commands
Makes the local file writable and changes its pending Change status to "edit" in the workspace. Edit is an alias for the Checkout command.
Note
Any edits made to items that have been checked out are not reflected in the Team Foundation source control server until you perform a check-in operation. For more information, see How to: Check In Pending Changes.
tf checkout [/lock:(none|checkin|checkout)] [/recursive]
[/type:encoding] itemspec
Parameters
Argument | Description |
---|---|
encoding |
Provides a value for the /type option. Alternatives include the following: Text is an alias for the current windows encoding (Windows-1252 on US systems) or Unicode (based on the BOM, or byte order mark), Binary, and all other file encodings supported by the Windows operating system. You may also use Auto which detects the type for you. For more information, see File Types. |
itemspec |
Specifies one or more files to check out. The use of wildcard characters is supported here. |
Option | Description |
---|---|
/type |
Manually overrides the file encoding that Team Foundation associates with the specified files. |
/recursive |
Checks out all files that match the itemspec in the current directory or specified location and subfolders. |
/lock |
Prevents other users from checking in or checking out the specified files. For more information, see Understanding Lock Types. Lock Options:
|
Remarks
Before you can check out an item, you must add it to the Team Foundation source control server. For more information about how to set up a local workspace and adding items to source control, see Walkthrough: Working with Team Foundation Source Control from Command Line.
Unlike some source control systems, Team Foundation does not get the latest Team Foundation source control server version during a check-out operation. Instead, it makes the current workspace version writable. For more information, see How to: Get the Source for your Team Project.
You can use tf edit as an alias for checkout.
By default, multiple users can check out the same source-controlled item at the same time. When you use tf to check out an item which has pending changes in another workspace, information about the nature of their change is printed on the command line. In most collaborative development environments, the probability that you will make a change in your workspace that represents a potential merge conflict with a pending change in another workspace or vice versa, is unlikely. Most conflicts that do occur can be resolved automatically by Team Foundation. For those that cannot be resolved automatically, you can use the Resolve Command to safely decide which change, yours or theirs, you want to keep. If you are concerned that another user might make changes in their workspace that conflict with your pending changes, you can use the Status Command to monitor other workspaces for newly applied changes. Alternatively, you can use the Lock Command to prevent other users from checking out or checking in until you have checked in and unlocked your own changes. As a best practice, use the lock command with discretion and notify your teammates why you are doing this, and when you plan to remove the lock.
Examples
For the following examples, the current directory is a working folder in a workspace called "Math."
The following example makes 314.cs writable on disk and adds it to the list of pending changes for the Math workspace.
c:\pi> tf checkout 314.cs
The following example checks out both 314.cs and 271.cs.
c:\pi>tf checkout 314.cs 271.cs
The following example checks out page.xsl and changes the encoding property for the Team Foundation file type to specified value. Text is an alias for the current Windows encoding such as Windows-1252.
c:\pi>tf checkout /type:text page.xsl
Security
To use the checkout command, you must have the Check out permission set to Allow and you must be either the workspace owner or have the global Administer workspaces permission set to Allow. If the /lock option is used with a value other than none, having the Lock permission set to Allow is required also. For more information, see Team Foundation Server Permissions.
See Also
Tasks
Walkthrough: Working with Team Foundation Source Control from Command Line
How to: Check Out and Edit Source-Controlled Items
Reference
Get Command
Checkin Command
Unshelve Command