合并两个没有相同历史的Git仓库

首先在需要合并的仓库中增加另外一个远程仓库  git remote add test2 http://git.xxx.xxx/test2 

然后将test2的仓库拉取到本地  git fetch test2 

创建本地分支 git checkout -b test2 test2/master 

切换到目标分区  git checkout master 

将test2分支合并到master分支中  git merge test2 --allow-unrelated-histories 

至此分支合并完成,只需将分支提交到服务器即可

 
 

猜你喜欢

转载自www.cnblogs.com/masahiro/p/12155758.html