The power of image – merging in SVN

I’ve recently read a short explanation of joining in SQL. I was simply amazed how ease it was to explain fairly complicated matter with few well chosen pictures. Please read it, no matter how good are you in SQL – it will surely help you next time you will have to explain joining in SQL to someone else.
I’ve decided to try the same way to taking SVN branching and merging as a target.
To remind you. When you are using the source control system like Subversion (SVN) you can always branch. Meaning you can take a copy of your current sandbox and check it in as a new “path of development” in your SVN server. From now on can work either on your origin branch or newly created branch. The two branches are not separated eternally. You can always merge them. But it is not so ease at the first time. It will take a while to grasp the details.
Lets say we have a main branch of development placed in /trunk and we’ve branched it at revision 101 to /branches/x (r102). Someone works on /trunk (fixing bugs) and someone else on /branches/x (making a new design). The /branches/x is to by merged someday with /trunk, but in a mean while you don’t want the two branches to drift to far apart.
What will you do? Merge your last revision in /branches/x with your last revision in /trunk right? Well it is not so easy! You have to merge the /trunk at revision you branched to the HEAD with you working copy. Not so clear, right? Lets look at this image.
image
You’ve branched at revision 101 and right now you are on revision 110 at you /trunk. And you want all the changes in your /branches/x – not to drift to far away. So you have to start at r101 and go all the way to r110 and apply all the changes to your working copy.
In tortoise it would like this:
image
The same thing is when you are merging the changes in your /branches/x with the /trunk.
image
You have to traverse all over you /branches/x from the time you’ve separated from /trunk to the last change you’ve made in /branches/x and apply everything to your working copy. Voila!

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *