SVN:将两个分支合并在一起

发布于 2024-10-04 20:42:01 字数 377 浏览 5 评论 0 原文

我们有多个开发人员致力于一个项目。我们采用功能分支方法进行分支,其中执行以下操作:

  1. 所有维护工作和错误修复都在主干上完成
  2. 所有新功能都在新分支上完成 分支
  3. 定期更新(通过合并从主干到分支的更改) )

但是,我们遇到了 2 个分支 [我们将其称为 feature-branch-1 和 feature-branch-2] 需要合并在一起的情况。实现这一目标的最佳方法是什么?我的一部分认为我们应该创建一个新的分支。然后,将该分支与第一个功能分支 [feature-branch-1] 合并。然后与第二个功能分支 [feature-branch-2] 合并并处理冲突(很可能是项目文件)。

有更好的办法吗?

谢谢你们!

We have multiple developers working on a project. We're employing a feature-branch method of branching in which we do the following:

  1. All maintenance work and bug fixes are done on the trunk
  2. All new functionality is done on a new branch
  3. Branch is updated regularly (via merging changes from trunk to branch)

However, we've run into a situation that 2 branches [we'll call them feature-branch-1 and feature-branch-2] need to be merged together. What is the best way to accomplish this? Part of me thinks we should create a new branch. Then, merge that branch with the first feature branch [feature-branch-1]. And then merge with the second feature branch [feature-branch-2] and take care of the conflicts (which will most likely be the project files).

Is there a better way?

Thanks guys!

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

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

发布评论

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

评论(4

迟月 2024-10-11 20:42:02

哦合并了。爱它。

如果你的意思是你想将 feature-branch-1、feature-branch-2 和 trunk 合并到某个新分支中,那么是的 - 你的方法很好。否则我不会浪费宝贵的时间,只需复制 feature-branch-1 并将 feature-branch-2 合并到其中即可。你可能已经这样做了,而不是问这个问题:D

Oooh the merging. Love it.

If you mean you want to combine feature-branch-1, feature-branch-2 and trunk into some new branch then yes - your way is good. Otherwise I wouldn't waste precious time and just copy feature-branch-1 and merge feature-branch-2 into it. You've probably would've done it already instead of asking this question :D

迷你仙 2024-10-11 20:42:02

这在某种程度上取决于您想要实现的目标。为什么要合并两个功能分支?如果是因为这两个功能在逻辑上“组合”,只需选择一个功能合并到另一个功能中,然后在合并的分支上进行所有开发。如果是因为其他分支中的项目存在依赖关系,那么可能仍然有足够的通用性来合并到一个分支中,然后如果确实需要,则从合并的分支中分支出来独立开发一项功能。

当两个非主干分支用于不同的功能时保持同步可能会造成很大的痛苦;如果你能帮忙的话我不会推荐它。

It depends somewhat on what you are trying to accomplish. Why do you want to merge two feature branches? If it's because the two features have logically "combined," just pick one to merge into the other, then do all your development on the merged branch. If it's because there are dependencies on items in the other branches, there is probably enough commonality still to merge into one branch, then only if truly needed, branch off the merged branch to develop a feature independently.

Keeping two non-trunk branches synchronized when they are for different features is likely to cause much pain; I wouldn't recommend it if you can help it.

望她远 2024-10-11 20:42:02

我假设你经常合并主干和分支,不是吗?如果是这样,合并后,主干和分支是相同的,您可以删除其中一个分支并继续使用另一个分支。

如果您不想合并到主干,您仍然可以将一个分支合并到第二个分支并继续使用第二个分支。

I assume you regularly merge the trunk and the branches, don't you? If so, after that merge, the trunk and the branches are the same and you can just drop one of the branches and continue using the other one.

If you don't want to merge to the trunk, you can still merge one branch into the second and continue using the second.

圈圈圆圆圈圈 2024-10-11 20:42:02

将功能分支之一的当前状态合并到主干是一种选择吗?如果是这样,我建议将该功能分支合并到主干,然后将其他功能分支更新到主干中的最新版本。这样您就可以避免创建额外的分支并删除其中一个分支。

Is merging the current state of one of the feature branches to trunk an option? If so, I recommend merging that feature branch to trunk and then updating the other feature branch to the latest in trunk. That way you avoid creating an additional branch and get rid of one of the branches.

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