RCS - Revision Control System:

RCS stands for Revision Control System. It is application system to manage multiple revisions of files. The RCS intro description states "RCS automates the storing, retrieval, logging, identification, and merging of revisions. RCS is useful for text that is revised frequently, for example programs, documentation, graphics, papers, and form letters."

RCS is easy to learn, and the man pages for RCS can be very helpful, and this guide basically highlights what is in those man pages. There are three main functions needed for version control; creating a revision archival entry, checking in entries and checking out entries. Use man rcsintro, man rcs, man ci and man co to learn more. Users can add tags to their files such as when the file was updated, what was changed and who updated it; RCS automatically manages the updating of those tags. Use man rcs for more details and a walk-through example.

Create An Entry

If you have a file you want to put under revision control, use rcs file. This will create a file, file.V, which is the archival entry. I use rcs -i file to create an archive entry but with no initial revision. Where the archive is stored depends on your preference. If you want a special, separate directory for the archive, create a directory, ./RCS, and the archive will be stored in that directory. If there is no ./RCS directory the archive will be stored in the current directory. I find it easier to keep track of what's happening if file and the archive file.V are together in the same path directory, so I don't create a RCS directory; the choice is yours. Once you have created an entry, you'll eventually want to check it in to save the initial revision. Use man rcs for more details on creating an initial archive.

Check-In

To check-in, use ci file. You will be prompted for a log message. Type your log message; you can use the Enter key and the log can be several lines long. When you are finished, enter . on a line by itself. Use man ci to learn more, especially about revision numbering.

Check-Out

When you check-in file, file is removed and all you have left is the archive file.V. Don't worry; the contents of file are stored in the archive. You do not edit the archive, but rather check-out a copy of file from the archive to edit. The command is co file, and it gives you a copy of file. co file,V does the same thing. Use man co for more details. I typically use co -l file, since it locks file. Locking means others can't check-in their edited copy of file until I either check-in (ci file) or release the lock by deleting the file (rm file). Whether or not to lock file comes into play when multiple people are working on the same file and changes have to be checked-in and merged. Since I'm the only one editing my files, I always create a lock so there are no warnings when editing or checking-in file. The various man pages provide more details on how this and also tell you how to get a revision other than the most recent one.

Tips and Tricks

If you have aliased ci to ci -l or ci -u, but need to use the regular default behavior for ci, simply use ci -r.

When you check-in a file, file is deleted and the contents are stored in file,V. To get a copy of file you need to check it out again. If you use ci -l, RCS will auto check-out and lock file for you for editing. If you use ci -u it will auto check-out in read-only mode.

If you check out fileand need to revert back to the original, it's no problem. Simply delete file and check-out a new copy. Don't delete file,V, but rather file.

Tags

Tags (also called keywords) in RCS begin and end with a dollar sign. RCS automatically searches through the file during check-in and updates the value associated with the keyword. Details on the keyword-value pairs can be found using man co.

$Author$, $Date$, $Revision$, $Log$ and $Id$ are common tags to add to a file.

Useful Links: