rebase

Rebase the current git branch onto a target branch with guided conflict resolution.

2|Updated Oct 16, 2021
One-click install
npx skills add https://github.com/pattobrien/dotfiles --skill rebase-pattobrien
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rebase
Source: https://github.com/pattobrien/dotfiles/tree/main/claude/skills/rebase
Command: npx skills add https://github.com/pattobrien/dotfiles --skill rebase-pattobrien

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rebasing a branch onto main or another target often involves repetitive fetch commands and stressful merge conflicts where it is easy to accidentally discard changes from either side. This Skill automates the rebase workflow and enforces a careful, history-aware conflict resolution process. ## Core Features & Use Cases - Flexible Target Parsing: Rebase onto local main by default, a remote branch like origin/develop with automatic fetching, or any named local branch. - Automated Fetch and Rebase: Runs git fetch for remote targets and executes git rebase against the resolved target branch. - Informed Conflict Resolution: Inspects recent changes to each conflicting file on the target branch with git log before resolving, preserving changes from both branches. - Use Case: You have a feature branch that has drifted behind origin/main. Invoke the Skill with "origin" to fetch and rebase, and when conflicts appear it reviews what changed upstream in each file before merging both sets of changes. ## Quick Start Ask the assistant to rebase the current branch onto origin/main and resolve any conflicts while preserving changes from both branches.

Frequently Asked Questions about rebase

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

FAQPage Schema
How do I rebase my current branch onto main in git?▼

Run git rebase main to replay your branch's commits on top of local main. This Skill automates that command and, when given no arguments, defaults to rebasing onto the local main branch.

How to rebase onto a remote branch like origin/develop?▼

Fetch the remote first with git fetch origin, then run git rebase origin/develop. The Skill detects arguments containing a slash, splits them into remote and branch, fetches automatically, and rebases onto the remote target.

How do I resolve git rebase conflicts without losing changes?▼

Before resolving, inspect what changed in each conflicting file on the target branch using git log -p -n 3 <target> -- <file>. Then edit the file to preserve both sets of changes, stage it, and run git rebase --continue.

What happens when a rebase conflict is too complex to resolve?▼

When a conflict is too complex or unclear, the Skill pauses and asks for guidance before proceeding rather than guessing. This prevents accidentally discarding work from either branch during resolution.

When should I not use git rebase on a branch?▼

Avoid rebasing branches that have already been pushed and shared with others, since rebasing rewrites commit history and forces collaborators to reconcile diverged histories. Use merge instead for shared public branches.