All information in this is based on the documentation (http://cvsgui.sourceforge.net/howto/cvsdoc/cvs_5.html#SEC61) and my practical experience
Create a branch and add a file into a branch
Step1: Checkout the path of code for which you want 2 make a branch into a new sandbox
Step2: Branch created with all files present in the directory.
$cvs tag -b BRANCH_NAME_YOU_LIKE_TO_GIVE
Step3: To verify the creation either checkout the branch or update the path with the branch details
$cvs co -d DIR_NAME -r BRANCH_NAME_YOU_LIKE_TO_GIVE CVS_PATH_OF_THE_MODULE_YOU_WANT_TO_CHECK_OUT
or go into the path where your code resides and run the below comand to update all files in that path with this branch
$cvs upd -r BRANCH_NAME_YOU_LIKE_TO_GIVE
Step3: Adding single file to the newly created branch
$cvs tag -b BRANCH_NAME_YOU_LIKE_TO_GIVE your_perl_file.pl
Merge Changes from Branch to Trunk
Consider this revision tree:
+—–+ +—–+ +—–+ +—–+
! 1.1 !—-! 1.2 !—-! 1.3 !—-! 1.4 ! <- The main trunk
+—–+ +—–+ +—–+ +—–+
! +———+ +———+
Branch R1fix -> +—! 220.127.116.11 !—-! 18.104.22.168 !
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 made on the branch,
# i.e. the changes between revision 1.2
# and 22.214.171.124, 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.
The checkout command also supports the `-j branch’ flag. The same effect as above could be achieved with this:
$cvs checkout -j R1fix mod
$cvs commit -m “Included R1fix”
$cvs co -d dirname Module
$cvs tag Tagname
This will hep you to create a snapshot of the current updated code in CVS. This is very helful we want to restore the code to this point at some time even if we have done enough coding on the HEAD.
Command to Update the code base with HEAD and BRANCH code.
# Update the sandbox with trunk
$cvs upd -A
# Update the sandbox with a branch
$cvs upd -r BRANCH_NAME