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. These generated files, when taken together, 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 up to you the user 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 for it 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 subfolders, adding those files it finds to version control, provided the files have not been explicitly ignored.

Tip: When you create a new file in a CVS project, a task is created to remind you of the fact that that file is neither ignored nor under version control. The "Quick Fix" menu for the task will provide options for resolving it, such as either adding it to version control or adding it to the list of ignored resources.

Tip: When committing files from the Synchronization view, if the selection either directly or recursively contains files which have not been added to version control, you'll be prompted whether or not at that time 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 to ignore for version management. This is used most often to ignore directories. 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.

Related concepts
Team programming with CVS

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

 
Copyright IBM Corporation and others 2000, 2002