2010-11-22 70 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 
相关问题