To do this you will first need to check out the source to obtain a working
copy. This can be done into any existing
directory to which you have write permission, but for the purpose of this
example we will assume that you are using your home directory.
cd
cvs checkout testproj
The output
indicates that CVS has created the
testproj directory in your home directory and put the files:
Makefile, bar.c, foo.c, and main.c into this directory along with a
CVS directory which stores some information about the files.
You can now modify any of the project files in the testproj directory.
Once you are happy with the changes you can commit them back into
your repository. As an example,
add the following line to main.c after the the function call to bar():
printf("DONE\n");
[You can edit the file yourself or copy main2.c to main.c]
In the process of making more complex modifications to a real project
you may want to check which files you have modified and how.
The CVS commands status and diff will give you this information.
The following examples demonstrate how this works.
After you have made the above modifications to main.c, use the cvs status
command to list the status of all files in the project.
cvs status
The output
shows that main.c has been locally
modified but all other files are up-to-date. You can then use the cvs diff
command to check the precise changes you have made to main.c.
cvs diff
The output
lists the differences to each file
you have changed in the same format as the UNIX diff command.
You are now ready to check in the new copy.
cvs commit -m "Added a DONE message." main.c
The output indicates that CVS has checked in
a new version of main.c into the repository and given this a new revision
number.
Note: the -m option lets you define the check-in message on the command line
(useful for short messages).
If you omit it you will be placed into an editor where you can type in
the check-in message (useful for longer multi-line messages).
The check-in message should summarise the changes you have made and
why you made them. Such comments can be invaluable when you return to the code
at a later date. A list of the revisions you have made and the associated
comments can be retrieved with the cvs log command.
cvs log main.c
The output Lists some summary information
followed by a description of each revision starting with the most
current revision (1.2). There are currently two other revisions: revision 1.1
is the initial revision that you checked in with the the cvs import command,
you do not need to know the purpose of revision 1.1.1.1 for now.