Mukesh Rawat Mukesh Rawat - 1 month ago 73
Git Question

GIT Fatal : refusing to merge unrelated histories

I see:

$ git pull origin master
From https://bitbucket.org/tecgenome/chl-v2.0-html
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories


How can I avoid or get past that error message?

Answer

Since Git 2.9 (April 2016), you can try:

git pull --allow-unrelated-histories origin master

But check why those branches are no longer common though.
May be there was a force push rewritting all the history of origin/master.

In which case, if you don't have local commits of your own, it is best to reset your branch to the new one:

git fetch
git reset --hard origin/master
Comments