How to move a specific trunk revision and its subsequent edits to a branch? [duplicate]
We realized that we would like some work in the trunk to have actually have been in a branch. We would like several commits to go into a branch, and preferably, we would preserve the history of the commits. So:
r0 --- r1 --- r2 --- r3
wou开发者_JAVA百科ld become
branch --- r2 --- r3 / r0 --- r1 ----- *
Where "*" is where we will start making new commits to the trunk. I'm nervous that I'll destroy our repository if I do something incorrectly. Please advise, thank you!
Basically the current status of trunk is good for the branch, so you should just do a server-side svn copy
from trunk
to the desired branches
subdirectory:
svn copy svn://path/to/trunk svn://path/to/branches/foo -m "Creating branch Foo"
Then you would need to revert trunk to r1, which is easily achieved by either applying a reverse patch from r1 to r3 or by actually using svn merge:
svn merge r3:r1 svn://path/to/trunk
EDIT: Actually, there's a better solution here: How do I properly branch post-commit and revert the trunk in svn?
精彩评论