日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

解决Git中fatal: refusing to merge unrelated histories(亲测)

發布時間:2024/9/20 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 解决Git中fatal: refusing to merge unrelated histories(亲测) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Git的報錯
在使用Git的過程中有時會出現一些問題,那么在解決了每個問題的時候,都需要去總結記錄下來,下次不再犯。

一、fatal: refusing to merge unrelated histories
今天在使用Git創建項目的時候,在兩個分支合并的時候,出現了下面的這個錯誤。

~/SpringSpace/newframe on  master ? 11:35:56
$ git merge origin/druid
fatal: refusing to merge unrelated histories
1
2
3
這里的問題的關鍵在于:fatal: refusing to merge unrelated histories
你可能會在git pull或者git push中都有可能會遇到,這是因為兩個分支沒有取得關系。那么怎么解決呢?

二、解決方案
在你操作命令后面加--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
等等,就是這樣完美的解決咯!
————————————————
版權聲明:本文為CSDN博主「向小凱同學學習」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/wd2014610/article/details/80854807

總結

以上是生活随笔為你收集整理的解决Git中fatal: refusing to merge unrelated histories(亲测)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。