简体   繁体   English

Git的子树合并策略没有选择正确的目录

[英]Git's subtree merge strategy doesn't pick the right directory

I have a repository that looks something like this: 我有一个看起来像这样的存储库:

foo/
    subrepo/
        a_file_in_subrepo
        another.ext
    unrelated_file

subrepo is a repository on github, and I have a remote in my repository, say sub , that tracks it, but none of the files are merged. subrepo是github上的一个存储库,我在我的存储库中有一个遥控器,比如sub ,它跟踪它,但没有一个文件被合并。

What I want is to merge in sub/master at the subrepo folder. 我想要的是在subrepo文件夹中合并sub/master I know that a_file_in_subrepo and another.ext are exactly as they are in sub/master but if I run git merge -s subtree sub/master I don't get what I want, and instead get: 我知道a_file_in_subrepoanother.extsub/master中的完全相同但是如果我运行git merge -s subtree sub/master我得不到我想要的东西,而是得到:

foo/
    subrepo/
        a_file_in_subrepo
        another.ext
    unrelated_file
    a_file_in_subrepo
    another.ext

I'm really confused. 我真的很困惑。 I know it guesses the directory to merge into automagically, can I override that? 我知道它猜测要自动合并的目录,我可以覆盖它吗?

使用-Xsubtree=<path>选项进行recursive合并策略:

git merge -s recursive -Xsubtree=subrepo sub/master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM