Grade Central
Back to Development
CVS Quick Reference
Checking out a working copy cvs checkout module
Updating cvs update file or directory name

cvs understands standard wildcard characters like * (e.g. cvs update *.h). The -d option to cvs when you update will grab any modules or files added since you checkout your working copy.

The output of the CVS command provides information about the state of files.

  • M - modified file
  • U - file updated from repository
  • C - conflict with version in repository. cvs puts both the conflicting lines in the file with seperators so you can choose which version you want and commit the changes.
  • P - file is patched.

If you really screw up bad, just remove the file (without using cvs remove ) and do a cvs update of the file to get a new copy back.

Finally, I strongly recommend updating before checking changes into the repository. Theoretically, people will be working on different files, but it helps avoid problems and identifies what needs to be checked in.

Releasing a working copy cvs release module

Use this command when you are finished with a coding session. It will inform you if you have any modified files that you need to check in. When the command completes, then it is safe to delete your working copies.

OR - have cvs do it for you. Type cvs release -d module to have cvs check for modified files and then remove the working copy for you.

Adding files and directories
  • Adding files:
    1. cvs add filename
    2. cvs commit filename
  • Adding directories:
    1. cvs add directory
Committing changes cvs commit -m "Your comment" [filename|directory]

Commit adds changes changed files to the database. Typing cvs commit without any other arguments commits all changed files in the current directory. The -m switch is useful for adding a comment without cvs opening your default editor. I strongly recommend adding comments whenever you check in changes.

Viewing Logs cvs log [filename|directory]

Prints out a list of all changes to the file. If you have been adding comments like a good developer, you will see a history of changes.

  Jim was a good programmer. He commented his commits and now he easily find what happened when things go wrong.

  Jack was a bad programmer. He has terrible bugs and doesn't know when he introduced him.

Be like Jim, comment your commits.

Checking Differences Between Files cvs diff [-r version number or tagname] [-r version number] [files...]

Omitting the version numbers will diff the file with the most recent version in the database.

Tagging Files cvs tag tagname filename

The tag command allows you to supply a name to the current version of a file in your working copy. This tag can then be used to refer to that particular revision. Typing cvs status filename will display version and tag information.

Removing files and directories
  1. rm [filename|directory]
  2. cvs remove [filename|directory]
  3. cvs commit -m "Why I removed the file" [filename|directory]

ALWAYS remove files with this procedure rather than deleting them from the repository proper. Never touch the repository proper. There there be dragons. Big ones with nasty pointy teeth. This also leaves a record of why the file is no longer relevant and possibly allow for recovery.

Back to top|Back to Development