- publishing free software manuals
Version Management with CVS - the CVS manual
by Per Cederqvist et al.
Paperback (6"x9"), 216 pages, 8 figures
ISBN 0954161718
RRP £19.95 ($29.95)

Get a printed copy>>>

5.6 Merging an entire branch

You can merge changes made on a branch into your working copy by giving the ‘-j branchname flag to the update subcommand. With one ‘-j branchname option it merges the changes made between the greatest common ancestor (GCA) of the branch and the destination revision (in the simple case below the GCA is the point where the branch forked) and the newest revision on that branch into your working copy.

The ‘-j’ stands for "join".

Consider this revision tree: The branch 1.2.2 has been given the tag (symbolic name) ‘R1fix’. The following example assumes that the module ‘mod’ contains only one file, ‘m.c’.

$ cvs checkout mod         # Retrieve the latest revision, 1.4

$ cvs update -j R1fix m.c  # Merge all changes from the branch,
                           # i.e. the changes between revision 1.2
                           # and, into your working copy
                           # of the file.

$ cvs commit -m "Included R1fix"   # Create revision 1.5.

A conflict can result from a merge operation. If that happens, you should resolve it before committing the new revision. See section 10.3 Conflicts example.

If your source files contain keywords (see section 12 Keyword substitution), you might be getting more conflicts than strictly necessary. See section 5.10 Merging and keywords, for information on how to avoid this.

The checkout command also supports the ‘-j branchname flag. The same effect as above could be achieved with this:

$ cvs checkout -j R1fix mod
$ cvs commit -m "Included R1fix"

It should be noted that update -j tagname will also work but may not produce the desired result. See section 5.9 Merging can add or remove files, for more.

ISBN 0954161718Version Management with CVS - the CVS manualSee the print edition