Search notes:

Team Foundation

Unlike Git, TFVC is centralized: historical versions of a file are maintained on the server. So, users have access to only one version of each file.

Team Project Collections

A team project collection is a logical unit in the server. There is a default collection which is named DefaultCollection.

Workspace

A workspace is a local copy of the files including the changes that are made locally.
In order to make changes in a workspace available to other users, these changes need to be committed.
tf vc workspaces /collection:"https://devops.foobarbaz.xyz/DefaultCollection"

Basic commands on the command line

The command line tool for Team Foundation is TF.exe.
tf workspace -new -noprompt tq84DBPrj -collection:https://devops.foobarbaz.xyz/DefaultCollection
C:\Users\rene\TFS> tf workfold /workspace:ABCD5341 /map DBPRJ \Users\rene\TFS\DBPRJ

TF10125: The path 'DBPRJ' must start with $/

C:\Users\rene \TFS>tf workfold /workspace:ABCD5341 /map $/DBPRJ \Users\rene\TFS
tf workfold /workspace:ABCD5341
tf workfold -map '$/DBPRJ' C:\users\rene\TF -collection:https://devops.foobarbaz.xyz/DefaultCollection -workspace:tq84DBPrj
tf get recursive .
tf add .\InitialCode
C:…\…\\> tf checkin .\InitialCode\  /comment:"Add InitialCode"
Checking in add: InitialCode

Changeset #6657 checked in.
Turns out, InitialCode was not added recursively…
tf add     -recursive .\InitialCode
tf checkin -recursive .\InitialCode\ /comment:"Add InitialVersion with -recursive parameter"
tf add .\hello-world.sql .\hello-world-body.sql
tf checkin  /comment:"First version of Hello-World package"
c:\…\…> tf workspaces
Collection: https://devops.foobarbaz.xyz/defaultcollection
Workspace  Owner             Computer Comment
---------- ----------------- -------- --------------------------------------------------------------------------------------------------------------------------
ABCD0444   Nyffenegger, René ABCD0444
ABCD0444_1 Nyffenegger, René ABCD0444
tq84DBPrj  Nyffenegger, René ABCD0444
C:\…\…> tf info .  -recursive
C:\…\…> tf status .
There are no pending changes

C:\…\…> tf add .\0106-001_explain-plan-as-FIBU.sql .\0106-002_explain-plan-errors.sql
0106-001_explain-plan-as-FIBU.sql
0106-002_explain-plan-errors.sql

C:\…\…> tf status .
There are no pending changes.

C:\…\…> tf folderdiff .
C:\…\…> tf folderdiff . -noprompt
TF206008: Unable to determine the workspace because the local path you provided either is not mapped to a server folder or it cannot be found. Check the value you provided for targetPath or provide an alternate sourcePath value and try again.

C:\…\…>  tf checkin . -comment:"explain plan for 'InitialVersion'"
There are no pending changes matching the specified items.
No files checked in.

C:\…\…>  tf checkin .\0106-001_explain-plan-as-FIBU.sql .\0106-002_explain-plan-errors.sql  -comment:"explain plan for 'InitialVersion'"
Checking in add: 0106-001_explain-plan-as-FIBU.sql
Checking in add: 0106-002_explain-plan-errors.sql

Changeset #6667 checked in
tf workspaces -format:detailed -collection:https://devops.foobarbaz.xyz/DefaultCollection/
Rename a directory:
tf rename .\sql_stmt_templ\ .\sql_stmt_tmpl
tf checkin . -recursive -comment:'rename sql_stmt_templ to sql_stmt_tmpl'
Move file to another folder/directory:
tf rename .\SystemData\_test.ps1 test-SystemData.ps1
rem tf folderdiff  -recursive -noprompt .
tf checkin -recursive . -comment:"move tests into respective directory"

See also

TFS Web API
TF.exe
Team Foundation Version Control is supported in Azure Repos.

Index