rebase-on-main

Rebase a feature branch onto the mainline with backup and force-with-lease.

2|Updated Jun 19, 2026
One-click install
npx skills add https://github.com/andrewthetechie/andrew-skills --skill rebase-on-main
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rebase-on-main
Source: https://github.com/andrewthetechie/andrew-skills/tree/main/rebase-on-main
Command: npx skills add https://github.com/andrewthetechie/andrew-skills --skill rebase-on-main

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps you safely move a feature branch onto the latest mainline branch without losing work, introducing accidental regressions, or rewriting history unsafely.

Core Features & Use Cases

  • Safe Rebase Workflow: Creates a backup before rewriting history and refuses risky operations on detached, shared, or protected branches.
  • Conflict Analysis and Resolution: Explains rebase conflicts, inspects markers, and guides intentional merges that preserve both mainline fixes and feature intent.
  • Validation and Push Guardrails: Runs merge validation checks, recommends project-specific tests, and pushes only with force-with-lease.
  • Use Case: A developer finishes a feature branch and needs to rebase it onto the latest origin/main, resolve a few conflicts, validate the result, and push it back safely.

Quick Start

Ask the skill to rebase my current branch onto the repository's main branch, resolve any conflicts safely, run validation, and force-push with lease if everything passes.

Frequently Asked Questions about rebase-on-main

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

FAQPage Schema
How do I rebase a feature branch onto main without losing work?

Safe rebase workflows create a backup before rewriting history and refuse risky operations on detached, shared, or protected branches to prevent losing work during branch synchronization.

How do I resolve rebase conflicts and preserve both mainline fixes and feature intent?

Conflict resolution during a rebase involves inspecting conflict markers, analyzing the differences, and guiding intentional merges that preserve both mainline fixes and your original feature intent.

What is the best way to force-push a rebased branch back to origin safely?

The safest way to force-push a rebased branch is using force-with-lease, which acts as a guardrail by running validation checks and recommended tests before publishing the rewritten history.

Can I use rebase to sync a feature branch with the latest origin/main?

Yes, you can use rebase to sync a feature branch onto the latest origin/main, which replays your commits onto the mainline while applying branch detection and merge validation before pushing.

When should I avoid rebasing my git branch?

You should avoid rebasing shared, protected, or detached branches, as the workflow refuses risky operations on these to prevent unsafe history rewrites and accidental regressions.

What validation checks do I need to run after a git rebase?

After a git rebase, you need to run merge validation checks and project-specific tests to ensure the replayed commits do not introduce regressions before you force-with-lease push.