Git error: 'fatal: refusing to merge unrelated histories'

Oct 23, 2022 · 1 min read · Post a comment

Rebasing, pulling, merging and what not could lead to the following Git error: fatal: refusing to merge unrelated histories. Here’s the solution.


  • Git


In most of the cases run the following commands:

git fetch --prune
git pull origin main --allow-unrelated-histories

In case of merging two or multiple Git repos:

git merge app2/main --allow-unrelated-histories


To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.