Git: fatal: Need to specify how to reconcile divergent branches
Git 2.34 and later refuse to guess between merge, rebase and fast-forward. Set pull.rebase or pull.ff once, and know what each strategy does to history.

Introduction & Quick Summary
A git pull that used to work now stops before touching anything:
$ git pull
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
fatal: Need to specify how to reconcile divergent branches.Quick answer: Git refuses to guess how to combine your local commits with the remote ones. Pick the strategy you want for this repository and record it once:
git config --global pull.rebase false # merge (creates a merge commit)
git config --global pull.rebase true # rebase (linear history, rewrites your commits)
git config --global pull.ff only # fast-forward only (refuses, then you choose)Or decide per pull without changing any configuration:
git pull --no-rebase # merge now
git pull --rebase # rebase now
git pull --ff-only # fail instead of mergingThe message is not an error in your repository; it is Git declining to invent a policy. This guide covers what each strategy does to history, how to choose one per project, and how to recover if you pick the wrong one.
Core Mechanics, Signatures & Reproducible Setup
Divergence means both sides moved: you have commits the remote does not, and the remote has commits you do not.
git status -sb
## main...origin/main [ahead 2, behind 3]A pull is fetch plus one of three integration steps. The setting that selects it comes from pull.rebase, pull.ff, and the --rebase/--ff flags; in Git 2.34 and later, a pull that would need a merge or rebase while none is configured stops with the fatal message instead of defaulting to merge.
A reproducible divergence in a scratch repository:
git init diverge && cd diverge
git commit --allow-empty -m "base"
git remote add origin "$(pwd)/../remote.git"
git push -u origin main
# local commit
git commit --allow-empty -m "local work"
# remote moves too
git clone ../remote.git ../other && cd ../other
git commit --allow-empty -m "remote work" && git push
cd ../diverge
git fetch
git pull # fatal: Need to specify how to reconcile divergent branches.The three answers to that prompt, and what each one writes:
| Configuration | Integration | History after pull | Rewrites local commits |
|---|---|---|---|
pull.rebase false | merge | merge commit joining both lines | no |
pull.rebase true | rebase | your commits replayed on top of the remote | yes |
pull.ff only | fast-forward only | nothing, refuses while diverged | no |
| unset, no flag | none | pull aborts with the fatal message | — |
git pull alone cannot fast-forward while diverged, which is exactly why the choice cannot be inferred. A repository that never has local commits on the branch never sees this message; a shared branch where everyone commits locally sees it constantly.
Key Comparison Table
| Situation | Best choice | Command |
|---|---|---|
| shared branch, merge commits accepted | merge | git config pull.rebase false |
| feature branch kept linear before review | rebase | git config pull.rebase true |
| CI or deploy branch that must stay linear | fast-forward only | git config pull.ff only |
| one-off inspection of remote work | fetch, then inspect | git fetch && git log --oneline HEAD..origin/main |
| local commits are already pushed | merge, never rebase | git pull --no-rebase |
| long-lived local branch with uncommitted edits | rebase with autostash | git -c rebase.autoStash=true pull --rebase |
| Symptom | Meaning | Next step |
|---|---|---|
| fatal message with no output | no strategy configured | choose one of the three settings |
Not possible to fast-forward, aborting | pull.ff only active | git rebase origin/main explicitly |
| merge commit appears in every pull | pull.rebase false | keep it, or switch to rebase |
| every local branch gets rewritten | pull.rebase true globally | override per repo with --no-rebase |
| conflict stops mid-pull | integration needs resolution | resolve, git add, git rebase --continue or git commit |
| Command | Effect |
|---|---|
git config --show-origin pull.rebase | shows the value and which file set it |
git pull --rebase=merges | rebases but keeps merge commits in your local history |
git pull --autostash | stashes local changes, pulls, then restores them |
git merge --abort | abandons a conflicted merge |
git rebase --abort | abandons a conflicted rebase |
git reset --hard ORIG_HEAD | returns to the state before the last pull |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Read the state before choosing
The strategy depends on what each side contains, so look first:
git fetch
git log --oneline --left-right --graph HEAD...origin/main
# < abc1234 local commit
# > def5678 remote commitIf the right side contains work you have already pushed from another machine, rebasing your left-side commits is usually right. If both sides are shared with teammates, merging is safer because it never rewrites commits others may have.
2. Merge: the default that never rewrites
git config pull.rebase false
git pullGit performs a real merge, producing a merge commit when the histories diverged. Conflicts stop the pull with the usual markers; resolve, git add the files, and git commit to finish. This is the setting to pick on a branch where several people push, because nobody's commit ids change.
3. Rebase: linear history at the cost of rewriting
git config pull.rebase true
git config rebase.autoStash true
git pullYour local commits are replayed on top of the fetched ones, so the branch looks as if you had started from the newest remote commit. Two consequences matter: commit hashes change, and a branch that others already pulled will need a force push after the rebase. Conflicts are resolved once per commit, with git rebase --continue after each, or git rebase --skip to drop a commit.
git pull --rebase
# CONFLICT (content): Merge conflict in src/app.ts
git add src/app.ts
git rebase --continue
# if it goes wrong:
git rebase --abortrebase.autoStash handles the very common "cannot pull with rebase: You have unstaged changes" failure by stashing and restoring around the operation.
4. Fast-forward only: refuse, then decide
pull.ff only never creates a merge commit and never rewrites: it fails when the branch diverged, which is a feature on deployment branches where an unexpected merge commit can break a linear pipeline.
git config pull.ff only
git pull
# fatal: Not possible to fast-forward, aborting.
git rebase origin/main # explicit decision, visible in the shell historyThe per-invocation form git pull --ff-only is useful in scripts where the global setting is merge or rebase.
5. Multiple configs and the value that actually wins
Git layers system, global, local and worktree configuration, and the last one wins per key. When the message persists after setting a value, inspect the origin:
git config --show-origin --get-all pull.rebase
git config --list --show-origin | grep -E "pull\.|rebase"An included file, a git config --system entry on a managed machine, or a repository-local pull.rebase = false left over from a script all override your global choice. Set the value where you intend it and remove the stale one:
git config --local --unset pull.rebase
git config --global pull.rebase true6. Undo a strategy you did not want
Both integrations are reversible from ORIG_HEAD, which the pull sets before it changes anything:
git reset --hard ORIG_HEAD # before pushing anything
git reflog -n 10 # if ORIG_HEAD is gone
git reset --hard HEAD@{1}After a rebase that was already pushed, the recovery needs git push --force-with-lease; on a shared branch, coordinate first, because the rewritten commits are no longer what teammates have. The text diff tool is handy for reading a conflicted file outside the editor, and the regex tester helps when a filter in .gitattributes is rewriting line endings during the pull.
Common Compilation/Runtime Mistakes & Version Gotchas
- Setting
pull.rebase trueglobally on shared branches. Every pull rewrites local commits; teammates who already have them get divergence again on the next fetch. - Choosing
pull.ff onlyand stopping there. The branch then never incorporates remote work until someone runs an explicit rebase or merge. - Ignoring the origin of the config.
--show-originis faster than guessing which of three config files set the value. - Rebasing pushed commits. It requires a force push and invalidates every open branch based on those commits; merge instead.
- Resolving a rebase conflict with
git commit. A rebase expectsgit rebase --continueso the commit message and author are preserved. - Version notes. Git 2.27 added the hint, and Git 2.34 turned it into a fatal error when the branches diverge and no strategy is configured — which is why the same workflow broke for many teams on an upgrade.
git config --global pull.ff onlyand--rebase=mergesare both supported in current releases;init.defaultBranchandpull.rebaseremain separate settings.
Official documentation: git pull and pull.rebase in git-config.
Official references
primary documentationThe Git documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Git work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Git guides
All Git guidesGit: fatal: not a git repository (or any parent): .git
The command ran outside a working tree or the .git metadata is gone. Confirm the root, restore a deleted .git, and repair worktree pointers.
Git: fatal: could not read from remote repository
Git could not authenticate or reach the remote. Check the remote URL, test SSH with -T, verify the key is offered, and use HTTPS on 443 when 22 is blocked.
Git: fatal: unable to auto-detect email address
A commit needs an author identity. Containers and fresh installs have no user.email, so Git guesses from the OS user and refuses to continue.
Git: could not read Username, terminal prompts disabled
A headless git has no terminal to ask for credentials. Supply a token through a helper, a header or SSH instead of relying on a prompt.
More in Git
All Git guidesThe guides filed next to this one in Git, in library order.