Basic CVS Operation, by Ulli Köthe

Create a repository

module add cvs

cvs -d /path/of/repository init  # path must not be the project path
    

Use a repository

create $HOME/.cvsrc which contains:
    update -P -d
    checkout -P
    cvs -q
    diff -u3bdp
to $HOME/.cshrc add:
    setenv CVSROOT   /path/of/repository
    setenv CVSEDITOR your_favorite_editor
    setenv CVS_RSH   ssh
    module add cvs
Then, in a shell, type:
  source $HOME/.cshrc   # activate changes

Import a project into the repository

cd $HOME/src/my_project

make clean    # remove all files that shall not go to the repository

cvs import my_project $USER start

# now replace my_project with the cvs-controlled version

cd ..
mv my_project my_project.orig
cvs co my_project

diff my_project my_project.orig  # check success
                                 # expected output: 'only in my_project: CVS'

rm -rf my_project.orig           # remove old version if successful

Check out an existing project

cd $HOME/src

cvs co my_project

Retrieve changes others have made in the meantime

cvs up my_file.cpp 

Commit changed files

cvs up my_file.cpp   # check that others have not changed the file
                     # in the meantime
                     # expected output: 'M my_file.cpp'
cvs ci my_file.cpp

Add new files/directories

cvs add new_file.cpp  # file must already exist
cvs ci new_file.cpp

List differences between the repository version and your version

cvs diff my_file.cpp

Remove cvs-controlled files

cvs rm -f old_file.cpp  # remove the file from current directory
cvs ci old_file.cpp     # and then remove the file from repository

Remote access to the repository

setenv CVS_RSH   ssh

cvs -d :ext:user@kogs.informatik.uni-hamburg.de:/path/of/repository ...

More information

http://www.cvshome.org/
http://www.cvshome.org/docs/manual/cvs.html

[Valid HTML 4.0!] [Bobby Approved (v 3.1)]

Sven Utcke
last modified: 21-Nov-2002