|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
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.
Any edits you make to items that have been checked out are not reflected in the Team Foundation version control server until you perform a check-in operation. For more information, see How to: Check In Pending Changes.
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. Also, if you use the /lock option with a value other than none, you must have the Lock permission set to Allow. For more information, see Team Foundation Server Permissions.
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.
Specifies one or more files to check out. You can use wildcard characters here.
Manually overrides the file encoding that Team Foundation associates with the specified files.
Checks out all files that match the itemspec in the current directory and in all the subfolders of the current directory.
Prevents other users from checking in or checking out the specified files. For more information, see Understanding Lock Types.
The default behavior of the checkout command is determined by whether the get latest version of item on check-out setting is enabled. For more information on how to view or change this setting, see How to: Enable Team Foundation Version Control to Get the Latest Files on Check-Out.
If get latest version of item on check-out is enabled, the checkout command behavior resembles check-out behavior in Visual SourceSafe. If the latest version of the item is not in your workspace, Team Foundation gets the latest version from Team Foundation Server and copies it to your workspace. If an older version of the same item is in your workspace, it is overwritten by the latest version.
If get latest version of item on check-out is disabled, Team Foundation does not get the latest Team Foundation version 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 version-controlled item at the same time. When you use tf to check out an item that has pending changes in another workspace, information about the nature of those other changes is printed on the command line. In most collaborative development environments, it is unlikely 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. Team Foundation allows you to resolve automatically most conflicts that do occur. For those conflicts that cannot be resolved automatically, use the Resolve Command to safely decide which change, yours or those initiated by other users, you want to keep. If you are concerned that another user might make changes in his or her 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.
For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.
The following example makes 314.cs writable on disk and adds it to the list of pending changes for the 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 text. Text is an alias for the current Windows encoding such as Windows-1252.
c:\pi>tf checkout /type:text page.xsl