/colin-shipping:restack-requestsfrom colin-shipping
Merges and restacks stacked GitLab MRs and GitHub PRs so each lands as one squashed commit without manual rebasing. Replays only each branch's own commits, verifies content unchanged, and force-pushes with lease.
Ships in colin-shipping. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Stacked requests: each branch is based on the previous one's branch, and each request squashes
to one commit on the default branch. Squash-merging a parent destroys patch-id correspondence,
so a plain git rebase <target> on a child replays the parent's old commits on top of the
squash and conflicts. This skill replays only each branch's own commits, so no conflict is
ever resolved by hand. It needs no .git/machete file and no local reflogs.
"Request" means a GitLab MR (glab, !123) or a GitHub PR (gh, #123); the helper detects
which from the origin URL (override with --forge gitlab|github). Use the glab-cli or
gh-cli skill for anything this one does not spell out.
Two jobs, one workflow:
The user's request authorizes merging X (for "Merge") and force-pushing the dependents,
teammates' branches included, because the restack is verified to preserve every commit's
content. It authorizes nothing else. Rewriting X itself is out of scope; for a root that is
behind its target, use glab mr rebase / gh pr update-branch --rebase.
S=<this skill's directory>/scripts/stack-restack; run from the repository; keep the plan
file in the scratchpad.
python3 $S plan <request> --out <plan.json> # number, !n, #n, URL, branch, or DEV-1234
# merge the root (step 2), GitLab:
glab mr rebase <n> # only when gates.needs_rebase
glab mr merge <n> --squash --remove-source-branch --sha <root.sha> --yes
# merge the root (step 2), GitHub:
gh pr update-branch <n> --rebase # only when gates.needs_rebase
gh pr merge <n> --squash --delete-branch --auto --match-head-commit <root.sha>
python3 $S wait <n> # run_in_background; merged|stalled|closed|timeout
python3 $S restack --plan <plan.json> # local only: rebases, verifies, writes results into the plan
python3 $S publish --plan <plan.json> # push --force-with-lease + retarget, parents before children
All output is JSON. restack-one --head --onto --exclude is the primitive, for one-off use.
Plan before anything moves. Run plan. Before a merge it must run first: once the forge
deletes the source branch it retargets children, and the original stack shape is gone.
Report the tree: root gates, and per dependent its parent, author, own-commit count, target
change (target_if_merged), and any evil_merges. Surface warnings verbatim; the main
one is a root that targets a release branch instead of the default branch, which makes the
per-request squashes land there and the default branch get one commit for the whole branch.
Merge the root (only for "Merge X", and only if not already merged).
gates.blockers is non-empty. A failed check, a draft, missing
approvals, requested changes, or unresolved threads are the user's call, not yours.glab default, gh --auto) and the forge merges
when they pass. On a GitHub merge queue the request is enqueued and wait follows it.needs_rebase: rebase on the forge, wait for the new head, re-read sha (re-run plan
only if the head is unknown), then merge with that sha. The rebase starts new checks.--sha / --match-head-commit) so only the head you checked
gets merged.wait in the background. stalled (checks failed, auto-merge cancelled) or closed
ends the run: report it and do not restack.Restack locally. Run restack. Per dependent it creates a throwaway worktree,
cherry-picks the own commits with rerere off, and drops commits already on the base. It
checks that every replayed commit has the same changed lines (and binary blobs) as the
original, and that the result merges cleanly into its final target. A branch already based
on the new base is reported up_to_date and left alone. Nothing is pushed.
conflict: report the commit subject, files, and base_commits_with_same_subject. Do
not resolve it yourself; skip that branch and its descendants.evil_merges: a merge commit in the branch carries a hand-made resolution that
replaying would drop. Report it; rerun with --allow-evil-merges only if the user says so.branch moved since plan: someone pushed. Re-run plan for that subtree.empty: true: everything on the branch is already in the base. Report it.Publish. Run publish. It keeps a local backup ref refs/restack-backup/<branch> at
the old head, pushes with --force-with-lease=<branch>:<old head> to an explicit refspec,
and retargets the request when its target was the merged branch. The forge may have
retargeted it already. A lease rejection means the author pushed meanwhile: report it, do
not retry with --force.
Update each restacked request.
<short squash sha> (or, in open mode, that it was rebased onto X's new tip) and the
branch now holds only its own commits. A restack changes no behavior, so do not rewrite
the rest. If the repo requires a Described at: <short-sha> footer, set it to the new
head. Use colin-mr-description only when the description is wrong for other reasons.glab mr note <n> -m / gh pr comment <n> -b with "Restacked onto
after merged ( → ). If you have this branch locally: git fetch && git
reset --hard origin/".Report. Merged root and its squash SHA; per dependent: old → new head, commits replayed, empty commits dropped, retarget, and anything skipped with the reason. Mention the backup refs. CI owns the checks, so do not run local test suites for a content-identical restack.
"Merge the stack" is the loop above, bottom-up, one request at a time: after step 4 the first
child is the new root. Re-run plan on it, wait for its checks on the restacked head, then
merge it. Stop at the first blocker, conflict, or lease rejection and report; never merge a
dependent as a side effect of "Merge X" unless the user asked for the whole stack.
git rebase <target> on a dependent.--force; never push a branch whose restack result is not ok.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
stacked-prs, stacked-mrs, git-workflow, merge-strategy, restack
npx claudepluginhub colinmollenhour/dotfiles --plugin colin-shipping34 skills in this plugin
/cclsp-fix-diagnosticsScan a codebase with the CCLSP MCP and fix reported diagnostics. Language- and project-agnostic. Use for "fix all the LSP errors", "check the workspace for errors", "fix diagnostics in <path>", or auditing a branch/PR/commit range for new errors. Default scope is the whole codebase, chunked. User can narrow to files, folders, commits, ranges, branches, PRs, or MRs./clickup-task-authoringAuthor a ClickUp task from a conversation, plan, review, incident, or spec as CUFM via cup task-sync. Covers the source-fidelity ledger, the house voice for task copy (plain verbs, declarative mood, paragraphs over lists, 5% length budget), rich description structure (banners, toggles, mermaid, tldraw, tables), open-decision blocks (question, AI Recommendation, two alternatives), title conventions, workspace Value Stream / Requested By / Bug-type rules, and the post-write audit. Use when creating or updating ClickUp task content (file a bug, write a ticket, turn this into a task). Load the clickup skill from `cup skill` for CUFM syntax and task-sync flags. Workspace IDs come from `cup` or a project ClickUp skill. Formerly clickup-tasks.Other plugins' skills for the same job
/cli-designDesign, implement, or review CLI UX: args, flags, help, output, errors, config, interactivity, and distribution.