Skip to content
git

Squash Prep

Clean up branch commits before merging — squash WIPs, rewrite messages, reorder logical units.

/squash-prep

Install this skill

  1. 1. Copy the SKILL.md content (button above)
  2. 2. Create a folder for the skill:
    # Mac/Linux
    mkdir -p ~/.claude/skills/squash-prep
    
    # Windows (PowerShell)
    mkdir $env:USERPROFILE\.claude\skills\squash-prep
  3. 3. Save the content as ~/.claude/skills/squash-prep/SKILL.md
  4. 4. Restart Claude Code (or open a new session)
  5. 5. Type /squash-prep to invoke it
rebasesquashhistory

/squash-prep

Make your branch history presentable before opening (or merging) the PR.

Usage

/squash-prep # since branch diverged from main /squash-prep --base develop # different base branch /squash-prep --interactive # show plan, ask for tweaks

What it does

  1. Lists all commits on the branch since divergence from base
  2. Identifies "noise":
    • WIP / fixup / temp commits
    • "Address review feedback" 1-line commits
    • Multiple commits touching the same file with no logical separation
  3. Proposes a squash plan:
    • Which commits merge into which
    • Final commit messages (rewritten in conventional commit style)
  4. Executes via git rebase -i (non-interactive, with prepared todo list)

Final commit message format

<type>(<scope>): <subject> <body — what + why, not how> <footer — references like Fixes #123>

Rules

  • Don't squash if commits are already on a remote shared by others — warn instead
  • Always make a backup branch first: git branch backup/<branch>-presquash
  • Preserve attribution (Co-Authored-By footers)
  • Don't change history if any commit is signed by a different author without permission
Squash Prep | MCPFlix