rebase

Rebase local changes on top of remote branch updates

9 stars

Best use case

rebase is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Rebase local changes on top of remote branch updates

Teams using rebase should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/rebase/SKILL.md --create-dirs "https://raw.githubusercontent.com/jpoutrin/product-forge/main/plugins/git-workflow/skills/rebase/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/rebase/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How rebase Compares

Feature / AgentrebaseStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Rebase local changes on top of remote branch updates

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# rebase

**Category**: Development

## Usage

```bash
rebase [--interactive]
```

## Arguments

- `--interactive`: Use interactive rebase for more control over commits (optional)

## Description

Rebases your local commits on top of the latest remote changes for your active branch. This is useful when your colleague has pushed changes to the same branch and you want to incorporate them while keeping your commits on top.

## Execution Method

This command delegates to the `rebase-expert` agent (Haiku model) for fast execution.

**Delegation**: Use the Task tool with:
- `subagent_type`: `"git-workflow:rebase-expert"`
- `prompt`: Include the interactive flag if specified and current working directory

Example:
```
Task(subagent_type="git-workflow:rebase-expert", prompt="Run rebase in /path/to/repo")
```

---

## Execution Instructions for Claude Code

When this command is run, Claude Code should:

1. **Verify Git State**
   - Check that we're in a git repository
   - Confirm the current branch is tracking a remote branch
   - Verify there are no uncommitted changes (offer to stash if needed)

2. **Fetch Latest Remote Changes**
   - Run `git fetch origin` to get the latest remote changes
   - Identify the tracking branch (e.g., `origin/main`)

3. **Check for Conflicts**
   - Run `git rebase --dry-run origin/<branch>` to detect potential conflicts
   - Warn user if conflicts are likely

4. **Execute Rebase**
   - Run `git rebase origin/<branch>` (or `git rebase -i` for interactive mode)
   - Monitor for conflicts during rebase
   - Provide guidance if conflicts occur

5. **Handle Conflicts (if any)**
   - Display conflicted files
   - Guide user through resolution
   - Verify rebase completion

6. **Confirm Success**
   - Show final commit log with new positions
   - Display summary of rebased commits

## Interactive Flow

### Step 1: Verify State

```
🔍 Checking repository state...

Current branch: feature/my-feature
Tracking branch: origin/feature/my-feature
Status: Clean (no uncommitted changes)
```

### Step 2: Fetch Remote Changes

```
📡 Fetching latest remote changes...

✅ Fetched successfully
Remote branch updated: origin/feature/my-feature
```

### Step 3: Check for Conflicts

```
🔎 Checking for potential conflicts...

✅ No conflicts expected
Your commits can be cleanly rebased on top of the remote changes.
```

### Step 4: Execute Rebase

```
⏳ Rebasing your changes...

Rebasing 3 commits...
✅ Successfully rebased!

Your commits are now on top of the latest remote changes.
```

### Step 5: Show Results

```
📊 Rebase complete!

New commit history:
  abc1234 (HEAD -> feature/my-feature) your third commit
  def5678 your second commit
  ghi9012 your first commit
  jkl3456 (origin/feature/my-feature) colleague's latest commit

Commits rebased: 3
```

## Conflict Handling

If conflicts occur during rebase:

```
⚠️  Conflicts detected during rebase!

Conflicted files:
  M  src/auth/login.py
  M  src/config.py

You can:
1. Resolve conflicts in your editor
2. Run `git add <file>` after resolving
3. Continue with `git rebase --continue`

Or abort with: git rebase --abort
```

## Error Handling

```
❌ Not in a git repository
   Navigate to a git repository and try again.

❌ Uncommitted changes detected
   Stash or commit your changes first:
   - `git stash` to temporarily save changes
   - `git add .` and `git commit` to commit them

❌ Current branch is not tracking a remote
   Set up tracking with: git branch -u origin/<branch>

❌ Rebase in progress
   Complete or abort the current rebase first:
   - `git rebase --continue` to complete
   - `git rebase --abort` to cancel
```

## When to Use Rebase vs Merge

**Use rebase when:**
- You want a linear commit history
- You're working on a feature branch with colleagues pushing updates
- You want your commits to appear on top of the latest changes

**Use merge when:**
- You want to preserve the complete history of both branches
- Multiple people are working on the same branch and you want a clear merge point

Related Skills

zod

9
from jpoutrin/product-forge

Zod schema validation patterns and type inference. Auto-loads when validating schemas, parsing data, validating forms, checking types at runtime, or using z.object/z.string/z.infer in TypeScript.

typescript-import-style

9
from jpoutrin/product-forge

Merge-friendly import formatting (one-per-line, alphabetical). Auto-loads when writing TypeScript/JavaScript imports to minimize merge conflicts in parallel development. Enforces consistent grouping and sorting.

setup-mcp-auth

9
from jpoutrin/product-forge

Configure authentication for an existing FastMCP server

fastmcp

9
from jpoutrin/product-forge

FastMCP TypeScript framework patterns for MCP servers. Auto-loads when building MCP servers, creating tools/resources/prompts, implementing authentication, configuring transports, or working with FastMCP in TypeScript.

add-mcp-tool

9
from jpoutrin/product-forge

Add a new tool to an existing FastMCP server with guided configuration

add-mcp-resource

9
from jpoutrin/product-forge

Add a new resource or resource template to an existing FastMCP server

plan-with-team

9
from jpoutrin/product-forge

Validate plan file ownership

privacy-compliance

9
from jpoutrin/product-forge

GDPR, CCPA, and privacy compliance guidance for data protection. Use when handling personal data, implementing consent management, or ensuring regulatory compliance across jurisdictions.

oauth

9
from jpoutrin/product-forge

OAuth 2.0 and OpenID Connect implementation patterns. Use when implementing authentication, authorization flows, or integrating with OAuth providers like Google, GitHub, or custom identity providers.

mcp-security

9
from jpoutrin/product-forge

Use when securing MCP servers, preventing prompt injection, implementing authorization, validating user input, or building secure multi-agent pipelines. Provides 5-layer defense architecture patterns.

rag-cag-security

9
from jpoutrin/product-forge

Security patterns for RAG and CAG systems with multi-tenant isolation. Use when building retrieval-augmented or cache-augmented generation systems that require tenant isolation, access control, and secure data handling.

chunking-strategies

9
from jpoutrin/product-forge

Document chunking strategies for RAG systems. Use when implementing document processing pipelines to determine optimal chunking approaches based on document type and retrieval requirements.