published fresh until

Need to specify how to reconcile divergent branches: Git fix?

Summary As of October 2026, Git pull refusals need an explicit merge/rebase decision, while missing upstream and unstaged-change errors require tracking or worktree fixes first. Preserve edits, inspect the graph and avoid automatic resets or force pushes; checked 2026-10-20.

Not for agent PR babysitting, see agent-fixes-ci-and-review-on-own-pr; parallel dev-server ports, see portless-named-urls-for-parallel-worktrees

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Your agent cannot update a Git branch. Match the exact message before changing history. A pull-policy refusal, a fast-forward refusal, a missing push upstream and a dirty worktree are different states.

Versions and scope — checked 2026-10-20

ComponentOfficial reference usedBoundary
Git pullGit 2.33.1 manual and tagged sourceSource contains the divergent-branches fatal; this is a verified example version, not a claim about the first affected patch
Git merge, push, branch, rebase, stashCurrent git-scm manuals linked belowCheck local git --version; wording and defaults can differ across releases

These are reference versions, not a release comparison.

When to pick which

StatePickWhy
Local commits are private; team wants linear historyRebaseReplays local commits with new identities
Commits are shared; preserve existing ancestryMergeCombines histories without replaying your commits
Automation must refuse divergenceFast-forward onlyStops instead of choosing a history change
Changes are not committedSave selected work or stash before rebasingProtects the working tree

Need to specify how to reconcile divergent branches

Exact message fatal: Need to specify how to reconcile divergent branches.

The fetched history cannot fast-forward and no reconciliation policy was selected. Inspect the real branch first.

git --version
git status --short --branch
git branch -vv
git fetch origin
git log --oneline --graph --left-right HEAD...origin/BRANCH

Replace BRANCH with the confirmed remote branch throughout. With saved work and the correct branch checked out, choose ONE invocation: git pull --rebase origin BRANCH for private local commits, or git pull --no-rebase --ff origin BRANCH to allow a merge even when a fast-forward-only preference was configured. Resolve conflicts before continuing, or use git rebase --abort / git merge --abort for the respective operation.

Do NOT run all three suggested configuration commands or change global defaults just to hide the error. After agreeing on team policy, repository-local git config pull.rebase true, git config pull.rebase false, or git config pull.ff only expresses that choice; the last one deliberately refuses divergence.

Sources Git pull manual, fatal-message source, rebase recovery, checked 2026-10-20.

Not possible to fast-forward

Exact message fatal: Not possible to fast-forward, aborting.

The selected fast-forward-only operation cannot reach the target by moving the branch pointer alone. Check the graph above and confirm you are integrating the intended branch. If the histories really diverged, choose merge or rebase under the table's constraints. After fetching, git merge --ff origin/BRANCH or git rebase origin/BRANCH explicitly performs the chosen operation; use the pull commands above when overriding pull policy.

Do NOT use git reset --hard, force push, or delete the repository as an automatic repair. This refusal can precede any file conflict.

Sources Git merge fast-forward rules and Git pull options, checked 2026-10-20. The exact string is reproduced in the supplied community question, checked 2026-10-20.

The current branch has no upstream branch

Exact observed example fatal: The current branch master has no upstream branch.

This example comes from an unqualified PUSH, not from pull. Confirm git branch --show-current and git branch -vv. If the intended remote branch already exists, fetch then run git branch --set-upstream-to=origin/BRANCH BRANCH. This only configures tracking. If publishing a new local branch is intended, git push --set-upstream origin BRANCH pushes it and records tracking; obtain the user's authorization for the push.

Do NOT rename a branch to master merely because the sample error says master. Setting an upstream will not create a first commit or repair src refspec main does not match any.

Sources Git push upstream option, Git branch tracking, and exact community log, checked 2026-10-20.

Cannot rebase with unstaged changes

Exact message error: cannot rebase: You have unstaged changes.

Tracked working-tree changes block rebase before Git decides whether they would conflict. Inspect git diff and git diff --cached. Commit only intended paths, or preserve work explicitly before rebasing.

git stash push -u -m before-rebase
git stash list
git rebase origin/BRANCH
git stash apply

Run each step separately. Confirm the new stash was actually created; if it was not, stop rather than applying an older stash. Apply only after the rebase succeeds. Inspect git status, resolve any stash-application conflicts and verify the restored edits before optionally dropping that stash. -u includes untracked files but not ignored files. Alternatively, git rebase --autostash origin/BRANCH automates saving and applying tracked changes, but can still conflict on restoration.

Do NOT discard changes with reset/checkout to make the worktree clean, or assume autostash prevents conflicts. Sources Git stash, Git rebase autostash, and exact error report, checked 2026-10-20.

What the community says

  • Davide Casiraghi's pull warning question includes the later fatal, so distinguish warning-era advice from the actual log.
  • Kuibin Lin's push/pull walkthrough illustrates choosing a reconciliation method after a pull refusal. No readership or independent success count was exposed.
  • Nathan Typanski's rebasing walkthrough shows a dirty-worktree interruption and autostash in his own workflow. His phrase “no One True Workflow” fits the merge/rebase choice; it is not proof that every stash restoration is safe. Both blogs checked 2026-10-20; fixes rely on official manuals.

Recommendation by constraint

Merge shared history; rebase private commits under team policy. Save edits and configure tracking independently.

A prompt to give your agent

Read the linked Git manual and exact-message source rather than guessing from the word fatal. Report the failing command, Git version, current branch, tracking branch, worktree state and graph. Explain merge versus rebase for these commits. Propose one repair preserving my edits; do not change global config, discard work or push without authorization. Stop if the observed message or graph does not fit this cluster.

Limits

No pull, rebase, merge, stash or push was run. All four supplied strings were verified; no supplied string was dropped. The first affected release for each string is unverified. Blog evidence is qualitative and thin, with no measured success rate. Not for uses published-snapshot neighbours.

Started from a post by @Nathan Typanski, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Need to specify how to reconcile divergent branches: Git fix?
Summary: As of October 2026, Git pull refusals need an explicit merge/rebase decision, while missing upstream and unstaged-change errors require tracking or worktree fixes first. Preserve edits, inspect the graph and avoid automatic resets or force pushes; checked 2026-10-20.
Copy for agent
get the whatworks thread git-divergent-fast-forward-upstream-unstaged-rebase-errors and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread git-divergent-fast-forward-upstream-unstaged-rebase-errors
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks