git merge:远程存储库存在于子目录中
我正在尝试将跟踪供应商分支的旧 CVS 存储库转换为 git,但我遇到了合并问题。
存储库的结构如下:
dir1/
dir2/
dir2 来自上游分支。 Upstream 已经转换为 git,我们仓库中的 dir2 是他们 git 仓库的根目录。我想将它们添加为远程并将它们的根目录合并到子目录 dir2 中。
简单的合并是行不通的:git 将它们的根视为我们的根,并且找不到共同的文件。
子树合并不起作用:您无法将子树合并到现有目录中。我遵循 如何使用子树合并策略 指南,此命令失败:
git read-tree --prefix=dir2/ -u upstream/master
问题是它检测到 dir2 中已存在“冲突”文件。我知道这些文件存在,我希望它合并这些文件。
任何建议将不胜感激。
I'm trying to convert an old CVS repository tracking a vendor branch to git, and I'm running into a merge issue.
The repository is structured like this:
dir1/
dir2/
dir2 comes from the upstream branch. Upstream converted to git already, and dir2 in our repo is the root of their git repo. I want to add them as a remote and merge their root into the subdirectory dir2.
Simple merging won't work: git treats their root as our root and finds no files in common.
Subtree merging won't work: you can't subtree merge into an existing directory. I followed the How to use the subtree merge strategy guide, and this command fails:
git read-tree --prefix=dir2/ -u upstream/master
The problem is that it detects 'conflicting' files that already exist in dir2. I know the files exist, I want it to merge those files.
Any advice would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
诀窍是使用子树选项进行正常的递归合并:
The trick is to do a normal recursive merge with the subtree option: