2015-07-10 63 views
0

我想在我的项目的子目录中合并远程回购。几天前我手工复制了这个远程项目作为我的项目中的子目录,并对其进行了修改。现在有了它的新版本,我想合并我的子目录中的新更改而不会丢失我的修改。如何在我的项目的子目录中合并远程回购?

结构:

myProject 
    /mySubproject1 
    /mySubproject2 <-- This one is the modified remote repo (from Github) 

我已经尝试过什么是以下链接,但没有成功:

这是我做了什么:

cd myProject  
git remote add -mySubproject2_github https://github.com/something.git 
git merge -s ours --no-commit mySubproject2_github/master 
git read-tree --prefix=mySubproject2 -u mySubproject2_github/master 

但我得到以下

error: Entry 'mySubproject2/.something.yml' overlaps with 'mySubproject2/.something.yml'. Cannot bind.

是否有可能我想要什么?任何想法如何解决它?

+3

添加到我们的项目

$ git subtree add --prefix node_express_subtree https://github.com/codeheroco/nodejs-y-express-rutas master git fetch https://github.com/codeheroco/nodejs-y-express-rutas master 

更新项目如果你希望在你的项目中这个项目*和*要保持它到-date,你可能想阅读“git submodules”。 – larsks

+0

@larsks我可以修改项目,当我更新项目时,我可以维护修改吗? –

+0

@ @ @ @ @ @ @ @ @ @ @ @你可以维护一个从上游拉动并维持你的改变的叉子。所以你理想上需要一个单独的回购。 – rubenvb

回答

0

而不是使用有时是有点杂乱的子模块,我用子树。该子树将是我想要添加到我的“父项目”项目中的项目:

这里是一个示例,我们要在项目中添加来自Github的项目nodejs-y-express。

子树从GitHub的

git subtree pull --prefix node_express_subtree https://github.com/codeheroco/nodejs-y-express-rutas master