Fix: 'fatal: refusing to merge unrelated histories' in Git
The Error You run git pull or git merge and see: fatal: refusing to merge unrelated histories Git refuses to merge branches that do not share a common ancestor commit. This typically happens when you created a local repo with git init, created a remote repository on GitHub with a default README.md or .gitignore, and then tried to connect them. Force Git to merge the two independent project histories: git pull origin main --allow-unrelated-histories (Note: Replace main with master if your default branch is named master) If you are merging directly: git merge origin/main --allow-unrelated-histor
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in