2012-03-29 69 views
1

我有一个仓库,看起来是这样的:Git的子树合并策略没有选择正确的目录

foo/ 
    subrepo/ 
     a_file_in_subrepo 
     another.ext 
    unrelated_file 

subrepo在GitHub上的存储库,而我在我的仓库远程,说sub,跟踪它,但没有文件被合并。

我想要的是合并在sub/mastersubrepo文件夹。我知道a_file_in_subrepoanother.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 

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

回答

2

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

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