Branching and Merging in CVS
Let's say we want to import the excellent database abstraction layer ADOdb version 3.60 into our CVS repository:
$ wget http://phplens.com/lens/dl/adodb360.tgz
$ tar xvzf adodb360.tgz
$ cd adodb
$ cvs import -m 'Imported ADOdb 3.60' adodb PHPLENS_COM R3_60
Now that we've imported it, we can remove the directory and the download file:
$ cd ..
$ rm -fr adodb adodb360.tgz
Now, we'll check it out from CVS and fix a bug we found:
$ cvs checkout adodb
$ cd adodb
$ vi adodb.inc.php
$ cvs commit -m "Fixed bug #12345: Replace doesn't use native REPLACE command, if available"
$ cd ..
$ rm -fr adodb
Now, version 3.72 has been released, and we want to merge it in to our repository:
$ wget http://phplens.com/lens/dl/adodb372.tgz
$ tar xvzf adodb372.tgz
$ cd adodb
$ cvs import -m 'Imported ADOdb 3.72' adodb PHPLENS_COM R3_72
This command completed successfully, but reported the following:
1 conflicts created by this import.
Use the following command to help the merge:
cvs checkout -j -jR3_72 adodb
Again, we can now delete the imported directory, and download file:
$ cd ..
$ rm -fr adodb adodb372.tgz
And checkout as instructed above.
$ cvs checkout -jR3_60 -jR3_72 adodb
Let's manually resolve any conflicts that were found, if any:
$ vi adodb.inc.php
Now, let's commit our 3.60 changes into 3.72:
$ cvs commit -m 'Resolved conflicts after upgrading from ADOdb 3.60 to 3.72'
And finally, if we want, we can remove our directory:
$ rm -fr adodb
