使用TortoiseSVN,如何合并从主干到分支的更改,反之亦然? [英] Using TortoiseSVN how do I merge changes from the trunk to a branch and vice versa?

查看:88
本文介绍了使用TortoiseSVN,如何合并从主干到分支的更改,反之亦然?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读使用出色且免费的带有Subversion的版本控制的Subversion 1.5的分支/合并. /a>书.我认为我了解如何使用Subversion命令行客户端执行我最需要的操作,即:

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:

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

在分支的工作目录中运行:

From the branch's working directory run:

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

将分支合并到主干

在中继的工作目录中运行:

From the trunk's working directory run:

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

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

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. 合并一系列修订版本
  2. 重新整合分支
  3. 合并两棵不同的树

据我所知,TortoiseSVN始终使用以下语法执行svn.

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

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

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

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

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.

我的问题是:

  1. 如何使用TortoiseSVN 1.5将更改从主干合并到分支?
  2. 无论有没有重新整合方法,如何使用TortoiseSVN 1.5将分支合并到主干中?
  3. 我应为每个选项使用以上哪个选项,为什么?


编辑

通过空运行"测试,我发现命令行中的Subversion操作

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

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

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

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

推荐答案

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

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

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

1.5之前的Subversion仅允许前两种格式.

Subversion before 1.5 only allowed the first 2 formats.

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

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

TortoiseSVN的选项在存储库为1.5+时将范围或修订版映射合并到方法3,而在存储库较旧时则合并到方法一.

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)

这篇关于使用TortoiseSVN,如何合并从主干到分支的更改,反之亦然?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆