我有两个Git仓库,我想将它们合并在一起,同时保留它们的提交历史记录。我已经尝试过以下操作:
cd firstRepo
git remote add other path/to/otherRepo
git fetch other
git checkout -b otherRepoBranch other/master
echo "`git rev-list otherRepoBranch | tail -n 1` `git rev-list master | head -n 1`" >> .git/info/grafts
git rebase otherRepoBranch master
现在当我查看提交历史时,一切看起来都很好,但我仓库中唯一拥有的文件现在是来自 otherRepo 的文件。
有任何想法吗?