Next: , Previous: , Up: Branching and merging   [Contents][Index]


5.8 Merging differences between any two revisions

With two ‘-j revision’ flags, the update (and checkout) command can merge the differences between any two revisions into your working file.

$ cvs update -j 1.5 -j 1.3 backend.c

will undo all changes made between revision 1.3 and 1.5. Note the order of the revisions!

If you try to use this option when operating on multiple files, remember that the numeric revisions will probably be very different between the various files. You almost always use symbolic tags rather than revision numbers when operating on multiple files.

Specifying two ‘-j’ options can also undo file removals or additions. For example, suppose you have a file named file1 which existed as revision 1.1, and you then removed it (thus adding a dead revision 1.2). Now suppose you want to add it again, with the same contents it had previously. Here is how to do it:

$ cvs update -j 1.2 -j 1.1 file1
U file1
$ cvs commit -m test
Checking in file1;
/tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
new revision: 1.3; previous revision: 1.2
done
$