Subversion:将更改从一个分支移动到另一个分支的最佳方式

发布于 2024-07-11 14:17:27 字数 370 浏览 9 评论 0原文

我有两个分支: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

我认为这很丑陋......

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

I have two branches : X and Y. I want to replace a Y's subdirectory (y1) by its equivalent from X (x1).

For the time being, I do the following : copy x1 to Y, remove y1, rename (move) x1 to 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

I think it is quite ugly...

How could I do it in a smarter way ?

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

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

发布评论

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

评论(4

川水往事 2024-07-18 14:17:27

如果您确实想替换目录,可以通过两个操作来完成:

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 的旧副本,则不应始终替换它,而是合并自上次以来的所有更改融入其中。

If you really want to replace the directory, you can do that with two operations:

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

If Y/y1 is really already an older copy of X/y1, you shouldn't replace it all the time, but instead merge all changes since the last merge into it.

荭秂 2024-07-18 14:17:27

为什么不只需要两步:

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

Why not just two steps:

a) svn delete https://path/to/branches/Y/y1
b) svn copy https://path/to/branches/X/x1 https://path/to/branches/Y/y1
命硬 2024-07-18 14:17:27

将分支 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"

但是,您知道您的工作流程是否需要您执行以下操作子树像这样合并(或者更糟糕的是其他海报所提倡的树手术),你可能做错了。

check out branch Y to a fresh working copy, and put yourself there.

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

merge the changes necessary to trasform Y/y1 to X/x1 into Y/y1

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

commit this

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

If y1 has a different name from x1 (not clear form your description), do a rename:

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

But, you know if your workflow requires you to do subtree merges like this (or worse the sort of tree surgery advocated by other posters), you're probably Doing It Wrong.

耳钉梦 2024-07-18 14:17:27

移动分支的简单方法:

svn mv url1 url2 -m "commit log msg"

Simple way to move branch:

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