I’m a big fan of branching in Subversion when working on a new feature set. However, I’m also a moron who has endless trouble getting my branch to merge back into the main trunk of the repository. Thus, this guide, to help me (and you) remember the easiest way to merge a branch back into trunk.

I use TortoiseSVN version 1.6.7 so you may have to adjust these steps for your version.

  1. Merge Trunk into your Branch - you have to do this first; do it at least once a week if your trunk is actively seeing development so that your merge back is as painless as possible.

  2. Right click in the root of your checked out branch and select TortoiseSVN - Merge

  3. In the dialog that appears select “Merge From Range of Revisions”

  4. In the form put your repository trunk in and leave the revision field blank.

  5. Click the “test” button if you want; or just click Merge; depending on the size of your repo you may be waiting a while; have patience and relax…

  6. Eventually the merge will finish, when it does, check the log for any conflicts and figure out how to resolve them. There shouldn’t be many.

  7. Check in your branch noting the merge in the comments.
  8. Merge your Branch to Trunk - only do this after step one is completed.

  9. Navigate to a checked out copy of your trunk

  10. right click in the root and pick TortoiseSVN - Merge

  11. In the popup select “Merge between two branches

  12. In the from field enter your trunk path. I know this is kind of counter-intuitive but it is correct. You want to update from the trunk’s current state so that it then matches your branches current state (since you just merged trunk into your branch

  13. in the TO field put your branches path.

  14. Choose the HEAD revision for both branches

  15. Merge away (or test if you prefer)

  16. Check in the trunk noting the merge in the comments

It’s painfully simple really but It messes me up almost every time. Also, remember to update your checked out branches (your branch and trunk) before you do any of the merges.

Good coding and good luck!

Comments

Anonymous

Thanks!