Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I "force" a branch upon the trunk, in the case I can't "reintegrate"?

Tags:

branch

merge

svn

We created a branch from the trunk on which a major refactoring was done. Meanwhile, the trunk advanced a few revisions with some fixes. We don't want these changes on the branch, so we don't want to "catch-up" merge the trunk to the branch, because we don't want to mix the old and new code. But without this I can't reintegrate the branch back to the trunk.

Is there a way to impose the branch on the trunk "as-is"?

(An idea I considered is to undo ("reverse-merge") the trunk back to the revision where the branch started, and then it is safe to merge it on branch - nothing should happen. Then I can reintegrate. What do you think?)

like image 251
davka Avatar asked May 03 '10 17:05

davka


2 Answers

Assuming that you are fine losing those changes then that is an acceptable solution, although you might want to consider simply renaming the current trunk to a branch and renaming the branch to trunk:

svn move https://path/to/repo/trunk https://path/repo/branches/newbranchname
svn move https://path/to/repo/branches/refactoring https://path/to/repo/trunk

Although, are you really sure that you don't want to bring in the changes from trunk? You might want to consider that very carefully. Even if you have done lots of refactoring, if usable work on trunk has been made, you still might want to look at it very carefully so that the progress made doesn't go to waste.

like image 126
Michael Aaron Safyan Avatar answered Oct 18 '22 14:10

Michael Aaron Safyan


You can use, as you mentioned the reverse merge. Checkout the trunk

svn merge -rHEAD:RevisionTheBranchWasCreated ^/trunk

This will undo all changes you've made after the branch has been created. After that the merging should be working without any problems.

Update: ^/trunk will only work on Linux. On Windows you need ^^/trunk instead.

like image 43
khmarbaise Avatar answered Oct 18 '22 15:10

khmarbaise