← ClaudeAtlas

branch-rebaselisted

Safely rebase the current branch onto its upstream target (baseline, main, or master). Auto-resolves simple merge conflicts (version bumps, changelogs). Prompts for complex ones. Use when user says "rebase", "rebase branch", "rebase onto main", "update my branch", "sync with baseline", "catch up with main", or invokes /branch-rebase.
risadams/skills · ★ 2 · AI & Automation · score 65
Install: claude install-skill risadams/skills
# Branch Rebase Rebase the current feature branch onto its upstream target with automatic resolution of trivial conflicts. ## Invocation ``` /rebase-branch [target] ``` - `target` — branch to rebase onto. Defaults to the first of `baseline`, `main`, `master` that exists. ## Workflow Follow every step in order. Do not skip steps. Do not push at the end. ### 1. Validate environment ```bash git rev-parse --is-inside-work-tree ``` If not a git repo, stop and tell the user. ### 2. Detect branches ```bash CURRENT=$(git branch --show-current) ``` If `CURRENT` is empty (detached HEAD), stop: "You are in detached HEAD state. Check out a branch first." If a target argument was provided, use it. Otherwise detect the target: ```bash for candidate in baseline main master; do if git show-ref --verify --quiet "refs/heads/$candidate" || \ git show-ref --verify --quiet "refs/remotes/origin/$candidate"; then TARGET=$candidate break fi done ``` If no target found, stop: "Could not find baseline, main, or master. Specify a target branch." If `CURRENT` equals `TARGET`, stop: "You are already on the target branch." ### 3. Check for uncommitted changes ```bash git status --porcelain ``` If output is non-empty, **stop immediately** and tell the user: > You have uncommitted changes. Please commit or stash them before rebasing. List the dirty files so they can decide. Do not proceed. ### 4. Update the target branch ```bash git checkout $TARGET git pull --ff-only