小编Cur*_*nny的帖子

将包含其所有历史记录的git存储库导入现有的git存储库

我有两个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

20
推荐指数
3
解决办法
2万
查看次数

标签 统计

git ×1