rebase-stack

Rebase stacked branches onto an updated base using git rebase --onto.

1|Updated May 12, 2018
One-click install
npx skills add https://github.com/tbroadley/dotfiles --skill rebase-stack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rebase-stack
Source: https://github.com/tbroadley/dotfiles/tree/main/claude/skills/rebase-stack
Command: npx skills add https://github.com/tbroadley/dotfiles --skill rebase-stack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rebase-stack enables teams to keep a clean, linear history when working with stacked branches by rebasing Branch B onto an updated base (Branch A or main) so that changes from the base integrate smoothly.

Core Features & Use Cases

  • Base updates integration: Rebase Branch B onto Branch A when A has new commits to incorporate them without merging.
  • Conflict-aware rebasing: Guides you through resolving conflicts and applying only unique changes from Branch B.
  • History hygiene: Reduces merge noise by producing a linear commit history suitable for PR reviews.

Quick Start

From Branch B, rebase onto the latest base: git fetch origin git rebase --onto origin/branch-a $(git merge-base HEAD origin/branch-a) HEAD If conflicts occur, resolve them, then continue: git add <files> git rebase --continue git push --force-with-lease origin HEAD

Frequently Asked Questions about rebase-stack

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I rebase a stacked branch onto an updated base branch?

To rebase a stacked branch, fetch the latest base and run git rebase --onto with the target base, the merge-base, and your HEAD to transplant commits cleanly without merging.

What is the best way to resolve conflicts when rebasing stacked diffs?

When rebasing stacked diffs causes conflicts, resolve them in your files, stage the changes with git add, and run git rebase --continue to proceed or git rebase --skip to drop commits.

How do I push a rebased stacked branch without overwriting remote changes?

Push a rebased stacked branch safely by using git push --force-with-lease, which updates the remote history only if no new upstream commits have arrived since your last fetch.

When should I use git rebase --onto for branch management?

Use git rebase --onto when your base branch receives new commits or is merged, allowing a dependent stacked branch to integrate or discard base changes while maintaining a linear history.

Why does rebasing stacked branches preserve a cleaner history than merging?

Rebasing stacked branches preserves a cleaner history by transplanting commits onto a new base, eliminating merge commit noise and producing a linear sequence suitable for PR reviews.