Export (0) Print
Expand All

Cross-Platform Command-Line Client- Beginner's Guide

If you are developing applications on common UNIX platforms, you can use the Cross Platform Command-line Client to access Team Foundation Server and perform version control operations.

Here’s how to get started with the command-line client:

  1. Install the Cross Platform Command-line Client:

    1. Download the command-line client.

    2. Unzip the archive (.zip file) that contains the client.

    3. Configure the shell or system path to include the folder where the unzipped files are archived. Make sure that you have the Java Runtime Environment or Java Development Kit in the path or that you’ve set the JAVA_HOME environment variable.

    4. To verify that the client is working, at a command prompt, type tf, and then choose the Enter key.

      If the client is correctly installed, output that starts with Team Explorer Everywhere appears.

      For information about any of the commands, type tf help Command, where Command is the name of the command for which you want information. For example, type tf help checkin.

  2. View and accept the Microsoft Software License Terms for the Cross-platform Command-Line Client. You must run the EULA command below before you can perform any version control operations.

    tf eula
    

    Microsoft Software License Terms will be displayed. You need to type “yes” or “y” to accept the terms.

  3. Run the workspace command to create a local workspace. A workspace includes client-side folders on the local disk mapped to version-controlled folders on the Team Foundation server.

    The following example creates a new workspace called Beta1 in the TFS collection “http://myserver:8080/tfs/DefaultCollection”.

    tf workspace -new Beta1 -collection:http://myserver:8080/tfs/DefaultCollection
    
    NoteNote

    When you create or edit a workspace, you can specify whether its location is local or on a server. Local is the default setting. It enables you to quickly perform core version control operations even when you are offline.

  4. Run the workfold command to create workspace mappings between local folders and folders on the server. By default, workspace mappings are applied recursively. When you map a local folder to a server folder, the system implicitly creates a mapping between all its current and future subfolders.

    The following example maps the folder /Users/Example in the workspace Beta1 to the Team Foundation version control server folder $/ScrumProject/JavaSample.

    tf workfold -map $/ScrumProject/JavaSample -workspace:Beta1 /Users/Example
    
  5. Change directory to the path of the local working folder that you have mapped. For example,

    cd /Users/Example
    
  6. Run the get command to retrieve a copy of a file from Team Foundation Server or to synchronize your workspace with the most recently checked-in changes on the server. For example,

    tf get
    
  7. Edit a file. Changes are marked as pending changes in the local workspace.

  8. Create a new file and make it executable. For example,

    $ chmod u+x HelloWorld.sh
    
  9. Run the add command to add the new file to Team Foundation Server. For example,

    tf add Helloworld.sh
    
  10. Run the status command to review information about pending changes to items in the workspace.

    tf status
    
  11. Run the checkin command to check in pending changes from current workspace to Team Foundation Server.

    The following example submits the pending changes associated with work item 11 in the current workspace to the Team Foundation version control server together with the specified comment to create a new changeset.

    tf checkin -comment:"Fixed a bug” -associate:11 
    
Note Note

For more information about command syntax and connecting to Team Foundation Server, see Command-Line Syntax (Team Explorer Everywhere) and Command-Line Authentication for Team Explorer Everywhere.

Now you have completed the most basic version control operations using the command-line client. Here are a few more operations that you might also need:

  • Run the rename command to change the name or the path of a file or folder.

    The following example changes the name of test1.txt to NewTest.txt.

    tf rename test1.txt NewTest.txt
    
  • Run the delete command to remove a file or folder from the Team Foundation Server and delete them from the disk. The results of this command are not visible in other workspaces until you perform a check-in operation. For example,

    tf delete Test-new.txt
    
    NoteNote

    If you have deleted an item in your workspace but have not checked in the change, you can restore the item to your workspace and remove the deletion from your list of pending changes using the undo command.

    You cannot delete an item for which another pending change exists. For example, a checked out file cannot be deleted. To delete such items, you must undo the current pending change.

Note Note

If you don’t want to type commands line by line, you can write a script to automate all the tasks above. See Scripting in the Cross-Platform Command-Line Client for Team Foundation Server.

Show:
© 2014 Microsoft