Mukesh Rawat Mukesh Rawat - 1 year ago 1018
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?

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download