Git Error: refusing to merge unrelated histories


Git throws error: refusing to merge unrelated histories, when git history is lost or got corrupted and you try to merge the pull. The solution to this problem is to use --allow-unrelated-histories flag.

Consider this code –

git pull origin master
fatal: refusing to merge unrelated histories

This situation may have arise by losing git history in local repository. As a solution to this problem, you can simply use --allow-unrelated-histories flag –

git pull origin branchname --allow-unrelated-histories

    Tweet this to help others

Sign Up for Our Newsletters

Get only the best articles delivered to your mail

You May Also Like