我是先在本地创建了仓库,写了一些东西,然后在github上创建仓库,再把本地的文件上传进去。在pull时,报错为refusing to merge unrelated histories,因为是两个不同的项目,要合并的话,需要在pull命令后面加上--allow-unrelated-histories。
完整的命令git pull origin master --allow-unrelated-histories
解决Git合并错误
本文介绍了解决在将本地仓库与GitHub远程仓库进行合并时遇到的refusing to merge unrelated histories错误的方法。通过使用带有--allow-unrelated-histories选项的git pull命令,可以成功合并两个独立项目的更改。
我是先在本地创建了仓库,写了一些东西,然后在github上创建仓库,再把本地的文件上传进去。在pull时,报错为refusing to merge unrelated histories,因为是两个不同的项目,要合并的话,需要在pull命令后面加上--allow-unrelated-histories。
完整的命令git pull origin master --allow-unrelated-histories
1274

被折叠的 条评论
为什么被折叠?