Friday, March 25, 2011

CVS: merge changes in trunk to branch


After you have made some changes in the trunk, you can merge those changes into a branch with the following steps.

  • Tag the code before you make the changes in the trunk, e.g. TAG_TRUNK_BEFORE_CHANGES. (If you have forgot to do the tagging, see how to do it at the end.)
   cvs tag TAG_TRUNK_BEFORE_CHANGES
  • Change the code.
  • Tag the code after the changes in the trunk, e.g. TAG_TRUNK_AFTER_CHANGES.
   cvs tag TAG_TRUNK_AFTER_CHANGES
  • Check out the destination branch to which you want to merge the changes.
   cvs update -r DESTINATION_BRANCH
  • Merge the code.
   cvs update -j TAG_TRUNK_BEFORE_CHANGES -j TAG_TRUNK_AFTER_CHANGES

Remember to put the before-changes tag before the after-changes tag.
  • Verify the changes.
   cvs diff

It is likely that you have not made a tag before checking in the code changes in the trunk. If so, you can check out the code before the changes by using the date (e.g. 2011-01-23 12:34:56). Then tag it. After that, update to the latest from the trunk and continue, i.e.
  •    cvs update -D2011.01.23.12.34.56
  •    cvs tag TAG_TRUNK_BEFORE_CHANGES
  •    cvs update -A
  •    cvs tag TAG_TRUNK_AFTER_CHANGES

1 comment:

StuckWithCVS said...

There must be a way to pull all changes, whatever they may be, from HEAD of trunk without specifying tags.

With others merging their branches into trunk, I want to ensure my branch has the latest from trunk at any point during development.

 
Get This <