Skip to content
Skills Library
Programming · Automation

rebase-downstream

/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.

Author
brave ↗
Repository
brave-core ↗
Licence
AGPL-3.0
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: detect-chain.sh

What it does and when to use it

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.

Original author description

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.

How it works

  1. Current State
  2. Steps
  3. Important
Original SKILL.md headings · 125 lines, 529 words
SKILL.md preview
---
name: rebase-downstream
description:
  '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.'
disable-model-invocation: true
---

# Rebase Downstream Tree

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.

## Current State

- Branch: !`git branch --show-current`
- Status: !`git status --short`

## Steps

### 1. Detect current branch

Get the current branch name. This is the branch that was just modified and whose
changes need to propagate downstream.

```bash
git branch --show-current
```

### 2. Auto-detect downstream chain

Run the `detect-chain.sh` helper script to find all downstream branches:

```bash
bash .claude/skills/rebase-downstream/detect-chain.sh <current-branch>
```

The script outputs `branch:parent` per line in rebase order (depth-first
pre-order). This handles both linear chains and trees with sibling branches.

### 3. Confirm the chain

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:

```
<current-branch>
  → <child1>
    → <grandchild1>
  → <child2> (sibling)
```

Ask the user to confirm before rebasing. If the user declines, stop.

### 4. Rebase each branch in order

For each downstream branch (closest to the current branch first):

1. **Checkout the branch**:

   ```bash
   git checkout <downstream-branch>
   ```

2. **Rebase onto its parent** (from the `branch:parent` output):

   ```bash
   git rebase --fork-point <parent-branch>
   ```

   `--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.

3. **Handle conflicts** (if any):

   - Inspect each conflicted file to understand both sides
   - Attempt to resolve the conflict intelligently
   - After resolving, stage the files and continue:
     ```bash
     git add <resolved-files>
     git rebase --continue
     ```
   - If a conflict cannot be resolved, abort and stop:
     ```bash
     git rebase --abort
     ```
     Report which branch and files had unresolvable conflicts, then stop
     entirely. Do NOT continue to the next branch.

4. **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.

5. **Move to the next branch** only after successful rebase and preflight.

### 5. Return to the original branch

After all branches are rebased successfully, checkout the original starting
branch:

```bash
git checkout <original-branch>
```

### 6. Report results

Summarize the results:

- **Rebased branches**: List each branch that was successfully rebased
- **Conflicts resolved**: Note any conflicts that were auto-resolved and how
- **Preflight results**: Summary of preflight status for each branch
- **Tree**: Show the full rebased tree structure

## Important

- **NEVER skip preflight checks** on any branch in the chain
- Stop immediately if a rebase conflict cannot be resolved
- Stop immediately if preflight fails on any branch
- Always return to the original branch at the end (even on failure)
- Do not force-push any branches — the user will decide when to push
Files in this package (2)
  • SKILL.md 4 KB
  • detect-chain.sh 5 KB

Versions

The database has no other skills named rebase-downstream.

Database snapshot: 13.11.2026 · package version 9d65b7d9c0a7 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100force-push-downstream
    Force-push a branch and all its downstream branches to origin. Auto-detects the downstream tree and skips branches already up-to-date. Triggers on: force push downstream, push chain, push all branches.
  • 91rebase-all
    Rebase all local branches onto the configured upstream branch. Use when the user asks to rebase every branch or bring all branches up to date.
  • 100stack-rebase
    Cascades a rebase through an entire PR stack after a base PR merges or upstream changes. Use when a stack needs to incorporate new base branch commits.
  • 100git-stacked-pr-rebase
    Rebase a stack of dependent branches and pull requests (PR 2 branched off PR 1, PR 3 off PR 2) after something underneath them changes - the bottom PR was squash-merged or rebase-merged, a lower branch was amended or force-pushed, or the trunk moved. Use this whenever the user…
  • 100upstream-fork-sync
    This skill should be used when the user asks to "keep a fork in sync", "rebase local changes on upstream", "sync my fork nightly", "long-lived fork", or "automate upstream rebases". Guides the user through creating a cron automation that fetches upstream changes, rebases local…
  • 100rebase-pr-chain
    Rebase a chain of dependent pull requests sequentially, fixing conflicts along the way. Use when the user asks to rebase a PR chain, fix conflicts on multiple chained PRs, or mentions sequential/stacked PRs that need updating.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.