Stack Sync — Git skill for Claude Code
Cascade-rebase the current branch and all its descendants onto the new main, after a parent PR has merged.
How to install Stack Sync
Installs to ~/.claude/skills/railima-claude-personal-skills-stack-sync/SKILL.md
mkdir -p ~/.claude/skills/railima-claude-personal-skills-stack-sync && curl -fsSL https://raw.githubusercontent.com/railima/claude-personal-skills/HEAD/commands/stack-sync.md -o ~/.claude/skills/railima-claude-personal-skills-stack-sync/SKILL.md Restart Claude Code, or start a new session, for it to be picked up.
What Stack Sync does
Cascade-rebase the current branch and all its descendants onto the new `main`, after a parent PR has merged. Use this when the root of your stack just merged on GitHub.
Steps:
- Pre-flight checks:
- Confirm git version >= 2.38 (for
--update-refs):git --version. If older, follow the "Fallback" section at the bottom of this file. - Confirm clean working tree:
git status --short. If anything is staged or unstaged, stop:"Uncommitted changes detected. Commit, stash, or dis
- Confirm git version >= 2.38 (for
Alternatives in Git
- Ws Reset — Reset the current branch to main, fetch upstream, and update submodules 38.1k ★
- Clean Worktrees (Automatic) — Automatically remove all worktrees for branches merged into master 25.5k ★
- OSS PR — Commit + PR workflow for open source contributions: auto-creates a user-prefixed branch when on main/master, t 19.7k ★
Full documentation available on GitHub
View Source RepositoryRelated Skills
Stack List
Show the current stack — the chain of branches from the current branch up to main, plus any descendants below
Sync Develop
Schedule sync with develop branch - adds to TODO, executes at convenient moment (after current task). Use when
Stack Link
Retroactively register the parent of the current branch in the stacked-PRs system. Use this when you have an e
Branch Cleanup
Clean up merged, stale, and orphaned git branches. Protects main/develop/release/ automatically. Supports --dr
Clean After Merged
Switch to the repo's main branch, pull, and delete the just-merged local branch.
Cleanup Worktree
Remove a merged worktree and its branch after verifying it was merged into main
Related Agents
Branch Janitor
Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes
Gitnexus Branch Hygiene Reviewer
GitNexus branch hygiene and mergeability reviewer. Use to classify merge state, conflicts, stale branches, mer
Merger
Reviews, validates, and merges arc-agents PRs. Sole authority for destructive git ops (rebase, push, merge, br