squash-and-verify

Squash messy feature branch commits into logical groups and verify lossless merges.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill squash-and-verify-chenhui-x
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: squash-and-verify
Source: https://github.com/CHENHUI-X/toolbox/tree/main/codex-skill/agents/squash-and-verify
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill squash-and-verify-chenhui-x

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long-lived feature branches that repeatedly merge upstream changes accumulate tangled histories mixing your work with everyone else's, and manual squashing risks silently dropping files, duplicating changes, or clobbering teammates' commits. ## Core Features & Use Cases - Safe Squash Workflow: Squash the net diff onto a temporary branch off the target, then re-commit changes in logical groups with explanatory messages. - Lossless Verification: Diff the squashed branch against the original feature branch and re-run builds and tests to confirm nothing was lost or altered. - Protected History Rewrite: Force-push with --force-with-lease and merge with --ff-only to prevent overwriting teammates' work or creating unexpected merge commits. - Use Case: After resolving multiple rounds of merge conflicts on a feature branch, clean up dozens of small commits into a few logical commits, verify the result matches the original tree, and fast-forward merge into master. ## Quick Start Squash my feature branch's messy commits into clean logical commits, verify nothing was lost, and merge it into master.

Frequently Asked Questions about squash-and-verify

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

FAQPage Schema
How do I squash commits on a feature branch before merging?▼

Create a temporary branch off the target branch, run git merge --squash with the feature branch, then re-commit the changes in logical groups. Verify the result with git diff against the original branch before force-pushing.

How to verify a git squash didn't lose any changes?▼

Run git diff between the original feature branch and the squashed branch; the output must be empty. Then re-run the project's build and test suite on the squashed branch and confirm the pass count matches the pre-squash state.

Why use --force-with-lease instead of git push --force?▼

--force-with-lease refuses to push if the remote branch has moved since your last fetch, preventing you from silently overwriting commits a teammate pushed while you were squashing. A bare --force overwrites the remote unconditionally.

Why does git merge --ff-only fail after squashing?▼

It fails when the target branch is no longer an ancestor of the feature branch, meaning the target received new commits after your initial ancestor check. Re-fetch the target, re-check ancestry, and re-absorb upstream changes before merging.

When should I not squash a feature branch?▼

Avoid squashing when the feature branch has not yet merged the latest target branch, since the squash would bake in a diff against a stale base. Also avoid it when teammates have unmerged work on the same branch that a force-push would discard.