Repository navigation
Use origin/<default_branch> as the base for new, diff, git-log and ship - #108
Merged
Merged
Conversation
…ult_branch> The base clone's local default branch is never updated, so diffing against it pulled in every commit it was behind. diff and git-log now fetch origin/<default_branch> first (reusing a fetch from the last 30 s, giving up after 15 s) and use it as the base. A failed fetch falls back to the last fetched ref with a warning, never to the local branch. While there, the local default branch is fast-forwarded under a flock when that is safe; diverged or dirty branches are left alone with a warning. JSON results report base, base_sha, base_updated and warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`skulk new` (and `replay`) used to branch from the base clone's local default branch, which drifts behind. They now fetch origin/<default_branch> and create the worktree from it with --no-track, fast-forwarding the local branch when safe. Fetch warnings join the JSON warnings, and the result reports base, base_sha and base_updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lt_branch> ship fed claude the diff against the base clone's stale local default branch, so descriptions covered unrelated upstream commits. It now fetches origin/<default_branch> before pushing and diffs against it. The JSON result reports base, base_sha, base_updated and warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ay why not pull used `git pull --ff-only origin <branch>`, which fast-forwards whatever branch the base clone has checked out. It now goes through the same base sync as new/diff/git-log/ship: it always fetches, waits for the lock, and fast-forwards the local default branch itself (merge when checked out, guarded update-ref otherwise). Diverged history, uncommitted changes, a failed fetch or a busy lock are errors that say why. --force still hard-resets. The JSON result adds base, base_sha and base_updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Quote default_branch once into $B and pass it to printf as an argument, so a branch name with ; ' % $ ` or " can neither break nor inject. - Stamp failed and timed-out fetches too, with their warning, so commands within 30 s reuse the last fetched ref and repeat the warning instead of each waiting out the timeout. - Fall back to a mkdir lock (removed on exit, broken after a minute) where flock is missing, and move the branch with an update-ref guarded by the old sha, then read-tree -m -u when it is checked out, undoing the ref if the files can't follow. - Report a missing local branch as a "missing" warning; pull refuses with how to create it instead of claiming it is up to date. - Accept only a full hex sha as the base. - Restore the pull tests for a connectivity error in the base clone check and for an unknown sync error keeping its stderr, and the other dropped pull tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They used to name origin/<default_branch> in a second round-trip, so a fetch in between could make them use a different commit than the base_sha they report. They now take the sha the base sync returned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 30, 2026
Merged
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.
Why
Nothing kept the base clone's local
<default_branch>up to date. Over time it fell behindorigin. When that happened:skulk newbranched agents from an old commit.skulk diff,git-logandshipcompared against the old local branch. Upstream commits the agent already had then showed up as the agent's own changes, and the PR description generated byshipcould describe work the agent never did.What changed
New
src/base.rssync_baseruns one remote script that:origin/<default_branch>with a 15s watchdog. The script uses a watchdog because macOS has notimeout. On timeout it kills git's transport children first so nothing is left running.diff --statfollowed bydifffetches once, and an unreachable origin costs one timeout, not one per command.origin/<default_branch>and adds a warning. If that ref doesn't exist at all, the command fails.update-refguarded by the old sha. If the branch is checked out,read-tree -m -umoves the files, and the ref is rolled back if that step fails. It leaves the branch alone, with a warning, when the branch:diverged)dirty)checked-out)missing)flockwhere available. Otherwise it uses amkdirlock directory, which is treated as stale after a minute. Normal commands skip the update silently if the lock is held.The branch name is shell-quoted once into
$Band only ever expanded inside double quotes or passed as aprintfargument. The parsed base sha must be a full 40- or 64-character hex sha, because it is put into later commands unquoted.Commands
new/replay: create the worktree from the fetched sha, with--no-trackso the agent's branch doesn't trackorigin/main.diff,git-log,ship: compare against the fetched sha. Warnings go to stderr in human mode and intowarningsin JSON.shipfetches before pushing, so a missing base ref stops it before anything is pushed.pull(without--force): uses the same script, but it always fetches and waits up to 15s for the lock. Every warning becomes an error that explains the cause and how to fix it. This replaces matching on the stderr ofgit pull --ff-only, sopullcan no longer create a merge.--forcebehaves as before.JSON output
new,replay,diff,git-logandshipgain these fields:base: the ref used, e.g."origin/main"base_sha: the commit that ref pointed atbase_updated:{from, to}when the local branch was fast-forwarded, otherwisenulldiff,git-logandshipalso gainwarnings(newandreplayalready had it).pullwithout--forcegains the three base fields.Breaking:
git-log'sbasechanges from"main"to"origin/main".Docs
The README has a new "The base branch" section, and its config, command and JSON tables are updated. The plugin skill's
diffcomment is updated too.Tests
shipdoesn't push after a failed sync, and thatpull's error messages match each warning kind.mkdirlock (taking it, skipping while it is held, breaking a stale one), reusing a failed fetch within 30s, and a missing local branch.tests/cli_json.rscover:mainwithdiff,git-log,newandshippullfast-forwarding and refusing🤖 Generated with Claude Code