使用 TortoiseSVN 如何将更改从主干合并到分支,反之亦然?

发布于 2024-07-09 16:42:39 字数 1438 浏览 6 评论 0原文

我一直在使用优秀且免费的 Version Control with Subversion 阅读有关 Subversion 1.5 的分支/合并的内容书。 我认为我了解如何使用 Subversion 命令行客户端来执行我最常需要的操作,这些操作是:

使用主干中的更改更新分支

从分支的工作目录运行:

svn合并http://svn.myurl.com/proj/trunk

合并分支到Trunk

从 trunk 的工作目录运行:

svn merge --reintegrate http://svn.myurl.com/proj/branches/mybranch

然而,我们使用 TortoiseSVN 1.5 作为 Subversion 的接口。 我想知道如何使用 TortoiseSVN 最好地执行这些操作。 新对话框在主菜单上提供了三个不同的选项。

  1. 合并一系列修订
  2. 重新集成分支
  3. 合并两个不同的树

据我所知,TortoiseSVN 总是使用以下语法执行 svn。

svn merge [--dry-run] --force From_URL@revN To_URL@revM 路径

此外,重新集成分支经常失败,并显示一条消息,指出某些目标尚未合并,因此无法继续,因此我不得不使用选项#3。

我的问题是:

  1. 如何使用 TortoiseSVN 1.5 将更改从主干合并到分支?
  2. 如何使用 TortoiseSVN 1.5 将分支合并到主干,无论是否使用重新集成方法?
  3. 我应该为每个选项使用上述哪些选项,为什么?

编辑

通过“空运行”测试我发现命令行Subversion操作

svn合并http://svn.myurl.com/proj/trunk

类似于选项#1 (合并修订范围)在 TortoiseSVN 中,只要我将修订范围留空即可。

I've been reading up on branching/merging with Subversion 1.5 using the excellent and free Version Control with Subversion book. I think that I understand how to use the Subversion command line client to perform the actions that I need most often, which are:

Update Branch with Changes from Trunk

From the branch's working directory run:

svn merge http://svn.myurl.com/proj/trunk

Merge Branch into Trunk

From the trunk's working directory run:

svn merge --reintegrate http://svn.myurl.com/proj/branches/mybranch

However, we are using TortoiseSVN 1.5 as our interface to Subversion. I would like to know how best to perform these operations with TortoiseSVN. The new dialog provides three different options on the main menu.

  1. Merge a range of revisions
  2. Reintegrate a branch
  3. Merge two different trees

From what I can gather, TortoiseSVN always executes svn with the following syntax.

svn merge [--dry-run] --force From_URL@revN To_URL@revM PATH

Additionally, reintegrate a branch often fails with a message stating that some targets have not been merged and so it cannot continue, and so I had to use option #3.

My questions are:

  1. How do I use TortoiseSVN 1.5 to merge changes from the trunk to a branch?
  2. How do I use TortoiseSVN 1.5 to merge the branch to the trunk, with and without the reintegrate method?
  3. Which of the above options should I use for each, and why?

EDIT

Through "dry run" testing I have found that the command line Subversion operation

svn merge http://svn.myurl.com/proj/trunk

is analogous to option #1 (Merge a Range of Revisions) in TortoiseSVN, as long as I leave the revision range blank.

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

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

发布评论

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

评论(5

唯憾梦倾城 2024-07-16 16:42:39

我无法正确遵循其他答案,这里有更多傻瓜指南...

您可以以任何一种方式执行此操作以转到 trunk ->; 分支分支-> 树干。 我总是先做trunk -> 分支 修复那里的任何冲突,然后合并分支 -> 树干

将主干合并到分支/标签

  1. 签出分支/标签
  2. 右键单击分支的根| 乌龟SVN | 合并...
  3. 合并类型:合并一系列修订| 点击下一步'
    在此处输入图像描述
  4. 合并修订范围: 选择您复制到的 trunk 目录的 URL分支/标签。 输入要合并的修订或将该字段留空以合并所有修订 | 点击下一步'
    在此处输入图像描述
  5. 合并选项: 我只是将这些保留为默认值 | 单击“合并”
    在此处输入图像描述
  6. 这会将修订合并到签出的分支/标签中
  7. ,然后将合并的更改提交到分支/标签

I couldn't properly follow the other answers, here's more of a dummies guide...

You can do this either way round to go trunk -> branch or branch -> trunk. I always first do trunk -> branch fix any conflicts there and then merge branch -> trunk.

Merge trunk into a branch / tag

  1. Checkout the branch / tag
  2. Right-click on the root of the branch | Tortoise SVN | Merge ...
  3. Merge Type: Merge a range of revisions | Click 'Next'
    enter image description here
  4. Merge revision range: Select the URL of the trunk directory that you copied to the branch / tag. Enter the revisions to merge or leave the field empty to merge all revisions | click 'Next'
    enter image description here
  5. Merge options: I just left these as default | click 'Merge'
    enter image description here
  6. This will merge the revisions into the checked out branch / tag
  7. Then commit the merged changes to the branch / tag
一笑百媚生 2024-07-16 16:42:39

该行为取决于您的存储库具有的版本。 Subversion 1.5 允许 4 种类型的合并:

  1. 合并 sourceURL1[@N] sourceURL2[@M] [WCPATH]
  2. 合并 sourceWCPATH1@N sourceWCPATH2@M [WCPATH]
  3. 合并 [-c M[,N...] | -r N:M ...] SOURCE[@REV] [WCPATH]
  4. merge --reintegrate SOURCE[@REV] [WCPATH]

1.5 之前的 Subversion 只允许前 2 种格式。

从技术上讲,您可以使用前两种方法执行所有合并,但后两种方法启用 Subversion 1.5 的合并跟踪。

当您的存储库为 1.5+ 时,TortoiseSVN 的选项将范围或修订映射合并到方法 3,或者当您的存储库较旧时合并到方法一。

将功能合并到发布/维护分支时,您应该使用“合并一系列修订”命令。

仅当您想要将分支的所有功能合并回父分支(通常是主干)时,您才应该考虑使用“重新集成分支”。

最后一个命令 - 合并两个不同的树 - 仅当您想要跳出正常的分支行为时才有用。 (例如比较不同的版本,然后将差异合并到另一个分支)

The behavior depends on which version your repository has. Subversion 1.5 allows 4 types of merge:

  1. merge sourceURL1[@N] sourceURL2[@M] [WCPATH]
  2. merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH]
  3. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [WCPATH]
  4. merge --reintegrate SOURCE[@REV] [WCPATH]

Subversion before 1.5 only allowed the first 2 formats.

Technically you can perform all merges with the first two methods, but the last two enable subversion 1.5's merge tracking.

TortoiseSVN's options merge a range or revisions maps to method 3 when your repository is 1.5+ or to method one when your repository is older.

When merging features over to a release/maintenance branch you should use the 'Merge a range of revisions' command.

Only when you want to merge all features of a branch back to a parent branch (commonly trunk) you should look into using 'Reintegrate a branch'.

And the last command -Merge two different trees- is only usefull when you want to step outside the normal branching behavior. (E.g. Comparing different releases and then merging the differenct to yet another branch)

爱你是孤单的心事 2024-07-16 16:42:39

您应该使用“合并一系列修订”。

要将更改从主干合并到分支,请在分支工作副本内选择“合并修订范围”,然后输入主干 URL 以及要合并的开始和结束修订。

同样以相反的方式合并主干中的分支。

关于 --reintegrate 标志,请在此处查看手册: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-merge.html#tsvn-dug-merge-reintegrate

You should use "merge a range of revision".

To merge changes from the trunk to a branch, inside the branch working copy choose "merge range of revisions" and enter the trunk URL and the start and end revisions to merge.

The same in the opposite way to merge a branch in the trunk.

About the --reintegrate flag, check the manual here: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-merge.html#tsvn-dug-merge-reintegrate

儭儭莪哋寶赑 2024-07-16 16:42:39

查看 svnmerge.py。 它是命令行,不能被TortoiseSVN调用,但它更强大。 来自常见问题解答

颠覆传统让你
合并更改,但没有
“记住”您已经合并的内容。
也没有提供方便
排除变更集的方法
合并了。 svnmerge.py 自动化一些
工作,并简化它。 斯文梅尔格
还创建一条提交消息
记录来自所有事物的消息
合并。

Take a look at svnmerge.py. It's command-line, can't be invoked by TortoiseSVN, but it's more powerful. From the FAQ:

Traditional subversion will let you
merge changes, but it doesn't
"remember" what you've already merged.
It also doesn't provide a convenient
way to exclude a change set from being
merged. svnmerge.py automates some of
the work, and simplifies it. Svnmerge
also creates a commit message with the
log messages from all of the things it
merged.

半衾梦 2024-07-16 16:42:39

Shift-右键单击该文件夹并选择 TortoiseSVN -> 全部合并

Shift-Right Click on the folder and select TortoiseSVN -> Merge All

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