SVN/Subclipse:从分支返回主干
我有一个前段时间从主干创建的分支。自从我创建了分支以来,我就没有碰过主干。现在,我想从分支返回到主干。这是一个非常简单的情况,因为没有太多合并要做。后备箱里没有任何变化。树枝完全可以代替主干。
在我看来,我有两个选择:
- 删除主干(将其重命名为其他名称,稍后删除)并将分支重命名为主干。
- 将分支合并到主干(将我的工作副本移动到主干并使用分支中的合并命令)。
我不确定哪个选项是首选。对我来说,维护修订上下文(不要破坏修订图)很重要。
有什么想法吗?
I have a branch which I created from the trunk some time ago. Since I created the branch, I didn't touch the trunk. Now, I want to return from the branch to the trunk. This is a very simple case, since there's not much merging to do. Nothing changed in the trunk. The branch can fully replace the trunk.
As I see it, I have two options:
- Delete the trunk (rename it to something else, delete it later) and rename the branch to be the trunk.
- Merge the branch to the trunk (move my working copy to the trunk and use the Merge command from the branch).
I'm not sure which option is preferred. It is important for me to maintain the revision context (not to break the revision graph).
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您确实应该使用合并选项。由于所有更改都将在 1 次提交内,因此丢失修订信息的论点可以忽略不计,因为颠覆合并跟踪将保留此信息。如果您仍然有 1.5 之前的安装,您可以在提交消息中记下修订范围和分支路径。
由于您没有更改主干中的任何内容,因此合并将是理所当然的,正如您所说:(
当然您的工作副本应该指向主干)
您评论的答案
svn 1.4 没有合并跟踪,所以你应该不回滚
为什么你不应该将分支重命名为主干:
这不是你应该工作的方式在你的简单设置中这将起作用,但是,你的主干将被删除并且所有文件将再次添加,但您无法轻松跟踪更改的文件,因为在您的操作中所有文件都已添加。
如果合并,则只有您在分支中更改的文件才会显示为已修改。
此外,旧主干中的所有工作副本都将失效(当您单独工作时,这可能并不重要),因此您需要再次检查它们。
You really should use the merge option. The argument of loosing revision information as all changes will be inside 1 commit is negligible, as subversions merge-tracking will preserve this information. If you still have a pre-1.5 installation, you can note the revision range and the branch-path in your commit message.
As you did not change anything in trunk, the merge will be a no-brainer, as you just say:
(Of course your Working copy should point to trunk)
Answers to your comment
svn 1.4 has no merge tracking, so you should not rollback
Why you should not rename branch to trunk:
This is just not the way you should work In your simple setup this would be working, however, your trunk will be deleted and all files will be added again, but you cannot easily track the changed files, as in your action all files were added.
If you merge, only files you changed in branch will be displayed as modified.
Also all workingcopys from old trunk will be invalidated(as you work alone, this may not be important), so you need to check out them again.
在你的情况下,我更喜欢第一个选项,另一种方式是你在分支中所做的所有修改都将作为一个修订应用到主干。因此您会丢失这些更改的修订信息。如果您将分支移动到旧主干目录的位置,修订信息将保持不变。
In your case I would prefer the first options The other way around all modifications you done in the branch are applied as one revision to the trunk. So you loose the revision information for those changes. If you move the branch to the location of your old trunk directory revision information stays intact.
我认为最简单的方法(真的不知道这是否是最好的方法)是使用“svn move”以便执行第一个选项。
svn 中的复制和移动应该像文件操作一样工作,而且这些更改也是版本化的。
编辑:我的答案几乎就像 VonC 提到的先前主题的答案之一,所以你应该看看这个答案
I think the easiest way (dont really know if it is the best to do) is to use "svn move" inorder for you to execute the first option.
Copy and move in svn should work like file operations, also these changes are versioned.
EDIT: My answer was almost like one of the answers on the previous topics mentioned by VonC so you should take a look at this answer