2010-11-22 110 views
0

我們有一個主要回購Core,我們在這裏維護我們在許多項目中使用的庫。永久性地將git回購合併到主回購庫,保留歷史

我正在開發一個單獨的回購庫ErrorHandling,我現在想要永久合併到Core,同時保留提交歷史記錄。

這可能嗎?

+0

將會對這種解決滿足您的需求? http://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories – 2010-11-22 13:31:53

+0

我認爲這將是第一次,但是當我閱讀有關解決方案(子樹合併)它似乎並不像永久解決方案澄清:我想合併,然後**刪除'ErrorHandling' **。 – Znarkus 2010-11-22 13:34:56

+0

可能重複的[如何將現有的GIT存儲庫導入到另一個?](http://stackoverflow.com/questions/1683531/how-to-import-existing-git-repository-into-another) – 2010-11-22 14:09:14

回答

1

作爲評論,在「How to import existing GIT repository into another?」中描述的子樹合併,基於在GitHub文章「Working with subtree merge」,比basic subtree merge presented in the Git Book(主要是git merge -s ours步驟)更完整的一點。

git remote add errorHandlingRepo server:errorHandling.git 
git fetch errorHandlingRepo 
git merge -s ours --no-commit errorHandlingRepo /master 
git read-tree --prefix=errorHandling/ -u errorHandlingRepo/master 
git commit -m "Imported errorHandling as a subtree." 

您可以跟蹤像這樣的上游變化:

git pull -s subtree errorHandlingRepo master 
相關問題