How Do I Merge Changes Across CVS Branches?

If you are a developer which makes modifications to one branch of the CVS repository that you would like to see reflected in another branch of the CVS repository, you will want to use the merging capabilities of CVS (use info cvs for detailed CVS documentation).

The following figures demonstrate how one merges between the HEAD branch and the rh9 branch:

Figure 4.4. Merging From HEAD Branch to rh9 Branch

[root]# cd /opt/nst/rh9/src/docs
[docs]# cvs update -j HEAD faq/source.xml
Merging differences between 1.16 and 1.17 into source.xml
[docs]# cvs commit faq/source.xml
[docs]# 

Figure 4.5. Merging From rh9 Branch to HEAD Branch

[root]# cd /opt/nst/fc2/src/docs
[docs]# cvs update -j rh9 user/scripts.xml
Merging differences between 1.16 and 1.17 into scripts.xml
[docs]# cvs commit user/scripts.xml
[docs]# 

Warning

It is possible to recursively merge entire directories (include the -Pd option as you normally would). However, one needs to be EXTREMELY careful prior to doing so as its very easy to merge in incompatible code.