Question: How do I work with version control from the command line?

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

Answer

Team Foundation Server provides the TF command line tool (Tf.exe) to enable you to perform source control operations. For example, you can use the command line to schedule operations by using the Microsoft Windows® Task Scheduler.

To ensure that the appropriate path and other environment variables are set up, run the tool from the Visual Studio 2005 Command Prompt window, or run the Vsvars32 batch file, which is normally located in DriveLetter:\Program Files\Microsoft Visual Studio 8\Common7\Tools. The command line supports most source control commands, including Checkin, Checkout, Get, History, Shelve, Branch, Merge, Label, Status, Undelete, and Undo.

The following are common operations you might want to execute from the command line:
  • Synchronize files from the server to your local machine – tf get
  • Add a file to the server – tf add
  • Check out a file for editing – tf checkout
  • Check in pending changes – tf checkin
  • Retrieve a particular changeset from the server – tf get /version

The following operations can only be performed from the command line:
  • Delete another user’s workspace – tf workspace /delete
  • Undo another user’s check-in – tf undo
  • Unlock another user’s lock – tf lock
  • Define label scope – tf label
  • Perform a baseless merge – tf merge

Additional Resources

Last edited Jul 18, 2007 at 10:20 PM by jtaylorsi, version 8

Comments

No comments yet.