Fix bare pull aborting on a divergent branch#77
Merged
Conversation
The toolbar surfaces Pull the instant a branch is behind, so an ahead+behind (diverged) branch runs a plain `git pull`. Since git 2.27 that aborts with "fatal: Need to specify how to reconcile divergent branches" unless a strategy is pinned, stranding the user: Pull keeps failing and Push is blocked for being behind. Default a non-rebase pull to `--ff` (fast-forward when possible, merge when diverged) unless the user has set pull.ff themselves — enough to satisfy git's reconciliation check while respecting an explicit config. Adds an integration test covering both the divergent merge and the pull.ff=only opt-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a branch is both ahead and behind its upstream (diverged), the toolbar surfaces Pull as the primary action (it checks
behind > 0beforeahead > 0). Clicking it runs a plaingit pull.Since git 2.27, a bare
git pullthat can't fast-forward aborts:…unless a reconciliation strategy is pinned (
pull.rebase,pull.ff, or a flag). With none configured, the user is stranded: Pull keeps failing, and Push is blocked for being behind — no obvious way out.Fix
Default a non-rebase pull to
--ff(fast-forward when possible, merge when diverged) unless the user has setpull.ffthemselves. That's enough to satisfy git's reconciliation check while respecting an explicit config;pull.rebase, if set, git still honours over--ff. Thepull --rebasepath is untouched (it already pins a strategy).Tests
Adds
sync.test.ts— an integration test driving the realgitbinary against a throwaway diverged clone:pull.ff=onlyis respected: the divergence is left to the user🤖 Generated with Claude Code