/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
- Lists all commits on the branch since divergence from base
- Identifies "noise":
- WIP / fixup / temp commits
- "Address review feedback" 1-line commits
- Multiple commits touching the same file with no logical separation
- Proposes a squash plan:
- Which commits merge into which
- Final commit messages (rewritten in conventional commit style)
- 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