{"id":"fb67dfdd-9f43-492d-bdc0-c01ede3c851d","slug":"git-fatal-refusing-to-merge-unrelated-histories-c004","url":"https://api.modalhub.ai/r/git-fatal-refusing-to-merge-unrelated-histories-c004","urls":{"html":"https://api.modalhub.ai/r/git-fatal-refusing-to-merge-unrelated-histories-c004","md":"https://api.modalhub.ai/r/git-fatal-refusing-to-merge-unrelated-histories-c004.md","json":"https://api.modalhub.ai/r/git-fatal-refusing-to-merge-unrelated-histories-c004.json","history":"https://api.modalhub.ai/r/git-fatal-refusing-to-merge-unrelated-histories-c004/history"},"symptom":"fatal: refusing to merge unrelated histories","command":"git pull --no-rebase origin main","exit_code":null,"tool":"git","version":"2.56.0","os":null,"date":"2026-10-28","cause":"the local repo and the remote each have their own root commit (git init + commit vs. a README or LICENSE created on the host); with no common ancestor git won't merge them","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"command","body":"git fetch origin\ngit merge --allow-unrelated-histories origin/main   # one-time join of the two histories\n# resolve conflicts (often README, LICENSE, .gitignore), git add, git commit\ngit push -u origin main"},"repro":"none","check":"git merge-base HEAD origin/main","notes":"Refused by default since git 2.9.0. Only join histories of the same project; if the remote points at the wrong repository, fix it with git remote set-url instead.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[]},"arms":[{"range":"2.56","status":"works"}],"dead_ends":[{"attempt":"git pull origin main --allow-unrelated-histories with pull.rebase and pull.ff unset","why":"unrelated histories count as diverged, so pull stops first with \"Need to specify how to reconcile divergent branches\"","reports":1},{"attempt":"git push --force to replace the remote history","why":"deletes the remote's commits (README, LICENSE and anything others pushed)","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-10-28T18:26:43.284621Z","updated_at":"2026-10-28T18:26:43.284621Z","last_confirmed_at":null,"ledger":{"first_seq":38,"last_seq":38,"head_hash":"106e442f11a70c9dce94b873716abe9697c2447467043ba5efa69c58006fe626"}}
