该错误引用下面这篇博客有解释:https://blog.csdn.net/weixin_41287260/article/details/89742151
这里不再做赘述,主要就是远端仓库和本地仓库存在冲突
按照上面博客提供的解决方案,不能解决该问题,会在合并时报出新的错误
$ git merge origin FETCH_HEAD
warning: refname 'FETCH_HEAD' is ambiguous.
fatal: refusing to merge unrelated histories
换个思路,远端仓库是否为新建仓库?是!至少笔者是遇到的这种情况
那就直接忽略远端和近端的差异直接拉取代码再提交
$ git pull origin master --allow-unrelated-histories
From https://github.com/XXX/XXX
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
.gitignore | 15 +++++++++++++++
1