【发布时间】:2011-08-25 03:32:00
【问题描述】:
我有两个 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 中的文件。
有什么想法吗?
【问题讨论】:
标签: git