将其所有历史记录的git存储库导入到现有的git存储库中 [英] Import a git repository with all its history into an existing git repository

查看:126
本文介绍了将其所有历史记录的git存储库导入到现有的git存储库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个git存储库,我想将它们合并在一起而不会丢失它们的提交历史记录。我试过这个:

  cd firstRepo 
git remote add other path / to / otherRepo
git取其他
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。



任何想法?

干杯,
Merlyn

解决方案

我把它与git仓库无关?就像它们是独立的项目仓库一样,你想要合并在一起形成一个组合仓库?如果是这样,那么以下参考可能会有所帮助:

合并多个git仓库。



合并两个不相关的存储库


I have two git repositories and I want to merge them together without losing their commit histories. I've tried this:

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

Now when I look at the commit history everything looks good, but the only files I have in my repository are now the ones from otherRepo.

Any ideas?

Cheers, Merlyn

解决方案

I take it the git repositories are unrelated? As in they're distinct repositories for separate projects that you want to be merged together to form a combined repository? If so, then it's possible the following references may help:

Combining multiple git repositories.

Merging two unrelated repositories.

这篇关于将其所有历史记录的git存储库导入到现有的git存储库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆