# Rebase

> Rebase current branch on latest main or specified branch. Use when updating branch with upstream changes.

- Skill: `damilola-elegbede-org/rebase` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add damilola-elegbede-org/rebase`
- Raw SKILL.md: https://api.skillmd.com/api/skills/damilola-elegbede-org/rebase/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: damilola-elegbede-org (https://skillmd.com/u/damilola-elegbede-org)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/damilola-elegbede-org/rebase

---


# /rebase

## Usage

```bash
/rebase            # Rebase current branch on main (or master)
/rebase develop    # Rebase on a specific branch
/rebase --continue # Continue after resolving conflicts
/rebase --abort    # Abort and return to the pre-rebase state
```

## Description

Rebases the current branch on the latest target branch: stash uncommitted work, fast-forward the
target, rebase, restore the stash. Direct execution, no agents.

Full sequence, conflict handler, and the situation table: → `references/workflow.md`

## What matters most

- **Never rebase main/master on itself.** Check the current branch before anything else.
- **Stash includes untracked files** (`git stash push -u`) and is restored only if this run created
  it — popping someone else's stash is a data-loss bug.
- **`git pull --ff-only`** when updating the target. A merge commit created here silently changes what
  you're rebasing onto.
- **A failed `stash pop` is not a completed rebase.** Report it and stop; the changes are still in the
  stash and saying "done" loses them.
- **Conflicts get captured to `.tmp/rebase/`**, then hand back to the user with the file list. Don't
  resolve conflicts by guessing at intent.
- After a rebase, the branch's history is rewritten — subsequent push needs `--force-with-lease`.

## Expected Output

```text
User: /rebase

Stashing uncommitted changes...
Updating main...
main updated to latest
Rebasing feat/auth on main...
Rebase complete: feat/auth → main
Restoring stashed changes...

Branch Status:
a1b2c3d feat: add login handler
e4f5g6h test: cover token refresh
```

On conflict, the file list plus `.tmp/rebase/` paths and the `--continue` / `--abort` next steps.

## Related

`/branch` (new branch from updated main) · `/push` (push rebased branch) · `/pr` (open PR after)

