title: Add files to version control using TFVC Add command titleSuffix: Azure Repos description: Use the TFVC Add command to add files to version control in TFS ms.assetid: 0b61e4c6-a3da-48d6-bda0-7b14452049a4 ms.technology: devops-code-tfvc ms.topic: reference ms.date: 08/10/2016 monikerRange: '>= tfs-2015'
Azure Repos | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015 | VS 2017 | VS 2015 | VS 2013
Adds files and folders to version control.
Tip
Before you add files to version control, you should first set up the workspace on your dev machine. See Workspace Command or Set up Team Foundation Version Control on your dev machine.
Requirements: See Permissions and groups reference.
tf add itemspec [/lock:(none|checkin|checkout)] [/encoding:filetype]
[/noprompt] [/recursive] [/noignore] [/login:username,[password]]
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. |
/login:username,[password] | Specifies the user account to run the command. See Use Team Foundation version control commands. |
/noignore | By default certain types of files (for example, .dll files) are ignored by version control. The rules in a .tfignore files apply to the Add command when you specify a wildcard in your itemspec. To override the application of the rules in this case, specify /noignore. You can configure which kinds of files are ignored using a .tfignore file (see Add Files: .tfignore file). |
/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. |
In all the following examples, assume that $/SiteApp/Main/
is mapped to c:\\code\\SiteApp\\Main\\
in the workspace.
New files in a local workspace are automatically detected. You can promote these newly detected files to your pending changes.
c:\code\SiteApp\Main\SolutionA\Project1>tf add
Adds the latest versions of all items (except those that are ignored) in a local workspace.
c:\code\SiteApp\Main\SolutionA\Project1>tf add /noignore
Adds the latest versions of all items in a local workspace.
c:\code\SiteApp\Main>tf add program1.cs program2.cs
Adds the files program1.cs and program2.cs.
c:\code\SiteApp\Main>tf add *.cs /recursive
Adds all C# code files (.cs) in the current directory and any subdirectories.
- Add files to the server Use Visual Studio to add files to the server.
- The results of this command are queued as pending changes (see Status command) and do not take effect on the server until you check in (see Checkin command).
- If you need to set aside changes (and perhaps also want to clean your workspace for another task), use the Shelve Command.