sync-fork

Installation
SKILL.md

Sync Fork

Sync a forked repository with its upstream remote. The fork's shared branches (e.g., main) are maintained as the equivalent of upstream plus local patches re-merged on top — a "patched upstream" model. Each sync resets to upstream, rebases fork-only branches, and re-merges them.

If upstream hasn't advanced (i.e., upstream/main is already an ancestor of fork/main), the sync is a no-op.

Usage

/sync-fork [<fork-remote> <upstream-remote>]

  • With no arguments — auto-detect if exactly two remotes exist. If more than two, ask the user to specify.
  • With one argument — the provided name is ambiguous. Look up its URL with git remote get-url <name> and ask the user: "<name> points to <url> — is this your fork, or the repo you forked from?" Then ask for the other remote name.
  • With two arguments — first is the fork remote, second is the upstream remote.

When auto-detecting with exactly two remotes, use heuristics to guess which is the fork and which is upstream (e.g., a remote named origin is more likely the fork; a remote whose URL org differs from the other is more likely upstream). Present your guess and ask the user to confirm.

⚠️ Credential safety: Remote URLs may contain embedded credentials (e.g., https://user:token@github.com/...). Before displaying any URL to the user, redact the userinfo portion: replace user:token@ with ***@. Never output raw credentials from git remote -v or git remote get-url.

Diagram legend

Related skills

More from shhac/skills

Installs
21
Repository
shhac/skills
First Seen
Mar 7, 2026