Version control life cycle: adding and ignoring resources

When committing resources, often there are resources that you do not want to store in the repository. For example, external editors might create temporary files in your project, compilation of .java files might create .class files, or some build operations might result in binary files. When put together, these generated files may be quite large. They may also be regenerated whenever a build is performed, resulting in many outgoing changes. Typically these are not files that one wants to persist in the repository or to share with other members of a team.

Team has two related tasks that allow you to control which files are stored in the repository: adding a resource to version control, and ignoring a resource.

Adding a file to version control

Team does not automatically add files to version control. Rather, it's your choice to explicitly add files to version control. This is accomplished by selecting the Team > Add to Version Control menu.

When performed on a file, it will add that file to version control. The result is that the VCS repository immediately creates an entry so that it can start maintaining history state for that file. This occurs even before you commit the file to the repository.

When adding a folder or project, the action will recursively descend into sub-folders, adding those files it finds to version control, provided the files have not been explicitly ignored.

Tip: When committing files, if the selection either directly or recursively contains files which have not been added to version control, you will be prompted whether or not you want them added. This is a convenience function to help ensure that you do not miss committing new resources which were unintentionally never added.

How may I ignore thee, let me count the ways

There are several facilities that allow you to specify which resources should be excluded from version control:

  1. There is a global preference which you can use for ignoring files and directories that match a certain filename pattern. For example, if you create a global ignore for /bin, and any resource that matches "bin" in any directory in the workspace will be ignored for version control. Use the command link Team > Ignored Resources preference page to globally exclude resources from version control.
  2. Any resource marked as derived will be automatically ignored for version management by Team VCS. Some builders, such as the Java builder, mark all of its build output (e.g. .class files) as derived.
  3. Git supports the creation of a special .gitignore file whose contents describe which files or folders to ignore for version management. The .gitignore file only applies the pattern to resources in the same directory as the .gitignore file itself.

Tip: Once a resource is under version control, it cannot be subsequently ignored easily. This is why you must invoke an explicit command to add resources to version control.

Creating a global ignore pattern