Skip to content

Branching, Rebasing and Merging

Solar eclipse

I’ve created a branch in our CVS-repository some time ago. If only I knew… ;-) Today – actually yesterday – I decided to merge my changes back into the head or trunk as it seems to be also called.

I couldn’t find anyone to help me out on this one so I had to do some research on my own. Since we are using Eclipse and it’s built-in CVS-functionality I first did a search on merge eclipse which came up with Branching with Eclipse and CVS. What an awesome document. It goes into much detail on how to branch, and how to merge. It even briefly comes to speaking about rebasing. Another search on rebase cvs didn’t bring much success. Based on the text on rebasing in that document and since I wanted to do everything right, I tried to rebase my branch. Oh, heck. Frankly, I didn’t understand much of that document. It was not at all clear to me, from the explaination given, what a ‘starting point’ is supposed to be. I tried some combinations but was not sure if my guts where right.

BTW rebasing means that one does not merge back into head, first, but rather merges the head into the branch. After that the branch will be merged into the head which should not – after the first phase – require much changes. Actually none at all. I cannot see the overall benefit from that practice, though.

After rebasing did not work smoothly it came to my mind that that document obviously does not fit my cerebral twists (does this metaphor also exist in english?). So I googled again. And found Merging from a branch. Nice. Brief, to the point, understandable. I merged (not rebased) my branch. I.e. I merged my branch to the head as described in that small document. Merging is quite some manual work. Since this was my first merge I didn’t trust some auto-merging facility that might exist somewhere in the Eclipse-GUI.
It does seem to work now.

Coming back from lunch I realise that rebasing is a way to update your branch with changes from the head. Usually one does not notice changes to the head while working in a branch. This would sometimes lead to inconsistencies in other parts of the code which are not branched and depend on these changes in the head. So it’s re-basing – synching with the base again. Interesting.

Under CVS Best Practices you can find further information on how to use CVS efficiently. Good luck.

When merging or rebasing with Eclipse make sure to switch off Project -> build automatically. This will speed up the process a ‘bit’. ;-)

{ 1 } Comments

  1. Mark | 2008/5/7 at 05:14 | Permalink

    Nice blog. You are right about there not being much on the Interweb that discusses much more than the mechanics of merging – not much in the way of methodology.

Post a Comment

Your email is never published nor shared. Required fields are marked *