1

我有一个看起来像这样的存储库:

foo/
    subrepo/
        a_file_in_subrepo
        another.ext
    unrelated_file

subrepo是 github 上的一个存储库,我的存储库中有一个远程存储库,例如sub,它可以跟踪它,但是没有一个文件被合并。

我想要的是sub/mastersubrepo文件夹中合并。我知道这一点a_file_in_subrepo并且与another.ext他们完全一样,sub/master但是如果我跑步,git merge -s subtree sub/master我不会得到我想要的,而是得到:

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

我真的很困惑。我知道它猜测要自动合并到的目录,我可以覆盖它吗?

4

1 回答 1

4

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

git merge -s recursive -Xsubtree=subrepo sub/master
于 2012-03-31T05:42:37.077 回答