gt:git-rebaser
Triggers when rebasing a stack of branches — a parent plus child branches on top — where rebasing the parent leaves children orphaned. Use for "cascade rebase", "rebase branch hierarchy", "update child branches after rebase", "my sub-branches broke after rebasing parent", or any scenario that needs `git rebase --onto`. Not for a single-branch rebase.
What this skill does
# Git Rebaser — Guided Cascade Rebase
Safely rebase a parent branch onto a target (e.g. master) and cascade all child branches using `git rebase --onto`. Every destructive step requires explicit user confirmation.
## Workflow
### Phase 1: Gather Information
Ask the user these questions (use AskUserQuestion sequentially):
1. **Target branch** — "Which branch are you rebasing onto?" (default: `master`)
2. **Parent branch** — "Which is the parent feature branch to rebase?" (e.g. `feat/main`)
3. **Has the parent already been rebased?** — "Have you already rebased the parent branch, or should I do it now?"
4. **Child branches** — "List the child branches (comma-separated or space-separated)." (e.g. `feat/small-1, feat/small-2`)
### Phase 2: Analyze Current State
Run these commands and **report results to the user** before any action:
```bash
# For each branch, show its commit log relative to the parent
git log --oneline <parent>..<child> # unique commits per child
git log --oneline <target>..<parent> # commits on parent not yet on target
git merge-base <parent> <target> # current fork point
```
Display a clear summary:
```
Parent branch: feat/main (15 commits ahead of master)
Child branches:
feat/small-1: 3 unique commits on top of feat/main
feat/small-2: 5 unique commits on top of feat/main
```
### Phase 3: Rebase Parent (if not already done)
If the parent has NOT been rebased yet:
1. **Save the pre-rebase ref**: `OLD_PARENT=$(git rev-parse <parent>)`
2. **Show the plan**: "I will rebase `<parent>` onto `<target>`. This replays N commits."
3. **Ask confirmation** via AskUserQuestion: "Proceed with rebasing <parent> onto <target>?"
4. Execute:
```bash
git checkout <parent>
git rebase <target>
```
5. If conflicts occur, **stop and tell the user** — do NOT attempt to resolve automatically. Guide them through `git rebase --continue` after they fix conflicts.
If the parent was ALREADY rebased, determine `OLD_PARENT` using this tiered approach:
**Tier 1 — Reflog (most reliable, available ~90 days):**
1. Run `git reflog <parent>` and find the entry just before the rebase (typically `<parent>@{1}`).
2. Show the user the ref and its commit message. Ask them to confirm it's the pre-rebase tip.
3. If confirmed, set `OLD_PARENT` to that ref.
**Tier 2 — `git cherry` (works if commits weren't squashed/reordered during rebase):**
If reflog is unavailable or inconclusive:
1. Explain to the user: "Reflog doesn't have the old ref. I'll try matching commits by their diff content using `git cherry`. This works as long as the parent's commits weren't squashed or reordered during the rebase."
2. For each child, run:
```bash
git cherry -v <parent> <child>
```
- Lines starting with `-` = commits whose patch content already exists on the new parent (shared commits, safe to exclude).
- Lines starting with `+` = commits unique to the child (these are the ones to replay).
3. Show the user both lists and explain which commits will be kept vs dropped.
4. If the `+` list looks correct, count N unique commits and set `OLD_PARENT` to `<child>~N`.
**Tier 3 — Interactive commit selection (last resort, always works):**
If reflog is gone AND commits were squashed/dropped/reordered (making `git cherry` unreliable):
1. Explain to the user: "The parent branch's commits were modified during rebase (squashed, dropped, or reordered), so I can't automatically determine which commits belong to the child branch vs the old parent. The only safe approach is for you to identify your commits manually."
2. Show the full commit history:
```bash
git log --oneline <target>..<child>
```
3. Explain: "These are ALL commits on `<child>` that aren't on `<target>`. Some of these were on the old parent branch (and have already been rebased as part of the new parent). I need you to tell me which commits are YOUR work on this child branch."
4. Ask the user to identify their commits (by hash, range, or count from the top).
5. Once confirmed, set `OLD_PARENT` to `<child>~N` where N is the number of unique commits.
### Phase 4: Report New Parent State
After rebase (or after identifying OLD_PARENT):
```bash
git log --oneline <target>..<parent> # new parent commits
```
Show: "After rebase, `<parent>` has N commits on top of `<target>`."
### Phase 5: Cascade Child Branches
For EACH child branch:
1. **Show what will happen**:
```bash
# These are the commits unique to this child (will be replayed)
git log --oneline $OLD_PARENT..<child>
```
Display: "Branch `<child>` has N unique commits that will be replayed onto new `<parent>`:"
Then list each commit (hash + message).
2. **Ask confirmation** via AskUserQuestion: "Rebase `<child>` onto new `<parent>`? (commits listed above)"
3. Execute:
```bash
git rebase --onto <parent> $OLD_PARENT <child>
```
4. **Report result**:
```bash
git log --oneline <parent>..<child>
```
Show the new commit list for verification.
5. If conflicts occur, **stop and guide the user** through resolution.
### Phase 6: Final Report
After all branches are rebased, show a complete summary:
```
Cascade rebase complete!
master
└── feat/main (15 commits)
├── feat/small-1 (3 commits)
└── feat/small-2 (5 commits)
All branches verified. No orphaned commits.
```
## Critical Rules
- **NEVER force-push** without explicit user request — this skill only does local rebases
- **ALWAYS show commits** before and after each rebase step
- **ALWAYS ask confirmation** before every `git rebase` command
- **STOP on conflicts** — guide the user, don't auto-resolve
- **Use `git rebase --onto`** for child branches — never plain `git rebase`
- Determine `OLD_PARENT` using tiered fallback: reflog → `git cherry` → interactive commit selection (see Phase 3)
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.