バグ解消法、お役立ち情報など

fatal: refusing to merge unrelated histories エラーの解消法

image

ターミナル
fatal: refusing to merge unrelated histories

こちらのエラーは、リモートとローカルそれぞれについて、元となるブランチが異なる場合に発生します。

解消法は、以下のコマンドを実行します。

リモートのmainブランチを取り込みたい場合

ターミナル
git pull origin main --allow-unrelated-histories

これでエラーを解消することができます!

詳細はドキュメントをご参照ください。

https://git-scm.com/docs/git-pull#Documentation/git-pull.txt---allow-unrelated-histories

バグ解消法、お役立ち情報など