将 SVN 分支中的重命名文件夹合并回主干,将原始命名文件夹保留在主干中
一点背景知识,因为这可能有点令人困惑:我正在开发的项目的大部分代码都是相同的,但有些文件会根据我们部署到的平台而变化。为此,根文件夹包含所有未更改的“核心”文件,然后每个平台都有一个包含更改文件的目录。因此,有一个 baz/foo.c
和一个 bar/foo.c
,因为 foo.c
会根据它是否部署到 而变化>baz
或 bar
。 Makefile 等使这一切变得神奇。
问题是,我正在开发一个基于 bar
的新平台(我们会说 qux
),所以我一直在一个分支工作,并且在 bar
目录中进行修改。现在我想将该目录重命名为 qux,但在合并时保留主干中的原始 bar
,因为该平台仍然存在。所以我的最终目标是,在合并后的主干中,拥有 baz
和 bar
,就像我干预之前一样,以及一个新文件夹 qux
与我的更改(当前位于文件夹 bar
下的分支中,并且基于原始 bar
)。
有没有简单的方法可以做到这一点?如果我在分支中将 bar
重命名为 qux
,当我将其合并回主干时,它似乎会尝试删除 bar
,这这不是我想要发生的事情。我是否需要执行一些操作,例如在分支中创建一个新文件夹 qux
,将文件从 bar
复制到其中,然后将 bar
还原回它的原始状态?或者有更好的方法来做到这一点吗?
编辑:需要明确的是,如果我将文件复制到新文件夹中,bar
文件夹中已有的更改需要还原。
A little background, because this might be kind of confusing: the project I'm working on is one where most of the code is the same, but there are some files that change based on the platform we're deploying to. For this, the root folder has all of the "core" files that don't change, and then there is a directory for each platform with the files that change. So there's a baz/foo.c
and a bar/foo.c
, because foo.c
changes depending on whether it's deployed to baz
or bar
. Makefiles and such make all this magic work.
The quesiton is, I'm working on a new platform (we'll say qux
) that is based on bar
, so I've been working in a branch, and making modifications in the bar
directory. Now I want to rename that directory to qux
, but preserve the original bar
in the trunk when it comes time to merge, because that platform still exists. So my ultimate goal is to, in the trunk after merge, have baz
and bar
as they were before my meddling, and a new folder qux
with my changes (which are currently in the branch under the folder bar
, and are based on the original bar
).
Is there an easy way to do this? If I rename bar
to qux
in my branch, it seems like it'll try to delete bar
when I merge it back into trunk, which isn't what I want to happen. Do I need to do something like create a new folder qux
in my branch, copy files into it from bar
, and then revert bar
back to its original state? Or is there a better way to do this?
Edit: To be clear, there are changes already in the bar
folder that need to be reverted if I copy the files into a new folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于
bar
不会在主干中消失,因此不要重命名它。保持原样,创建一个新的qux
文件夹,然后将bar
文件夹的内容复制到其中。复制不会从bar
中删除任何内容。根据新平台的情况,在qux
中进行修改。然后,当您将功能分支合并回主干时,您将拥有原始的、未更改的bar
和新的qux
。如果您使用 Subversion 创建副本(而不是普通文件系统副本),您甚至可以获得 qux 文件的先前历史记录,尽管您可能不需要它。
Since
bar
isn't going away in the trunk, don't rename it. Leave it as is, and create a newqux
folder, then copy the contents of thebar
folder into it. Copying won't remove anything frombar
. Modify inqux
as appropriate for the new platform. Then when you merge the feature branch back to trunk, you'll have your original, unchanged,bar
and your newqux
.If you create the copy with Subversion (as opposed to a plain filesystem copy), you'll even have the prior history of the
qux
files, though you may not need that.可能会遗漏一些东西,但听起来你应该:
Might be missing something, but it sounds like you should: