git-合併不相干的分支

git-合併不相干的分支

refusing to merge unrelated histories
參考URL: https://segmentfault.com/a/1190000018761913

git-合併不相干的分支,會出現報錯 refusing to merge unrelated histories

Git 從 2.9.0 版本開始,預設行爲不允許合並沒有共同祖先的分支,需要加上 --allow-unrelated-histories 進行 pull 操作纔不會出現此類錯誤信息。

這個預設行爲是爲了避免,人爲誤操作合併了兩個不相干的分支,加參數–allow-unrelated-histories 你要自己確定你真的要合併這個兩個沒有共同祖先的分支。

demo示例

git pull origin master --allow-unrelated-histories

一般不太使用該命令。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章