git directory is unreadable or when you are trying to pull data from a repository with its own commit history. The fatal: refusing to merge unrelated histories error occurs when either a. You can read more about the –allow-unrelated-histories flag on the official This command was added to handle the rare event that you are working with two projects that have their own branches.Īlternatively, you could clone a new version of the remote repository usingĪnd start over. With the branch that you want to retrieve. With the remote repository from which you are pulling resources. Git pull origin master –allow-unrelated-histories To solve this issue, you can use theįlag when pulling data from a repository:
#Rebase with smartgit how to#
How to Solve ‘fatal: refusing to merge unrelated histories’ This is because Git doesn’t know if the remote repository is compatible with your current repository. When you try to push data to or pull data from a remote repository, this error will occur. In this case, the Git command line may not be able to read your local project’s history. git directory inside a project that has been deleted or corrupted. This error will be displayed because the local repository with which you are working will have a different history to the project which you are trying to retrieve. When you create a new repository, make a few commits, and try to pull from another remote repository, this error can occur. There are two main scenarios when this error may arise. , and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email. Get Your Coding Bootcamp Sponsored by Your EmployerĬareer Karma matches you with top tech bootcampsĪccess exclusive scholarships and prep courses.