Common TFS commands

tf.exe is Team Foundation source control command-line tool which can be used to perform source control operations without GUI interaction. Here are some common tf commands I use in my daily work. You can run command tf /? to view more or visit MSDN TF Command Line Tool Reference

Common tf commands

sync Sync files under current folder tf get
Sync files under current folder and all sub folders tf get . /r
Sync file to a given revision tf get <filename>;<revision>
Display what would be synced tf get /preview
Force sync tf get /all
Force sync, will override existing files tf get /force
add Add new file tf add <filename>
checkout Checkout file for editing tf checkout <filename>
delete Delete file tf delete <filename>
rename Rename file tf rename
checkin Submit open files to tfs server tf checkin
resolve Resolve file conflicts tf resolve
Resolve file with automatical merge tf resolve /i /auto:acceptmerge>
shelve Package pending change and store to tfs server tf shelve <shelvesetname>
unshelve Unpackage shelve from tfs server into current workspace tf unshelve <shelvesetname>
workspace Update workspace configurations tf workspace <workspacename>

Common tfpt commands

tftp.exe is a command line tool that you can use to work with files and directories under version control, team projects, and work items. Some commands display a graphical user interface when run. tfpt.exe is part of Team Foundation Server Power Tools which can be downloaded here.

Revert unchanged files tfpt uu /noget
Search all modified files not in source control and add to pending change list tfpt online
Scorch – Remove all files in local workspaces but not in source control tfpt treeclean -delete
Undo submitted change tfpt undo
View difference of a shelve tfpt review /shelveset

Comments

102 responses to “Common TFS commands”

Leave a Reply