将许多git存储库合并为一个保留其历史记录的绑定错误

时间:2014-12-22 20:07:40

标签: git merge

我正在尝试将两个git存储库合并为单个存储库,并且我遵循了以下教程http://jasonkarns.com/blog/merge-two-git-repositories-into-one/。我成功地能够将存储库与master分支合并,但是当我将两个repo与(master和develop)分支合并并且当我运行命令时

git read-tree --prefix=<project-name>/ -u <project-name>/develop

$git read-tree --prefix=first/ -u first/develop
error: Entry 'first/first' overlaps with 'first/first'.  Cannot bind.

我已按以下模式执行命令,

# merge project A into subdirectory A [for master branch]
 git remote add -f first ../first
 git merge -s ours --no-commit first/master
 git read-tree --prefix=first/ -u first/master
 git commit -am "merging projectA master branch into subdirectory A"

# for develop branch
  git checkout -b develop
  git merge -s ours --no-commit first/develop
  git read-tree --prefix=first/ -u first/develop
  git commit -am "merging prjectA development branch into subdirectory A"

我不确定是否应该为开发分支运行read-tree

1 个答案:

答案 0 :(得分:0)

我已经看到过去你所描述的问题,错误很复杂。

git read-tree --prefix=path -u project
error: Entry 'path/file' overlaps with 'path/file'.  Cannot bind.

在相关问题中,他们建议使用read-tree函数来解决这个问题。

我建议你看一下 How do I add/upgrade/downgrade a remote Git project in my repository without using submodules?可能会帮助你。

祝你好运

-Ricardo