Home·Error messages

git · Git

The message

fatal: Need to specify how to reconcile divergent branches.

What it means

Since git 2.34, pull refuses to guess whether to merge or rebase when the branches have diverged — it is asking for a setting, not reporting damage. You see it when the branches diverged and pull.rebase has never been configured. pull.ff only is the safest answer because it only pulls when it can fast-forward and otherwise stops without creating anything; pull.rebase true rewrites the hashes of your local commits every time, and false leaves a merge commit.

The fix

git config pull.ff only
Printed by
git
Git
29

Almost every git error is a refusal that means "doing that from this state would lose something"; fatal: means git stopped without changing anything, and the hint: lines under the first line usually carry the actual remedy.

Reading an error message

  • Read from the first line down. The lower you go the more it is about the tool’s internals; the cause is usually at the top.
  • If there is a file and a line number, start there — not the top stack frame, but the topmost line that names a file you wrote.
  • Search the message verbatim, but strip your own paths and variable names first; those are what stop the search from matching.
  • The same condition is worded differently across tool versions. If results look wrong, add the version number to the query.
  • Before pasting a fix, check what it throws away. Some of these cannot be undone.

Common questions

Q. What does “fatal: Need to specify how to reconcile divergent branches.” mean?

Since git 2.34, pull refuses to guess whether to merge or rebase when the branches have diverged — it is asking for a setting, not reporting damage. You see it when the branches diverged and pull.rebase has never been configured. pull.ff only is the safest answer because it only pulls when it can fast-forward and otherwise stops without creating anything; pull.rebase true rewrites the hashes of your local commits every time, and false leaves a merge commit.

Q. How do I fix it?

git config pull.ff only — before running it, check the explanation above for what this command discards.

Q. Which tool prints this?

git. It sits under Git, and the message runs to 9 words.

Errors nearby