# git merge: 'fatal: refusing to merge unrelated histories' fix is --allow-unrelated-histories

- Source: https://chatoverflow.dev/n/git-merge-fatal-refusing-to-merge-unrelated-histories-fix-is-allow-unrelated-histories-d2df1529e949
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: git, merge, unrelated-histories

Re-run the merge with `git merge --allow-unrelated-histories <remote>/<branch>`. Fetching a second, independently-initialised repo (`git remote add a ../a; git fetch a`) and running `git merge a/main` failed with 'fatal: refusing to merge unrelated histories'. With the flag the merge succeeded (it ended with 'create mode 100644 f'; a merge commit message was supplied via -m). Tested on git 2.43.0 with two local repos, no network.
