minimal change-tracking for text files

D. Hugh Redelmeier hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Sat Nov 3 18:41:40 UTC 2007


[I wrote this because it seemed like something Chris needs.  Feel free
to improve it.]

It is pretty useful to keep track of changes to your config files.
And there are lots of source code control systems that can do it.  The
main trouble is that they are way too complicated for beginners.

(I have no suggestions for keeping track of changes to XML config
files.  Yuck.)

Here is a minimal description of what you need to use RCS usefully.


You need rcs.  It is available on essentially all Linux systems, but
you may have to install it from the distro's repository.  The name is
rcs.

I am only going to talk about command lines.  No GUIs.  They exist but
I don't know anything about them.  Some people use emacs programs to
do this but if you are an emacs user you already know all this.


The idea: RCS can "manage" a text file.  That means that it keeps
track of all old versions of the file.  But it only records the state
of a file when you ask it to.

The still exists but RCS keeps a parallel file in which it keeps track
of the changes.  This parallel file is best kept in an RCS
subdirectory of the directory containing the file

We are going to use RCS to keep track of changes to
	/silly/file.txt

Before you make any changes to the file, do steps 1 and 2.  If it is
already too late, you can still do them, but the baseline will then be
later.

Step 0: get in the right directory
    $ cd /silly

Step 1: enable RCS to create the parallel file in the best place:

    $ mkdir RCS

Step 2: tell RCS to deal with this file.  It will ask you for a
description.  An empty description is OK.  But if you want to remember
what the file is about, say something.  As it says, type a line with
just . to end the entry of the description.

    $ ci -l file.txt
    RCS/file.txt,v  <--  file.txt
    enter description, terminated with single '.' or end of file:
    NOTE: This is NOT the log message!
    >> this file is just a test
    >> .
    initial revision: 1.1
    done


You can now do any and all of the following any number of times.

- make any changes to file.txt

- find out the differences between the current version and what you
  last "checked in":

    $ rcsdiff -u file.txt

- check in the current file version.  You will be prompted for a
  description.  Experience shows that it is VERY useful to have a
  meaningful description of the changes.

    $ ci -l file.txt
    RCS/file.txt,v  <--  file.txt
    new revision: 1.2; previous revision: 1.1
    enter log message, terminated with single '.' or end of file:
    >> silly change
    >> .
    done

Each version ("revision") (using the above techniques) will be numbered 1.n, where
n is the number of the check-in.  Revision 1.1 is the first.

To go back to revision 1.7, use this command.  But beware: the current
version will be overwritten.

    $ co -r1.7 file.txt

To compare the current file with revision 1.7:

    $ rcsdiff -u -r1.7 file.txt

This should be enough for you to usefully manage config files.  There
are many other features available.  Try reading a less basic tutorial.
The manuals are tough sledding.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list