Mukesh Rawat Mukesh Rawat - 11 days ago 10x
Git Question

GIT Fatal : refusing to merge unrelated histories

I see:

$ git pull origin master
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories

How can I avoid or get past that error message?


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