2015-07-10 55 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