Introduction
CVS is a version control system which allows multiple developers to access and
modify files from the same project in an organized way. CVS ensures that
developers don't modify files at the same time, or accidentally overwrite
changes made by other developers. It also keeps backups of previous versions
of files. For more info on CVS, see the CVS homepage.
Basically, the CVS repository is the "official" copy of the project files, and
your checkout of the files is your working copy. Checking out files and
directories from the CVS repository is like making a photocopy of the CVS
repository files and keeping the photocopy for own use. You mark up the
"photocopy" with
your changes and then put the photocopy back into the CVS repository so that
it
becomes the official copy. Your "photocopy" is called your working copy, and
it can be on
any machine, in any directory. To complete the analogy, you can make changes
to the files in your
working copy and test them before actually adding and committing them to the
CVS repository.
You need to make sure that you update your working copy of
the files frequently, so that your working copy isn't missing changes that
other developers have made to the CVS repository. Sometimes you will find
that someone else has modified a file that you are trying to modify. In this
case you'll need to resolve the conflict before adding and commiting your
modified file to the CVS repository.
Using CVS
Since plenty of tutorials have been written on how to use CVS, I'll just point
you to one CVS tutorial.
There's a bit of a learning curve to using CVS, but once your get the hang of
it it's much more convenient than the alternatives. It's worthwhile to read
through this tutuorial once before starting with CVS since there are several
details that can be frustrating if you're not aware of them.
Common CVS Commands
Once you have a basic understanding of CVS, here's a reference for some
common CVS commands.
- cvs update -dP = updates without showing empty and deleted directories.
To add files and directories: (for example add subdirectory and its files/directories to parentdirectory)
- cd parentdirectory = go to parentdirectory
- mkdir subdirectory = creates the directory locally (don't put anything in this folder!!!)
- cvs update -d = updates and shows subdirectory with a '?'
- cvs add * = marks subdirectory with an 'A' to be added to the repository
- cvs commit * = adds subdirectory to the repository
- cvs update -d = updates parent to show subdirectory updates
- cd subdirectory = go to subdirectory
- mkdir directories = creates the directories locally (don't put anything in these folders!!!)
- mk files = creates the files locally
- cvs update -d = updates and shows files/directories with a '?'
- cvs add * = marks files/directories with an 'A' to be added to the repository
- cvs commit -m "message" * = adds files/directories to the repository with a log message
- cvs update -d = updates subdirectory to show files/directories updates
To remove files and directories: (for example remove subdirectory and its files from directory)
- cd subdirectory = go to subdirectory
- rm * = this removes all the files locally
- cd .. = go to directory
- cvs remove subdirectory = removes all the files and subdirectory on cvs
- cvs commit -m "removed subdirectory message" = saves the remove change on cvs
- cvs update -dP = checks to see that subdirectory was removed (should have ? before the directory name)
- rmdir subdirectory = removes subdirectory locally
Common CVS Outputs
- U file = The file has been updated on the repository and in your private copy.
- P file = There exists a newer revision of this file in the repository, and you have not
modified your local copy of the file (‘U’ and ‘P’ mean the same thing).
- A file = The file has been added to your private copy of the sources, but has not yet
been committed to the repository. If you delete your copy of the sources this
file will be lost.
- R file = The file has been removed from your private copy of the sources, but has not
yet been removed from the repository, since you have not yet committed the
removal.
- M file = The file is modified in your working directory. There might also be a newer
revision inside the repository.
- ? file = The file is in your working directory, but does not correspond to anything in the
source repository, and is not in the list of files for cvs to ignore. If you
remove your working sources, this file will be lost.
Last updated: 06/30/2003 by Janna Balling