Archive for the ‘svn’ category

SVN: Handling merging of multiple branches up and down from trunk

December 17th, 2008

I’ve been away from code and SVN branch merges a little recently so I forgot the exact process of handling multiple branches merging up and down from trunk.

After a little thought and partially effective googling, i found that the following is an efficient process:

Introduction – What I had

  • trunk
  • branch_a created at SVN revision 2111
  • branch_b created at SVN revision 2113

Step 1 – Preparation – Checkout local copies of trunk, branch_a, and branch_b

  1. cd ~/
  2. svn co http://svn_repository/trunk ./trunk
  3. svn co http://svn_repository/branches/branch_a ./branch_a
  4. svn co http://svn_repository/branches/branch_b ./branch_b
  5. I ensured that all changes had been committed to trunk and both branches

Step 2 – Merging branch_a back to trunk after a successful rollout

  1. cd ~/trunk
  2. svn merge http://svn_repository/trunk http://svn_repository/branches/branch_a
  3. svn commit -m “merged branch_a into trunk”

Step 3 – Merging the newly updated trunk into branch_b

  1. cd ~/branch_b
  2. svn merge http://svn_repository/trunk -r2113:HEAD .
  3. svn commit -m “merged up from trunk, applying changes between 2113:HEAD that included changes made on branch_a”

Step 4 – When i’m ready, i’ll merge branch_b back into trunk, following Step 2 above

That’s it!