Thursday, October 18, 2012

SVN Branching and Merging

    A basic well-written tutorial: 
    http://nedbatchelder.com/text/quicksvnbranch.html
     More advanced stuff:
    1. You branch.
    2. Someone else changed T0 on trunk. Sequence in trunk: T0
    3. You make the change T1 on your first branch. Sequence in Branch: T1
    4. You create a new branch from trunk at T2; it contains change T0. Then you merge your changes from your prior branch (the yellow arc — a Bunny Hop) into your new branch. This brings change T1 into your second branch after change T0. Sequence in your branch: T0, T1
    5. You make change T3 in your branch. Sequence in your second branch: T0, T1, T3
    6. Someone else makes change T4 in trunk. They committed to trunk first; they win. Sequence in trunk T0, T4
    7. You make your third branch, at time T5. It includes changes T0, T4 in that order. You merge all your changes from the previous branch — this means you have to do the merging necessary to make changes T1 and T3 blend in correctly after T0, T4. But you get to do this in a workspace, off of a branch, nicely isolated from trunk. It is usually pretty easy. Sequence in the branch is now T0, T4, T1, T3
    8. With no other overlapping changes between when you cut this branch and now (between T5 and T6), you merge your branch into trunk. Because all of the changes in this branch take place after the already committed changes in trunk, the merge goes smoothly.
    http://designbygravity.wordpress.com/2009/10/19/what-mother-never-told-you-about-svn-branching-and-merging/