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.
To merge a range of revisions, use svn merge -r start:end from to where start and end are revision IDs. This will merge all revisions starting at start+1 up to and INCLUDING end . Note: it will NOT include the first revision (ex: -r3:45 will merge 4 through 45).
It never should have been committed. You can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With