将 SVN 分支中的重命名文件夹合并回主干,将原始命名文件夹保留在主干中

发布于 2024-09-10 06:08:45 字数 910 浏览 3 评论 0原文

一点背景知识,因为这可能有点令人困惑:我正在开发的项目的大部分代码都是相同的,但有些文件会根据我们部署到的平台而变化。为此,根文件夹包含所有未更改的“核心”文件,然后每个平台都有一个包含更改文件的目录。因此,有一个 baz/foo.c 和一个 bar/foo.c,因为 foo.c 会根据它是否部署到 而变化>bazbar。 Makefile 等使这一切变得神奇。

问题是,我正在开发一个基于 bar 的新平台(我们会说 qux),所以我一直在一个分支工作,并且在 bar 目录中进行修改。现在我想将该目录重命名为 qux,但在合并时保留主干中的原始 bar,因为该平台仍然存在。所以我的最终目标是,在合并后的主干中,拥有 bazbar ,就像我干预之前一样,以及一个新文件夹 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 技术交流群。

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

发布评论

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

评论(2

小红帽 2024-09-17 06:08:45

由于 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 new qux folder, then copy the contents of the bar folder into it. Copying won't remove anything from bar. Modify in qux 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 new qux.

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.

梦萦几度 2024-09-17 06:08:45

可能会遗漏一些东西,但听起来你应该:

  1. 保持分支不变,你已经完成了它的开发,但如果需要,你可以回顾它的历史。
  2. 彻底检查主干 将
  3. 修改后的 bar 文件夹复制为主干下的新“qux”文件夹
  4. 将 qux 添加到主干
  5. 提交

Might be missing something, but it sounds like you should:

  1. Leave the branch as is, you're done developing on it but you can refer back to its history if need be.
  2. Make a clean checkout of the trunk
  3. Copy your modified bar folder as a new "qux" folder under the trunk
  4. Add qux to the trunk
  5. Commit
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文