cvs allows you and your group members to create a repository for your project source, to each check out your own working copies of your project's source, to commit changes to the repository, to checkout previous committed versions of your code from the repository, to automatically merge in changes made by your project partner(s) into your working version, and to create labeled versions of your code, which is useful when using a stable, labeled, previous version as a starting point for other code (you can check out this labled "starting point" version of your repository code even after more changes have been committed to the repository).
% mkdir RCSCheck in files you want to add to the repository (this moves them into the RCS repository):
% ci foo.c % ci blah.cCheck out file you want to work on (-l locks the file so only you can check it out to modify it):
% co -l foo.c % co -l blah.cSubsequent check-ins create a new version of the file, and you can revert to older versions by using the -r flag with co (see the man pages for co and ci for more details).
To use cvs you first need to (this is actually quite easy even though it looks like a lot of instructions):
% cd % cvs -d /home/yourusername/CVSNext, set permissions on your CVS repository so that only you and your partner(s) can access it:
% chgrp yourgroupname CVS % chmod 770 CVS
# for bash (you can put these in your .bashrc file): CVSROOT=/home/yourusername/CVS export CVSROOT CVS_RSH=/usr/local/bin/ssh export CVSROOT # for tcsh (you can put these in your .cshrc file): setenv CVSROOT /home/yourusername/CVS setenv CVS_RSH /usr/local/bin/sshTo import existing files into your repository:
# from the subdirectory containing the files and directories you want to import: % cvs import -m "Imported sources" csproject tia_and_jeff start # -m is the message written to the log # tia_and_jeff is the vender name (you can choose your vender name) # start is the release numberThis will import all files and subdirectories from your current directory into the repository as a directory tree named csproject (csproject will be a directory you can checkout from your CVS repository). At this point you can remove the your local copies of the files you just imported into the repository, and then checkout new copies from the repository (this way they are under CVS control).
CVSROOT=/home/partner_w_repository/CVS CVS_RSH=/usr/local/bin/ssh
% cd ~/private/csX/project % cvs co csproject
Once the repository is set up and you have checked-out your private copy, here are some common cvs operations:
# (1) from your working subdirector(ies) to see if any changes have been
# committed to the repository
% cvs -n update
M foo.c # your copy of this file differs from the repository version
U blah.c # a change has been committed to this file, and your version is out of date
C grr.c # you have change your copy of this file & a change was committed
# (2) to have cvs merge the committed changes into your working versions
# (its a good idea to make a copy of any files that you have changed
# and have been committed so that if cvs's auto-merging fails you can
# more easily fix the file by hand)
#
% cvs update
C grr.c # this may indicate that cvs's auto-merge couldn't completely
# merge the committed changes into this file and you may
# need to fix this by hand
# (3) to commit your changes to the repository
#
% cvs commit filename.c # commit just this file
% cvs commit # commit all your changes to files in the current directory