SVN strategy using branches, and merging changes from trunk into branch

14,251

Yes it is possible. Basically, you need to run svn merge from a clean working copy of your branch (one with no local modifications):

$ pwd
/home/user/mybranch
$ svn status # Does not display anything
$ svn update # Make sure your local copy is up to date.
Updating '.':
At revision X.
$ svn merge url/to/repository/trunk
Updates, additions, deletions and conflicts.
$ #handle conflicts.
$ svn commit -m "Merging changes from the trunk".

See Keeping a Branch in Sync from the SVN book.

The first merge is likely to introduce many conflicts, especially if the branch forked a long time ago, but latter merges will go smoothly, especially if you merge often.

Share:
14,251
Horse
Author by

Horse

Geek / Web dev / linux user

Updated on July 02, 2022

Comments

  • Horse
    Horse almost 2 years

    So long time user of SVN, but fairly inexperienced in branching / tagging, and when I have I suspect I'm not really using it correctly or to its full potential.

    I have my trunk which I work on adding new features etc. This code base is used in multiple websites, where we create a branch off the trunk on a per project basis.

    Each branch usually has modifications specific to that project, and anything we think will be re-usable is added to the trunk, and made so that feature can be toggled on and off on the various projects.

    Currently when we make changes to the trunk, and want those modifications in a pre-dated branch, I have to go through and manually merge certain revisions into the branch and recommit them. Not ideal, and easy to miss stuff.

    So, my question... is there any way to update my branch with ALL of the changes from the trunk, and deal with them as if it was a standard trunk update with conflicts?

    I have seen about reintegrating the branch to the trunk, but due to the way I am using branches in this instance, thats not really something I want to do.

  • Sertage
    Sertage almost 8 years
    I did that and after, when I tried to update the trunk from the brach, all the new classes updated from the truck were in conflict. Did I do something wrong? Or do it has to happen this way?