解决Git中fatal: refusing to merge unrelated histories(亲测)
Git的報錯
在使用Git的過程中有時會出現(xiàn)一些問題,那么在解決了每個問題的時候,都需要去總結(jié)記錄下來,下次不再犯。
一、fatal: refusing to merge unrelated histories
今天在使用Git創(chuàng)建項目的時候,在兩個分支合并的時候,出現(xiàn)了下面的這個錯誤。
~/SpringSpace/newframe on master ? 11:35:56
$ git merge origin/druid
fatal: refusing to merge unrelated histories
1
2
3
這里的問題的關(guān)鍵在于:fatal: refusing to merge unrelated histories
你可能會在git pull或者git push中都有可能會遇到,這是因為兩個分支沒有取得關(guān)系。那么怎么解決呢?
二、解決方案
在你操作命令后面加--allow-unrelated-histories
例如:
git merge master --allow-unrelated-histories
~/SpringSpace/newframe on druid ? 11:36:49
$ git merge master --allow-unrelated-histories
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.
1
2
3
4
5
如果你是git pull或者git push報fatal: refusing to merge unrelated histories
同理:
git pull origin master --allow-unrelated-histories
等等,就是這樣完美的解決咯!
————————————————
版權(quán)聲明:本文為CSDN博主「向小凱同學學習」的原創(chuàng)文章,遵循CC 4.0 BY-SA版權(quán)協(xié)議,轉(zhuǎn)載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/wd2014610/article/details/80854807
總結(jié)
以上是生活随笔為你收集整理的解决Git中fatal: refusing to merge unrelated histories(亲测)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 芸字取名的寓意是什么?
- 下一篇: Postman Could not ge