Telling CVS to ignore files

CVS normally expects to be managing all the files in a directory (with some standard assumptions -- it will ignore files ending in ~, files starting with #, files ending in .o or .a, files named core, and a variety of other standard exclusions intended to avoid temporary or generated files; see info cvs for a full list). Often that isn't what you want, though. The standard practice is only to put source files under CVS control; any file that can be programmatically and automatically generated from the other files probably shouldn't be under revision control itself. (For programming projects, this generally means any file that can be build automatically from the Makefile.)

To tell CVS to completely ignore a file, put the name of the file in a file named .cvsignore in that directory. CVS will completely ignore any files listed in that file, treating them as if they didn't exist. You can also put wildcards into .cvsignore, using standard wildcard shell syntax; for example, a line of *.elc will tell CVS to ignore all files ending in .elc.

Similarly, CVS will normally expect to be managing all subdirectories of a directory, but if a directory name matches a filename or wildcard expression in .cvsignore CVS will ignore it.

Another use of .cvsignore is to tell CVS it does need to manage files it normally wouldn't. For example, CVS normally ignores files ending in .a because they're generally libraries built as the result of compiling sources, and therefore are generated files. If you have a file ending in .a that you want CVS to track, put:


in .cvsignore in that directory. That single exclamation point will clear the default list of ignored files. (You may have to, after the !, list some of the standard patterns like *~ or #* again if you want CVS to ignore them still, since ! clears out all patterns of files to ignore.)

Last modified and spun 2014-08-17