Export (0) Print
Expand All

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. For more information, see Pending Changes.

NoteNote

   Any edits that you make to items that have been checked out are not reflected in the server for Team Foundation version control until you perform a check-in operation. For more information, see Check In Pending Changes.

Required Permissions

To use the checkout command, your Check out permission must be set to Allow, and you must be either the workspace owner or your global Administer workspaces permission must be set to Allow. Also, if you use the /lock option with a value other than none, your Lock permission must be set to Allow. For more information, see Team Foundation Server Permissions.

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

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 Managing File Types.

itemspec

Specifies one or more files to check out. You can use wildcard characters here.

username

Provides a value to the /login option. You can specify a username value as either DOMAIN\UserName or UserName.

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 and in all the subfolders of the current directory.

/lock

Prevents other users from checking in or checking out the specified files. For more information, see Understanding Lock Types.

Lock Options:

  • None

    Default. No lock is applied. If a lock exists on the specified file, the None option removes it.

  • Checkin

    Other users can check out the specified items, but they cannot check in revisions to locked files until you release the lock. If any other users have locked any one of the specified items, the lock operation fails.

  • Checkout

    Prevents other users from checking out any one of the specified items until you release the lock. If any other users have locked any one of the specified items, the lock operation fails.

/login

Specifies the user name and password to authenticate the user with Visual Studio Team Foundation Server.

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

Community Additions

ADD
Show:
© 2014 Microsoft