2

我有两个分支:X 和 Y。我想用 X (x1) 中的等效项替换 Y 的子目录 (y1)。

目前,我执行以下操作:将 x1 复制到 Y,删除 y1,将 x1 重命名(移动)到 y1:

a) svn copy https://path/to/branches/X/x1 https://path/to/branches/Y/
b) svn delete https://path/to/branches/Y/y1
c) svn move https://path/to/branches/Y/x1 https://path/to/branches/Y/y1

我觉得挺丑的。。。

我怎样才能以更聪明的方式做到这一点?

4

4 回答 4

3

如果你真的想替换目录,你可以通过两个操作来做到这一点:

svn delete https://path/to/branches/Y/y1
svn copy https://path/to/branches/X/x1 https://path/to/branches/Y/y1

如果 Y/y1 确实已经是 X/y1 的旧副本,则不应一直替换它,而应合并自上次合并以来的所有更改。

于 2008-12-17T09:16:25.727 回答
1

为什么不只是两个步骤:

a) svn delete https://path/to/branches/Y/y1
b) svn copy https://path/to/branches/X/x1 https://path/to/branches/Y/y1
于 2008-12-17T09:18:43.990 回答
1

将分支 Y 检出到一个新的工作副本,然后把自己放在那里。

svn co https://path/to/branches/Y Y
cd Y

合并将 Y/y1 转换为 X/x1 到 Y/y1 所需的更改

svn merge https://path/to/branches/Y/y1 https://path/to/branches/X/x1 y1

提交这个

svn commit -m "Y/y1 now has the same contents as X/x1"

如果 y1 的名称与 x1 不同(您的描述不清楚),请重命名:

svn mv y1 x1
svn commit -m "Y/y1 now named Y/x1"

但是,您知道如果您的工作流程要求您像这样进行子树合并(或者更糟的是其他海报提倡的那种树手术),那么您可能做错了。

于 2009-10-22T13:06:44.420 回答
1

移动分支的简单方法:

svn mv url1 url2 -m "commit log msg"
于 2010-11-11T08:55:18.810 回答