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

 

posted @ 2019-05-26 00:19  liuqd001  阅读(186)  评论(0编辑  收藏  举报