1<div id="Merging-two-revisions"></div> 2<div class="header"> 3<p> 4Next: [[cvs: Merging can add or remove files#Merging can add or remove files|Merging adds and removals]], Previous: [[cvs: Merging from a branch several times#Merging from a branch several times|Merging more than once]], Up: [[cvs: Branching and merging#Branching and merging|Branching and merging]] |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p> 5</div> 6 7---- 8 9<div id="Merging-differences-between-any-two-revisions"></div> 10=== Merging differences between any two revisions === 11<div id="index-Merging-two-revisions"></div> 12<div id="index-Revisions_002c-merging-differences-between"></div> 13<div id="index-Differences_002c-merging"></div> 14 15With two ‘<code>-j <var>revision</var></code>’ flags, the <code>update</code> 16(and <code>checkout</code>) command can merge the differences 17between any two revisions into your working file. 18 19<div id="index-Undoing-a-change"></div> 20<div id="index-Removing-a-change"></div> 21<div class="example" style="margin-left: 3.2em"> 22 $ cvs update -j 1.5 -j 1.3 backend.c 23</div> 24 25will undo all changes made between revision 261.3 and 1.5. Note the order of the revisions! 27 28If you try to use this option when operating on 29multiple files, remember that the numeric revisions will 30probably be very different between the various files. 31You almost always use symbolic 32tags rather than revision numbers when operating on 33multiple files. 34 35<div id="index-Restoring-old-version-of-removed-file"></div> 36<div id="index-Resurrecting-old-version-of-dead-file"></div> 37Specifying two ‘<code>-j</code>’ options can also undo file 38removals or additions. For example, suppose you have 39a file 40named ‘<tt>file1</tt>’ which existed as revision 1.1, and 41you then removed it (thus adding a dead revision 1.2). 42Now suppose you want to add it again, with the same 43contents it had previously. Here is how to do it: 44 45<div class="example" style="margin-left: 3.2em"> 46 $ cvs update -j 1.2 -j 1.1 file1 47 U file1 48 $ cvs commit -m test 49 Checking in file1; 50 /tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1 51 new revision: 1.3; previous revision: 1.2 52 done 53 $ 54</div> 55 56This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>]. 57