npx skills add ...
npx skills add brave/brave-core --skill rebase-downstream
npx skills add brave/brave-core --skill rebase-downstream
'Rebase a tree of dependent branches (including siblings) after upstream changes. Auto-detects downstream branches and rebases each in order. Triggers on: rebase downstream, rebase chain, propagate changes downstream.'
Rebase a tree of dependent branches after upstream changes have been made. Auto-detects the downstream branch tree (including sibling branches), rebases each branch in order, resolves conflicts when possible, and runs preflight checks on each branch.
git branch --show-currentgit status --shortGet the current branch name. This is the branch that was just modified and whose changes need to propagate downstream.
Run the detect-chain.sh helper script to find all downstream branches:
The script outputs branch:parent per line in rebase order (depth-first
pre-order). This handles both linear chains and trees with sibling branches.
Display the detected chain to the user and ask for confirmation before proceeding.
If no downstream branches are detected, report this to the user and stop.
If branches are detected, show the tree visually:
Ask the user to confirm before rebasing. If the user declines, stop.
For each downstream branch (closest to the current branch first):
Checkout the branch:
Rebase onto its parent (from the branch:parent output):
--fork-point uses the parent branch's reflog to find the actual fork point,
so only the branch's own commits are replayed. Without it, if the parent was
rebased/amended, git replays already-applied parent commits with different
SHAs, causing duplicate commits and false conflicts.
The parent for each branch is provided by the detect script. For sibling branches, both share the same parent.
Handle conflicts (if any):
Run full preflight checks using /preflight on this branch. This
includes format, gn_check, presubmit, build, and tests. If preflight fails,
stop and report. Do NOT continue to the next branch.
Move to the next branch only after successful rebase and preflight.
After all branches are rebased successfully, checkout the original starting branch:
Summarize the results: