raine

rebase

by @raine in Tools
0
0
# Install this skill:
npx skills add raine/skills --skill "rebase"

Install specific skill from multi-skill repository

# Description

Rebase the current branch.

# SKILL.md


name: rebase
description: Rebase the current branch.
allowed-tools: Bash


Rebase the current branch.

Arguments: $ARGUMENTS

Behavior:

  • No arguments: rebase on local main
  • "origin": fetch origin, rebase on origin/main
  • "origin/branch": fetch origin, rebase on origin/branch
  • "branch": rebase on local branch

Steps:

  1. Check for uncommitted changes:
  2. Run git status --porcelain
  3. If there are changes, run git stash push -m "rebase-temp"
  4. Remember to pop the stash after rebase completes
  5. Parse arguments:
  6. No args → target is "main", no fetch
  7. Contains "/" (e.g., "origin/develop") → split into remote and branch, fetch
    remote, target is remote/branch
  8. Just "origin" → fetch origin, target is "origin/main"
  9. Anything else → target is that branch name, no fetch
  10. If fetching, run: git fetch <remote>
  11. Run: git rebase <target>
  12. If conflicts occur, handle them carefully (see below)
  13. Continue until rebase is complete
  14. If changes were stashed in step 1, run git stash pop

Handling conflicts:

  • BEFORE resolving any conflict, understand what changes were made to each
    conflicting file in the target branch
  • For each conflicting file, run git log -p -n 3 <target> -- <file> to see
    recent changes to that file in the target branch
  • The goal is to preserve BOTH the changes from the target branch AND our
    branch's changes
  • After resolving each conflict, stage the file and continue with
    git rebase --continue
  • If a conflict is too complex or unclear, ask for guidance before proceeding

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.