fatal refusing to merge unrelated histories

0 votes

Hi Guys,

While trying to combine an existing repository, with a remote repository using git pull command, It shows me the below error.

git pull origin master
From https://github.com/nadim70
* branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
 command, it shows me the below error.

How to solve this error?

Thank You

Apr 10, 2020 in Git & GitHub by akhtar
• 38,260 points
5,686 views

2 answers to this question.

0 votes

Hi@akhtar,

It means your work tree and the remote tree you just added do not have any commit in common. That means Git cannot know what to do with them.

So start examining the log of both repositories using bellow command.

vimdiff =(git log master) =(git log remotes/origin/master)

If it is confirmed that the trees do not have commit in common, then check each commit one by one and try to match each commit in both the location.

answered Apr 10, 2020 by MD
• 95,460 points
0 votes
Try,

git pull origin master --allow-unrelated-histories
answered Aug 1, 2020 by Sasi
Hi @Sasi, thank you for your contribution to the Edureka Community.

Register/Sign up on the community to gain points for further contributions. You may ask questions, answer, upvote, and downvote an answer. Each of these would fetch you points and you could be among the top contributors and win exciting merchandise from Edureka.

Cheers!

Related Questions In Git & GitHub

0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,890 points
2,456 views
0 votes
1 answer

gerrit-cherry-pick:fatal: 'origin' does not appear to be a git repository

The user account making that command does ...READ MORE

answered Aug 13, 2018 in Git & GitHub by Kalgi
• 52,350 points
1,943 views
0 votes
1 answer

I am not able to use pull, push, branch merge

Please execute the below command in the ...READ MORE

answered May 23, 2019 in Git & GitHub by Umer
643 views
0 votes
0 answers

Difference between git rebase and git merge? Which among them is better to use?

Difference between git rebase and git merge? ...READ MORE

Nov 25, 2019 in Git & GitHub by anonymous
• 19,610 points

closed Nov 25, 2019 by Sirajul 976 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,034 views
+2 votes
1 answer
+1 vote
2 answers

fatal: unable to access could not resolve host: GitHub

Hi@akhtar, This can be caused in incorrect proxy ...READ MORE

answered Apr 10, 2020 in Git & GitHub by MD
• 95,460 points
153,132 views
0 votes
1 answer

How to merge data between Git branches?

Hi@akhtar, You can merge your data between Git ...READ MORE

answered May 10, 2020 in Git & GitHub by MD
• 95,460 points
663 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP