PlainError

Home / Coding

fatal: refusing to merge unrelated histories

Last checked 2026-10-17 · 2 fixes · reviewed answer

TL;DRGit refuses to combine changes from two branches or repositories because they have no shared starting point in their history.

Likely causes

  1. Attempting to merge or pull from a branch or repo initialized separately without common commitsmost likely
  2. Using git pull or merge after cloning or initializing in a way that creates independent historiespossible

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Check current branch and statusSafe

    View the active branch and any pending changes before proceeding.

    git status
  2. Merge with unrelated histories flagChanges settings

    Allow the merge by explicitly permitting unrelated histories. This modifies your repository.

    git merge --allow-unrelated-histories <branch-name>

    ⚠ Back up your repository first as this can alter commit history.

If that didn't fix it

The merge command will keep failing until histories are linked or the allow flag is used.

When to see a technician

Consult a version control specialist if the repository contains critical data and you are unsure about Git operations.

Did this fix it? Report a problem

Related errors