Dela via


Add Files to Version Control (Team Explorer Everywhere)

This topic explains how to add one or more files to version control and how to exclude certain files from version control.

  • Add one or more files to version control

  • Customize which files are ignored by version control

Required permissions

You must be one of the Contributors for your team project. See Team Foundation Server Default Groups, Permissions, and Roles.

Add one or more files to version control

If you are using a local workspace, then the Pending Changes page can detect the new files.

  1. In Eclipse, if you have not already done so, connect to the team project.

  2. In the home page of Team Explorer, choose Source Control Explorer.

  3. In Source Control Explorer, navigate to the folder where you want to add the files or folders.

  4. Choose the link next to Local Path to open the target folder in Windows Explorer (or File Explorer).

    Move your files and folders into this folder.

  5. In Eclipse, in Team Explorer, choose Pending Changes.

  6. On the Pending Changes page, choose Actions, Detect Local Changes

    Detect local changes

  7. In the Excluded Changes section, choose Detected changes.

    The Promote Candidate Changes dialog box appears.

  8. In the Promote Candidate Changes dialog box, make sure only files that you want to check in are selected, and then choose Promote.

    Promote candidate changes

  9. On the Pending Changes page, choose Check In.

Customize which files are ignored by version control

By default certain types of files (for example, .dll files) are ignored by version control. As a result:

  • When you add ignored files to folders that are mapped in a local workspace, they do not appear in the Pending Changes page in Team Explorer.

You can configure which kinds of files are ignored by placing text file called .tfignore in the folder where you want rules to apply. The effects of the .tfignore file are recursive. However, you can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder.

.tfignore file rules

The following rules apply to a .tfignore file:

  • # begins a comment line

  • The * and ? wildcards are supported.

  • A filespec is recursive unless prefixed by the \ character.

  • ! negates a filespec (files that match the pattern are not ignored)

.tfignore file example

######################################
# Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA\*.cpp
# Ignore .txt files in this folder 
\*.txt
# Ignore .xml files in this folder and all its sub-folders
*.xml
# Ignore all files in the Temp sub-folder
\Temp
# Do not ignore .dll files in this folder nor in any of its sub-folders
!*.dll

Create and use a .tfignore file

While you can manually create a .tfignore text file using the above rules, you can also automatically generate one when the Pending Changes page has detected a change.

To automatically generate a .tfignore file

  1. On the Pending Changes page, choose Actions, Detect Local Changes

    Detect local changes

  2. In the Excluded Changes section, choose the Detected changes link.

    The Promote Candidate Changes dialog box appears.

    Promote candidate changes

  3. Select a file, open its shortcut menu, and choose Ignore this local item, Ignore by extension, Ignore by file name, or Ignore by Folder.

    Ignore files

  4. Choose Promote or Cancel to close the Promote Candidate Changes dialog box.

  5. A .tfignore file appears in the Included Changes section of the Pending Changes page. You can open this file and modify it to meet your needs.

The .tfignore file is automatically added as an included pending change so that the rules you have created will apply to each team member who gets the file.

Here is another way to automatically generate a .tfignore file:

In Package Explorer, right-click the file you want to ignore and choose Team, Ignore:

Ignore file automatically

See Also

Concepts

Team Foundation Server Plug-in for Eclipse - Beginner's Guide