Agent skill

Sync Branch

by Smana in Smana/cloud-native-ref

Rebase the current branch onto the latest origin/main before pushing, reviewing, or opening a PR.

Apache-2.0Auto-check passedDevelopment

Install Sync Branch

skills CLI
$ npx skills add Smana/cloud-native-ref --skill sync-branch -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Smana/cloud-native-ref sync-branch --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Smana/cloud-native-ref.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/sync-branch .claude/skills/sync-branch && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sync-branch
GitHub stars
103
Token cost
~966 tokens
SKILL.md length
452 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
Apache-2.0

At a glance

Rebase the current branch onto the latest origin/main before pushing, reviewing, or opening a PR.

  • Works in 4 steps: Refuse the unsafe cases → Fetch, then compare → Rebase → …
  • The user says rebase
  • SKILL.md covers 1. Refuse the unsafe cases, 2. Fetch, then compare, 3. Rebase and 4. Push — only when asked, plus 1 more section
  • Calls git

What it does

Sync Branch is an agent skill from Smana/cloud-native-ref. Rebase the current branch onto the latest origin/main before pushing, reviewing, or opening a PR. Fetches origin first so the comparison uses the real remote tip, not a stale local ref. Use when the user says "rebase", "sync with main", "is this up to date", "update the branch", before opening or updating a pull request, and whenever a review or a CI result would otherwise be judged against an outdated merge base.

Its SKILL.md is about 970 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Requires git and a configured origin remote

It sits in Development, covering Git workflow and Pull requests. It works with Git. The repository describes itself as: Opiniated Cloud Native Platform Reference. The licence is Apache-2.0.

When your agent uses it

  • The user says rebase
  • Is this up to date
  • Update the branch
  • Updating a pull request

Example prompts

  • “rebase”
  • “sync with main”
  • “is this up to date”
  • “/sync-branch”

Requirements

  • Compatibility (from SKILL.md): Requires git and a configured origin remote
  • Pre-approved tools (allowed-tools): Bash(git:*)

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Refuse the unsafe cases
  2. Fetch, then compare
  3. Rebase
  4. Push — only when asked

What it can do on your machine

Read from SKILL.md and the folder at commit e5ee7e1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(git:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires git and a configured origin remote

    From compatibility in the SKILL.md frontmatter.

Context cost

Sync Branch loads about 966 tokens when it runs. Until then it costs about 107 tokens; SKILL.md has 452 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~107
When it runs · the whole SKILL.md, loaded when a task matches
~966

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Smana/cloud-native-ref at commit e5ee7e1, republished under its Apache-2.0 licence (© Smana). 452 words, ~966 tokens.

Download SKILL.mdSave it as .claude/skills/sync-branch/SKILL.md (or your agent's skills folder).
name
sync-branch
description
Rebase the current branch onto the latest origin/main before pushing, reviewing, or opening a PR. Fetches origin first so the comparison uses the real remote tip, not a stale local ref. Use when the user says "rebase", "sync with main", "is this up to date", "update the branch", before opening or updating a pull request, and whenever a review or a CI result would otherwise be judged against an outdated merge base.
allowed-tools
Bash(git:*)
compatibility
Requires git and a configured origin remote

Sync branch onto origin/main

A branch that is behind origin/main produces a diff that no longer describes what will merge. Reviews read the wrong merge base, CI passes against code nobody will ship, and conflicts surface at merge time instead of now.

Run this before every review, push and PR — not only when a conflict is suspected.

1. Refuse the unsafe cases

Stop and report, do not proceed, when any of these hold:

ConditionCheckWhy
On the base branch itselfgit branch --show-current is mainnothing to rebase
Uncommitted changesgit status --porcelain is non-emptya rebase would strand them. Commit first — ship-it does this before calling you
Rebase already runningtest -d "$(git rev-parse --git-path rebase-merge)", same for rebase-applyfinish or abort it first

Resolve that third one through git rev-parse --git-path, never as a literal .git/…. In a worktree .git is a file, not a directory — it holds gitdir: …/.git/worktrees/<name> — so a literal path can never match and the guard silently passes. This repo mandates a worktree for every change, which would make the check dead everywhere it matters.

2. Fetch, then compare

The fetch is the point. Comparing against a local origin/main that was last updated hours ago reports "up to date" on a branch that is not.

bash
BASE="${BASE:-main}"
git fetch origin "$BASE"

if git merge-base --is-ancestor "origin/$BASE" HEAD; then
  echo "up to date with origin/$BASE"
else
  echo "behind origin/$BASE by $(git rev-list --count HEAD..origin/$BASE) commit(s)"
fi

When the branch is already up to date, say so and stop. Do not rebase for the sake of it — a no-op rebase still rewrites committer dates and invalidates anyone's local copy.

3. Rebase

bash
git rebase "origin/$BASE"

On conflict, resolve one file at a time and preserve intent from both sides:

bash
git status --short | grep '^UU'   # conflicted files
# edit, then:
git add <file>
git rebase --continue

If the conflicts are not mechanically resolvable — two branches changed the same behaviour for different reasons — git rebase --abort and ask. Guessing which side wins silently reverts someone's work.

Show full SKILL.md (163 more words)Show less

4. Push — only when asked

Rebasing does not imply pushing. A rebase rewrites history, so publishing it force-pushes a branch someone may have checked out. Do that only when the caller has actually asked to push or to open a PR — not as a side effect of "sync with main" or of a review.

When the push is wanted and the branch already exists on the remote, use --force-with-lease, never bare --force: it refuses when someone else has pushed since you last fetched, which is the entire failure it exists to prevent.

bash
git push --force-with-lease origin "$(git branch --show-current)"

A branch that has never been pushed needs no force at all — a plain git push -u origin <branch> belongs to whatever opens the PR.

Report

State the outcome in one line, with the number that backs it:

  • already up to date with origin/main (a1b2c3d)
  • rebased 4 commits onto origin/main (a1b2c3d), not pushed
  • rebased 4 commits onto origin/main (a1b2c3d), force-pushed with lease
  • rebase aborted — <file> conflicts on <what>, needs a decision

© Smana, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/sync-branch of Smana/cloud-native-ref.

Open the folder on GitHubat commit e5ee7e1

Compare with similar skills

Sync Branch next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sync Branch compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sync Branch this skillSmana/cloud-native-ref103—~966Automated safety check: PassApache-2.0
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Git Branch Namingmakeplane/plane61k—~594Automated safety check: PassAGPL-3.0
Creating Description For Gh PRredis/jedis12k—~838Automated safety check: PassMIT

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Git Branch Naming

    makeplane/plane

    Names a new Git branch with a type prefix, the lowercased work item ID and a short kebab-case description, so the ID can be extracted later from the branch name.

    61k GitHub stars~594 tokensUpdated today
    DevelopmentAuto-check passed
  • Official

    Generate a clear, concise GitHub PR title and description from the diff between two local git branches, and save it to prDescription.md in the repo root.

    12k GitHub stars~838 tokensUpdated today
    DevelopmentAuto-check passed
  • Opens a pull request for the current branch using the repo's template, a work item ID in the title and a description filled in from the actual diff.

    61k GitHub stars~824 tokensUpdated today
    DevelopmentAuto-check passed

More from Smana/cloud-native-ref

  • Commit

    Smana/cloud-native-ref

    Run pre-commit validation before committing. An agent skill from Smana/cloud-native-ref.

    103 GitHub stars~778 tokensUpdated today
    Auto-check passed
  • Ship It

    Smana/cloud-native-ref

    Take a finished branch through the full pre-merge pipeline in one pass — rebase onto origin/main, simplify, prune prose, run the repo's validators and cite their output, review the diff, act on…

    103 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Create PR

    Smana/cloud-native-ref

    Create or update a Pull Request with AI-generated description, mermaid diagram, file walkthrough, and automatic design-doc detection.

    103 GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Spec Research

    Smana/cloud-native-ref

    Research patterns, ecosystem tools, and best practices before writing a design.

    103 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Verify Spec

    Smana/cloud-native-ref

    Verify that a merged design's success criteria are actually met in the live cluster.

    103 GitHub stars~1.5k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Sync Branch

What does Sync Branch do?

Rebase the current branch onto the latest origin/main before pushing, reviewing, or opening a PR. Sync Branch is an agent skill from Smana/cloud-native-ref. Rebase the current branch onto the latest origin/main before pushing, reviewing, or opening a PR.

When should I use Sync Branch?

Sync Branch fits situations like: the user says rebase; is this up to date; update the branch; updating a pull request.

How do I install Sync Branch in Claude Code?

Run `npx skills add Smana/cloud-native-ref --skill sync-branch -a claude-code`. Or copy the skill folder (.agents/skills/sync-branch in Smana/cloud-native-ref) into .claude/skills/sync-branch in your project. Claude Code loads it when a task matches its description.

How do I install Sync Branch in Codex?

Run `npx skills add Smana/cloud-native-ref --skill sync-branch -a codex`. Or copy the skill folder (.agents/skills/sync-branch in Smana/cloud-native-ref) into .agents/skills/sync-branch in your project. Codex loads it when a task matches its description.

Can I use Sync Branch in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Smana/cloud-native-ref --skill sync-branch -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sync-branch, .gemini/skills/sync-branch, .github/skills/sync-branch and .opencode/skills/sync-branch in your project.

What does Sync Branch need to run?

Going by SKILL.md and its folder, Sync Branch needs the command-line tools its instructions call (git). Its frontmatter pre-approves these tools: Bash(git:*). Compatibility (from SKILL.md): Requires git and a configured origin remote.

Does Sync Branch access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Sync Branch safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sync Branch use?

Sync Branch is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sync Branch use?

About 966 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Sync Branch?

Skills that share tags, products or a category with Sync Branch: Finishing a Development Branch (obra/superpowers, 296k stars), Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars), Create Pull Request (cline/cline, 70k stars) and Git Branch Naming (makeplane/plane, 61k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sync Branch?

Smana (a GitHub user) maintains it in Smana/cloud-native-ref, which has 103 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 8, 2026.

Source: Smana/cloud-native-ref on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.