I'm working with an svn setup I'm not used to and I need to merge new code from one branch to another.
There's no code in the trunk folder so I don't know if I should update the trunk to the code and update the second branch, OR if there is a way to just update one branch to the other. My last resort is going to be just updating the code manually.
Any ideas what the best route here is? I'm doing everything from a terminal.
No Don't update manually. Of course the difficulty will depend on how close those branches are.
You can always bring changes from a branch to another branch. Let's say you have two branch named branch1 and branch2 and you want to merge branch2 to branch1.
Say you are in branch1 (Try the dry run first to see if it results in conflicts)
svn merge -r LAST_MERGED_REVISION:HEAD_REVISION --dry-run url/to/branches/branch2 .
svn merge -r LAST_MERGED_REVISION:HEAD_REVISION url/to/branches/branch2 .
svn status | egrep '^C|^.C' <---Manual intervention is required for conflicts
svn update
svn ci -m "Merge changes from branch2"
And you can close out branch2
svn merge --reintegrate url/to/branches/branch2
svn update
svn ci -m "Merged branch2 to branch1"
This may fail in case the branches are very divergent.
Depending on what subversion release you are using, I recommend to use svnmerge, or subversion's builtin merge tracking support. In any case, it is well possible to merge from one branch to another, without using the trunk (assuming that the branches have some relatively-close ancestor).
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