How to use RCS (simplified pattern)

The CS UNIX systems provide a Revision Control System (RCS) that is useful for keeping track of program development. It records revisions to an existing program and makes every version of the program available with little overhead cost for memory. Of course, it may be used to keep track of changes to any type of text file, not only programs.

Begin in the directory in which you will be working on the program. If the program you will revise is already in the RCS system, begin at step 3. Otherwise, create a subdirectory named RCS if one does not already exist:

% mkdir RCS

If the program to be revised is not already in the RCS system, it must be checked in so that RCS has a copy of the initial version. This is done with the command ci for check-in, i.e.:

% ci -l program.c

RCS will prompt you to give a short description of the program or file.

Now edit the program and debug it as you normally would, until it is revised to your satisfaction.

When you are finished, check program back in:

% ci -l program.c

RCS will prompt you to describe the changes you've made. It will accept up to about twenty lines of explanation.

If, before checking the program in, you decide that you do not like the changes you've made, just check-out the program:

% co -l program.c

RCS will prompt you as to whether you really want to over-write your current working version. You may need to re-load the file into your editor; the edit buffer will not be changed automatically.

If you want to check out the program for reading only, use

% co -u program.c

This will give you an unlocked version, which can't be modified. Do not manually change the permissions to get a modifable version. Instead, use

% co -l program.c

again if you want a modifiable version.

Notes:

You may use the command

% rlog program.c 

to see the record of all the changes that have been made to program.c:

The command rcsdiff will print out every line that was changed from one specified version to the next. For instance, to see what the differences between revision 1.4 and 1.7 of program.c are, you would type

% rcsdiff -r1.4 -r1.7 program.c

If by chance you revise a file that was not locked when it was checked out, you can use the rcs command to lock it:

% rcs -l program.c

Then you will be able to check it back in.


This file was last modified on 2/18/97.

Robert M. Keller