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

Tagged in:



About the Author


I am Akash Mittal, an overall computer scientist. If you want to guest post, need help in your projects, want to advertise, Feel free to contact me at [email protected]

View All Articles