将分支与主干合并

发布于 2024-07-11 05:41:33 字数 350 浏览 14 评论 0原文

使用 TortoiseSVN,我需要在分支中进行更改,然后将它们与主干合并。

我是这个项目的唯一开发人员,所以我知道主干没有改变。 我正在学习 SVN,以便最终我的团队可以使用它。

基本上,我希望我的树干看起来和树枝一模一样。

在 svn 之前的世界中,我只需复制分支文件夹中的文件,删除主干文件夹中的文件,然后将分支复制到主干中。

在TortoiseSVN中,我尝试了重新集成分支合并一系列修订合并两个不同的树。 似乎没有什么能真正改变主干。 我也尝试过在树干顶部分支。 这给了我一个错误,说主干已经存在。

Using TortoiseSVN, I need to take changes I've done in a branch and then merge them with trunk.

I am the only developer on this project, so I know trunk hasn't changed. I am learning SVN so that eventually my team can use it.

Basically, I want my trunk to look exactly like the branch.

In pre-svn world, I would just copy the files in my branch folder, delete the files in the trunk folder, and then copy branch into trunk.

In TortoiseSVN, I've tried Reintegrate a branch, Merge a range of revisions, and Merge two different trees. Nothing seems to actually change trunk. I've also tried branching on top of the trunk. This gives me an error, saying that the trunk already exists.

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

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

发布评论

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

评论(4

悲歌长辞 2024-07-18 05:41:33

在您的情况下:

  1. 将工作副本切换到主干(SVN 切换)
  2. 将分支合并到工作副本(SVN 合并)
  3. 确保一切仍然可以编译并正常工作
  4. 提交工作副本(主干)
  5. 考虑终止分支

团队环境我建议您首先将来自主干的最新修改合并到您的分支中,确保所有内容都编译并正常工作,然后执行上述步骤(这将是微不足道的,因为您已经测试了更改) 。


更新

在第 5 步中,我提到杀死分支。 这是因为一旦某个功能的分支进入主干,它就应该被视为主干的一部分。 在这种情况下,应该杀死该分支,以便没有人继续在其上工作。 如果该功能需要进行重大修改,您应该为此创建一个新分支。

我唯一不会终止的分支是维护和发布分支,除非不再支持特定版本。

无论如何,您始终可以访问每个修订版,因此终止分支仅用于防止其他开发人员在死分支上进行开发。

In your case:

  1. Switch the working copy to the trunk (SVN Switch)
  2. Merge the branch into the working copy (SVN Merge)
  3. Make sure everything still compiles and works
  4. Commit the working copy (the trunk)
  5. Consider killing the branch

In a team environment I would suggest that you first merge the latest modifications from the trunk in your branch, make sure that everything compiles and works, then do the above steps (which will be trivial since you've already tested the changes).


Update

In step 5, I mention killing the branch. That's because once a branch from a feature is in the trunk, it should be considered as part of the trunk. In that case the branch should be killed so that no one keeps working on it. If major modifications are needed for that feature, you should create a new branch for that.

The only branches that I don't kill are maintenance and release branches, unless a particular release is no longer supported.

No matter what, you always have access to every revision so killing a branch is only used to prevent other developers from developing on a dead branch.

以为你会在 2024-07-18 05:41:33

我认为在TortoiseSVN 1.8.5中,合并| 合并两棵不同的树应该可以。 当您将分支/标签合并回主干时,诀窍是“From URL”是主干,“To”是标签/分支。 奇怪但真实。

来源:合并

对于不在您的工作副本中但在标签/分支中,您可能会遇到冲突错误。 只需接受冲突并重做合并即可。

I think in TortoiseSVN 1.8.5, Merge | Merge two different trees should work. When you merge a branch/tag back to trunk, the trick is that the From URL is the trunk and the To is the tag/branch. Weird but true.

Source: Merging

For directories that not in your working copy but are in the tag/branch you may get conflict errors. Just accept the conflict and redo the merge.

听闻余生 2024-07-18 05:41:33

首先将您的工作副本切换到主干。
然后合并一系列修订,从分支到主干。
此对话框完成后,差异将在您的主干工作副本中挂起更改。 您需要提交它们,就像您在工作副本上手动进行更改一样。

在我的用法中,更典型的做法是在构建时保持主干运行并分离分支。 因此,我唯一需要做的合并就是从主干中修复错误并将其放在最新的构建分支上并重新发布该分支。 对我来说这是最简单的方法,因为正如您所发现的那样,合并充其量是笨拙的。 是将最新的分支和主干签出到我的机器上,并将文件从主干复制到分支并将两者签入。

First switch your working copy to the trunk.
Then do a merge range of revisions, from the branch to trunk.
Once this dialog is complete the differences will be pending changes in your working copy of trunk. You'll need to commit them just as if you manually made the changes on your working copy.

In my usage, its more typical to keep trunk running and spin branches off at the times of builds. So then the only merge I ever need to do is to get a bug fix out of trunk and put it on the latest build branch and re-release that branch. The easiest way for me to do this, since as you have found merging is clumsy at best. Is to keep the latest branch and the trunk checked out to my machine, and to quite literally copy the files from trunk to branch and check both in.

黑色毁心梦 2024-07-18 05:41:33

我使用的是 TortoiseSVN 1.9.3,Build 27038。

请按照以下步骤将分支合并到主干中。

1) 右键单击​​主干工作副本并选择以​​下选项。

输入图片此处描述

2) 如果分支合并到主干,请选择第二个选项,如下所示,然后单击下一步

在此处输入图像描述

3) 在发件人:字段中输入主干的完整文件夹 URL。 这听起来可能是错误的,但请记住主干是您要添加分支更改的起点。
在“收件人:”字段中输入功能分支的完整文件夹 URL。

输入图片此处描述

4) 单击下一步并进行测试合并

在此处输入图像描述

5) 如果测试合并成功,则单击“合并”按钮。

6) 合并成功后,将更改提交到主干上。

I am using TortoiseSVN 1.9.3, Build 27038.

Follow below steps in order to merge branch into trunk.

1) Right click on trunk working copy and select the below option.

enter image description here

2) In case of Branch Merging into trunk select option second as shown below and click next

enter image description here

3) In the From: field enter the full folder URL of the trunk. This may sound wrong, but remember that the trunk is the start point to which you want to add the branch changes.
In the To: field enter the full folder URL of the feature branch.

enter image description here

4) Click next and do the test merge

enter image description here

5) If test merge is successful then click on Merge button.

6) Once merge is successful then commit the changes on trunk.

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