rebase-worktreelisted
Install: claude install-skill m4ttstack/skills
# rebase-worktree
Bring one worktree's branch current with the default branch: fetch, show
what will replay, then rebase. This never guesses -- it refuses on a dirty
tree, hands conflicts back to a human, and never pushes unasked.
## Preconditions
Check these before anything mutates, and report before touching history:
- **Clean tree.** `git -C <worktree> status --porcelain` must be empty.
Dirty: one sentence listing the uncommitted paths, then the
structured-question tool with **I committed them, retry** / **Abort**;
**Hold** (under a run, scope `clarify`, recorded with `--selection
'{"tree":"retry|abort"}' --decided-by rebase-worktree`). Never `git
stash` and proceed: moving someone's uncommitted work is not this
skill's call. The STOP table under the push gate binds this form too.
- **Upstream set.** `git -C <worktree> status -sb` prints the branch line
first; no `...origin/<branch>` tracking ref there means no upstream --
stop and report, there's nothing to rebase onto.
- **Discover the default branch.** `git -C <worktree> symbolic-ref
refs/remotes/origin/HEAD`; if that's unset, fall back to the forge
CLI's repo view (`glab repo view` / `gh repo view`). Never hardcode a
branch name.
## Stack guards
Both checks run before any fetch or rebase; either one refusing ends the
run. A single-branch rebase is legal only when the branch is stack-free
in both directions.
- **Child check:** look up the branch's open MR or PR (`glab mr view
<branch>` / `