Fix divergent branches when Git pull needs a strategy
Choose merge, rebase, or fast-forward-only intentionally when local and remote branches both contain unique commits.
Modern Git versions may stop git pull when local and upstream branches have diverged and no reconciliation strategy is configured. The message asks you to choose; it does not mean the repository is damaged.
Inspect before pulling again
git status --short --branch
git fetch origin
git log --oneline --graph --decorate --all -20
Commit or stash local changes before integration. The graph shows which commits exist only locally and only on the remote-tracking branch.
Choose for this pull
Merge preserves the branch structure and creates a merge commit when needed:
git pull --no-rebase
Rebase replays unpublished local commits on top of the upstream branch:
git pull --rebase
Fast-forward-only refuses any divergent integration, which is useful when you want an explicit decision:
git pull --ff-only
Save the policy at the right scope
After your team chooses a workflow, set it for the current repository:
git config pull.rebase true
Use false for merge, or configure pull.ff only for fast-forward-only. Add --global only when the same preference should apply to every repository you use; repository-level configuration is less surprising for project-specific rules.
Rebase rewrites the identities of the rebased local commits. Avoid rebasing commits others already build on. For the tradeoffs, read Git merge vs. rebase.