sync-base

Synchronizes a git branch with its moved base via fast-forward, rebase, or merge.

Updated Jun 6, 2026
One-click install
npx skills add https://github.com/hacker-cb/claude-code-plugins --skill sync-base-hacker-cb
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sync-base
Source: https://github.com/hacker-cb/claude-code-plugins/tree/main/plugins/hcb-dev/skills/sync-base
Command: npx skills add https://github.com/hacker-cb/claude-code-plugins --skill sync-base-hacker-cb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Branches fall behind their base as upstream work lands, and catching up safely requires choosing between fast-forward, rebase, and merge while protecting uncommitted work, published history, and in-progress operations. This Skill automates that decision and execution without ever pushing or rewriting shared state. ## Core Features & Use Cases - Base detection and refresh: Resolves which base the branch stands on (named base, plan-doc parent, wave ledger, forge default branch) and fetches its current tip. - Safe take strategies: Fast-forwards when the branch has no commits of its own, rebases by default, merges where history may not be rewritten, and uses --autostash over a dirty tree. - Divergence and rewrite guards: Detects a rewritten base via fork-point analysis, stops on real conflicts, and reports when a rebase leaves the branch diverged from its published copy. - Use Case: You return to a feature branch after a week and ask whether it is behind master; the Skill fetches the base, rebases your commits onto it, restores your stashed changes, and summarizes what arrived and what it affects. ## Quick Start Ask the assistant to sync this branch with its base, for example: "pull the latest base and rebase my branch onto it, then tell me what changed."

Frequently Asked Questions about sync-base

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync a git branch with its updated base branch?▼

Syncing a branch with its base means fetching the base's new tip and taking it via fast-forward, rebase, or merge. This Skill resolves the base automatically, picks the strategy from your branch's state, and reports what arrived.

When should I rebase versus merge a base into my branch?▼

Rebase is the default when your branch's history can be rewritten; merge is required when the branch is published and shared or its history must be preserved. The Skill decides from three documented cases and stops when the published copy cannot be read.

Can I rebase with uncommitted changes in my working tree?▼

Yes, git's --autostash flag carries uncommitted work through a rebase or merge and reapplies it afterward. If the autostash fails to reapply, the stash entry is restored by sha with git stash apply, never pop.

What happens if the base branch was rewritten with force push?▼

A rewritten base is detected through fork-point analysis: if the fork-point is no longer an ancestor of the base, a plain rebase would replay dropped commits. The Skill stops and recommends git rebase --onto from the fork-point instead.

Does this Skill push my branch after rebasing?▼

No, it writes only to the local worktree and never pushes. If a rebase leaves the branch diverged from its published copy, it reports that publishing requires git push --force-with-lease, which remains the user's decision.

Why does a rebase stop instead of resolving a conflict automatically?▼

Trivial conflicts are resolved and the operation continues, but conflicts needing a real architectural decision trigger git rebase --abort, which restores the autostash. The run then stops with a recommendation rather than guessing.