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
| Component | Official reference used | Boundary |
|---|---|---|
| Git pull | Git 2.33.1 manual and tagged source | Source contains the divergent-branches fatal; this is a verified example version, not a claim about the first affected patch |
| Git merge, push, branch, rebase, stash | Current git-scm manuals linked below | Check local git --version; wording and defaults can differ across releases |
These are reference versions, not a release comparison.
When to pick which
| State | Pick | Why |
|---|---|---|
| Local commits are private; team wants linear history | Rebase | Replays local commits with new identities |
| Commits are shared; preserve existing ancestry | Merge | Combines histories without replaying your commits |
| Automation must refuse divergence | Fast-forward only | Stops instead of choosing a history change |
| Changes are not committed | Save selected work or stash before rebasing | Protects 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