git-rebase

Rewrite Git commit history non-interactively using git rebase -i automation.

4|2|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/alexanderguy/skills --skill git-rebase-alexanderguy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-rebase
Source: https://github.com/alexanderguy/skills/tree/main/skills/git-rebase
Command: npx skills add https://github.com/alexanderguy/skills --skill git-rebase-alexanderguy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of messy or incorrect Git branch history by enabling safe, non-interactive rewriting of commits that are not at HEAD.

Core Features & Use Cases

  • Non-interactive interactive-rebase driving: Automatically controls git rebase -i editor invocations via GIT_SEQUENCE_EDITOR so the rebase completes without human keyboard input.
  • Common history surgery operations: Supports squashing, fixing up, dropping, splitting, rewording, and validating replayed commits with deterministic scripting patterns.
  • Safety guardrails for real-world workflows: Encourages backup branches, checks for zombie/paused rebases, and advises explicit diff validation to confirm content wasn’t lost.

Use Case: You discover an earlier commit message is misleading and that a feature was bundled with unrelated changes; you rewrite that commit and split it into cleaner, reviewable commits before pushing.

Quick Start

Use the git-rebase skill to rewrite a branch’s commit history non-interactively by scripting git rebase -i so you can drop, split, and reword commits and validate the result against a pre-rebase backup.

Frequently Asked Questions about git-rebase

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

FAQPage Schema
How do I squash or drop a specific old commit in Git without interactive mode?

To squash or drop old commits non-interactively, use automated git rebase -i scripting via GIT_SEQUENCE_EDITOR. This approach drives the rebase editor deterministically without human keyboard input, allowing you to replay commits with specific squash or drop actions.

What is the safest way to rewrite Git commit history before pushing?

The safest way to rewrite Git commit history is creating backup branches before starting, using automated rebase scripting for deterministic replay, and validating diffs against the pre-rebase backup to confirm no content was lost during the rewrite.

How do I fix a misleading commit message in the middle of a branch's history?

To fix a misleading commit message mid-branch, perform a non-interactive reword operation using automated git rebase -i. By scripting GIT_EDITOR and GIT_SEQUENCE_EDITOR, you can reword specific commits deterministically without opening an interactive editor.

Can I split a commit that bundled unrelated changes into cleaner commits automatically?

Yes, splitting a bundled commit is possible through non-interactive rebase automation. The git-rebase approach supports splitting and fixups via deterministic scripting patterns, allowing you to separate unrelated changes into reviewable commits before pushing.

Why does my automated git rebase -i stop with a paused or zombie rebase error?

An automated git rebase -i stops with a paused or zombie state due to unresolved conflicts or incomplete previous operations. Safety checks can detect these zombie rebases, advising explicit diff validation and resolution before continuing the history rewrite.

Does non-interactive rebase work for pre-push cleanup without manual editor input?

Yes, non-interactive rebase works for pre-push cleanup by using GIT_SEQUENCE_EDITOR and GIT_EDITOR environment variables. This enables deterministic editor driving, allowing you to rewrite history and validate commits automatically without manual keyboard input.