# 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 CVS 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 CVS 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 CVS 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. This preference can be found in Window > Preferences > Team > Ignored Resources.
2. Any resource marked as derived will be automatically ignored for version management by Team CVS. Some builders, such as the Java builder, mark all of its build output (e.g. .class files) as derived.
3. CVS supports the creation of a special .cvsignore file whose contents describe which files or folders to ignore for version management. The .cvsignore file only applies the pattern to resources in the same directory as the .cvsignore file itself.

Tip: Once a resource is under version control, it cannot easily be subsequently ignored. This is why adding to version control is an explicit operation performed by you the user.

Team programming with CVS

Creating a global ignore pattern
Authoring the CVS .cvsignore file
Committing
Updating