gitgit-pull

Git is refusing to merge unrelated histories. What are 'unrelated histories'?


I created a local repo with git remote origin https:////....

Then, in that local repo, I made a new text file → git add newfile.txtgit commit -m "..."git pull origin main → ERROR!

"refusing to merge unrelated histories".

What are unrelated histories?

What are related histories?


Solution

  • I think you have committed in the remote repository, and when you pull, this error happens.

    Use this command:

    git pull origin main --allow-unrelated-histories
    git merge origin origin/main