如何正确分支后提交并还原svn中的中继? [英] How do I properly branch post-commit and revert the trunk in svn?
问题描述
事实上,我已经决定要进行一些分支工作,而不是主干工作。如何创建分支并还原主干,同时又确保以后不会痛苦呢?
I have some commits that I've decided, after the fact, are going to be more branch work then trunk work. How do I create the branch and revert the trunk while still ensuring merging isn't painful later?
是否简单到将当前主干复制到分支并还原主干?树干?还是会在以后引起头痛?
Is it as simple as copying the current trunk to a branch and reverting the trunk? Or will this create headaches later?
推荐答案
我认为Philips的方法将类似于以下内容,假设最后一次好的修订当时是100,而现在是130,创建新分支:
I think Philips method would be something like the following, assuming the last "good" revision was at 100 and you are now at 130, to create the new branch:
svn copy -r100 svn://repos/trunk svn://repos/branches/newbranch
svn merge -r 100:130 svn://repos/trunk svn://repos/branches/newbranch
请注意,这样做的目的是保留在这些修订中所做的更改,以便您可以将其应用回主干。
Note the idea is to preserve the changes made in those revisions so you can apply them back to trunk.
还原中继:
svn merge -r130:100 .
svn ci -m 'reverting to r100 (undoing changes in r100-130)' .
(执行这些命令的顺序无关紧要,因此您可以在创建分支。)
(It wouldn't matter which order you performed these in, so you could revert trunk before creating the branch.)
然后,您可以切换到在存储库中创建的新分支:
Then you could switch to the new branch you created in the repo:
svn switch svn://repos/branches/newbranch workdir
这篇关于如何正确分支后提交并还原svn中的中继?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!