我怎样才能“强迫”树干上的树枝,万一我无法“重新融入”呢?

发布于 2024-08-30 19:59:58 字数 262 浏览 4 评论 0原文

我们从主干创建了一个分支,并在其上进行了重大重构。与此同时,主干进行了一些修改并修复了一些问题。我们希望在分支上进行这些更改,因此我们不想“赶上”将主干合并到分支,因为我们不想混合新旧代码。但如果没有这个,我无法将分支重新整合回主干。

有没有办法将分支“按原样”强加在主干上?

(我考虑的一个想法是撤消(“反向合并”)主干回到分支开始的修订版本,然后可以安全地将其合并到分支上 - 应该不会发生任何事情。然后我可以重新集成。你觉得怎么样?)

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?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山人契 2024-09-06 19:59:59

假设您可以很好地丢失这些更改,那么这是一个可以接受的解决方案,尽管您可能需要考虑简单地将当前主干重命名为分支并将分支重命名为主干:

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

尽管如此,您真的确定不想将在后备箱的变化中?您可能需要非常仔细地考虑这一点。即使您已经进行了大量重构,如果主干上的可用工作已经完成,您仍然可能需要非常仔细地查看它,以免所取得的进展被浪费。

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.

携余温的黄昏 2024-09-06 19:59:59

正如您提到的,您可以使用反向合并。签出主干

svn merge -rHEAD:RevisionTheBranchWasCreated ^/trunk

这将撤消您在创建分支后所做的所有更改。之后合并应该可以顺利进行。

更新:^/trunk 仅适用于 Linux。在 Windows 上,您需要 ^^/trunk

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文