Go to the first, previous, next, last section, table of contents.

Examining And Comparing Old Versions

C-u C-x C-q version RET
Select version version as the current work file version.
C-x v ~ version RET
Examine version version of the visited file, in a buffer of its own.
C-x v =
Compare the current buffer contents with the latest checked-in version of the file.
C-u C-x v = file RET oldvers RET newvers RET
Compare the specified two versions of file.

There are two ways to work with an old version of a file. You can make the old version your current work file, for example if you want to reproduce a former stage of development, or if you want to create a branch from the old version (see section Multiple Branches of a File). To do this, visit the file and type C-u C-x C-q version RET. (This works only with RCS.)

If you want only to examine an old version, without changing your work file, visit the file and then type C-x v ~ version RET (vc-version-other-window). This puts the text of version version in a file named `filename.~version~', and visits it in its own buffer in a separate window.

To compare two versions of a file, use the command C-x v = (vc-diff). Plain C-x v = compares the current buffer contents (saving them in the file if necessary) with the last checked-in version of the file. C-u C-x v =, with a numeric argument, reads a file name and two version numbers, then compares those versions of the specified file.

If you supply a directory name instead of the name of a work file, this command compares the two specified versions of all registered files in that directory and its subdirectories. You can also specify a snapshot name (see section Snapshots) instead of one or both version numbers.

You can specify a checked-in version by its number; an empty input specifies the current contents of the work file (which may be different from all the checked-in versions).

This command works by running the diff utility, getting the options from the variable diff-switches. It displays the output in a special buffer in another window. Unlike the M-x diff command, C-x v = does not try to locate the changes in the old and new versions. This is because normally one or both versions do not exist as files when you compare them; they exist only in the records of the master file. See section Comparing Files, for more information about M-x diff.


Go to the first, previous, next, last section, table of contents.