git push错误之fatal: refusing to merge unrelated histories
问题描述:
在git中由本地提交到远程仓库(同分支)或者本地分支合并时显示错误:
fatal: refusing to merge unrelated histories
解决方式:
如果合并两个不同的开始提交的仓库,在新的 git 会发现这两个仓库可能不是同一个,为了防止开发者上传错误,于是就给上面的提示。
解决的话在操作命令后面加:
--allow-unrelated-histories
例如:
$ git pull origin master --allow-unrelated-histories
git merge master --allow-unrelated-histories