1.问题:本地代码推送到远程仓库报错,出现 “refusing to merge unrelated histories” 错误
> git pull --tags origin master
From https://gitee.com/amr_1/aml-mrc-ui
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
分析:当使用 git pull
命令时,如果出现 “refusing to merge unrelated histories” 错误,这表示本地仓库的历史记录与远程仓库的历史记录没有共同的祖先。这通常发生在两个独立的代码库被合并时或者在创建新的 Git 仓库时出现。
解决方法 :可以使用 git pull
命令的 --allow-unrelated-histories
参数来合并两个不相关的历史记录。
git pull --allow-unrelated-histories origin master