Git pull – refusing to merge unrelated histories

Add --allow-unrelated-histories to solve the Git fatal error – “refusing to merge unrelated histories”

Terminal

$ git pull origin master

From https://github.com/mkyong/java-concurrency
 * branch            master     -> FETCH_HEAD
 
fatal: refusing to merge unrelated histories

To fix it :

Terminal

$ git pull origin master --allow-unrelated-histories

From https://github.com/mkyong/java-concurrency
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 674 insertions(+)
 create mode 100644 LICENSE

References

  1. git-merge documentation –allow-unrelated-histories

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Sam HobbsAkshaya Recent comment authors
newest oldest most voted
Sam Hobbs
Guest
Sam Hobbs

But what does the error mean? I assume there might be times when we do not want to allow unrelated histories and that is why it is issuing the message.

Akshaya
Guest
Akshaya

Thanks!