Git: fatal: refusing to merge unrelated histories on git pull
fatal: refusing to merge unrelated histories at git-pull (git/builtin/merge.c:1402)
Immediate Remediation
bash
git pull origin main --allow-unrelated-histories
Root Cause Analysis
The local repository and the remote branch have no common commit ancestor, typically because one was initialized independently or with different root commits, so Git refuses to merge by default to avoid silently combining unrelated histories.
Verification & Guardrails
- Only use --allow-unrelated-histories when you intentionally want to combine two independent codebases.
- After the pull, resolve any conflicting files and complete the merge commit with `git commit`.
- Verify the resulting history with `git log --oneline --graph` to confirm both branches are connected.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.