Git中fatal: refusing to merge unrelated histories的解决

出现这个问题是因为远程代码与本地没有任何相关的历史,往往出现在直接拷贝了一份代码,然后想与远程建立联系的情况下。

可以使用以下命令:

如果是在push则:

git push origin master --allow-unrelated-histories

如果实在pull则:

git pull origin master --allow-unrelated-histories

如果是在merge则:

git merge master --allow-unrelated-histories

原文地址:https://www.cnblogs.com/liuqd001/p/10924734.html