我有两个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
Run Code Online (Sandbox Code Playgroud)
现在,当我查看提交历史记录时,一切看起来都不错,但我存储库中的唯一文件现在是来自otherRepo的文件.
有任何想法吗?
干杯,梅林
git ×1