Add command (Team Foundation Version Control)
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
Visual Studio 2019 | Visual Studio 2022
The Team Foundation Version Control add
command adds files and folders to a TFVC repository.
Prerequisites
The TFVC workspace set up on the dev machine. See Workspace command or Set up Team Foundation Version Control on your dev machine.
Syntax
tf add itemspec [/lock:(none|checkin|checkout)] [/encoding:filetype]
[/noprompt] [/recursive] [/noignore] [/login:username,[password]]
Parameters
Parameter | Description |
---|---|
/encoding: <filetype> |
Ignore this parameter. |
itemspec |
Specifies the scope of the items to add. You can specify more than one itemspec argument. |
/lock |
Applies or removes a lock. See Use Team Foundation Version Control commands. |
/noignore |
By default, version control ignores certain types of files, such as .dll files. You can configure which kinds of files to ignore by using a .tfignore file. See Customize which files version control ignores. The rules in a .tfignore file apply to the add command when you specify a wildcard in your itemspec . To override these rules, specify /noignore . |
/noprompt |
Suppresses the display of windows and dialog boxes and redirects output data to the command prompt. See Use Team Foundation Version Control commands. |
/recursive |
Recursively adds items in the specified directory and any subdirectories. |
Examples
The following examples assume that c:\code\SiteApp\Main\
maps to $/SiteApp/Main/
in the workspace.
Add all new files in a local workspace
New files in a local workspace are automatically detected. You can promote these newly detected files to your pending changes.
The following command adds the latest versions of all items in a local workspace, except those items that are ignored:
c:\code\SiteApp\Main\SolutionA\Project1>tf add
The following command adds the latest versions of all items in a local workspace, even items designated as ignored:
c:\code\SiteApp\Main\SolutionA\Project1>tf add /noignore
Add individual items
The following command adds the files program1.cs and program2.cs:
c:\code\SiteApp\Main>tf add program1.cs program2.cs
Recursively add all items of a specific type
The following command adds all C# code files (.cs) in the current directory and any subdirectories:
c:\code\SiteApp\Main>tf add *.cs /recursive
Work in Visual Studio
- You can also use Visual Studio to add files to the server.
Tips
- The results of the
add
command are queued as pending changes and don't take effect on the server until you check them in. See Checkin command. - To set aside changes or clean your workspace for another task, use the Shelve command.