squash
Skill2 starsChanged 4 months agoMITView on GitHub
Clean up a branch's commit history before merge — squash WIP/fixup commits into logical units and rewrite messages — safely, without losing work. Use when the user says "squash my commits", "clean up the history", "combine these commits", "tidy the branch before merging", "squash the fixups", or "rewrite the commit history".
- Deletes or force-pushes
- Commits and pushes
3 other projects use a version of this.
Adopted by
Most recently taken up by
- aymericbeaumet/dotfilestheir own version, first seen Sep 7, 2026
- TrimVis/skillstheir own version, first seen Aug 14, 2026
- TashanGKD/cc_pluginstheir own version, first seen Jan 13, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- aymericbeaumet/dotfiles★ 22same name
- TashanGKD/cc_plugins★ 4same name
- TrimVis/skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- a11ySkill
- api-docsSkill
- audit-logSkill
- benchmarkSkill
- bisectSkill
- cacheSkill
- changelogSkill
- cherry-pickSkill
- ci-setupSkill
- codeownersSkill
- commit-messageSkill
- connection-poolSkill
- contributingSkill
- coverageSkill
- db-migrateSkill
- dead-codeSkill
- debugSkill
- depsSkill
- diagramSkill
- dockerizeSkill
- docstringSkill
- e2eSkill
- env-exampleSkill
- error-handlingSkill
- explainSkill
- feature-flagSkill
- flaky-testSkill
- gitignoreSkill
- graceful-shutdownSkill
- graphqlSkill
- healthcheckSkill
- i18nSkill
- idempotencySkill
- licenseSkill
- lint-fixSkill
- loggingSkill
- migrateSkill
- mockSkill
- onboardSkill
- optimizeSkill
- paginationSkill
- pr-descriptionSkill
- pre-commitSkill
- profileSkill
- prune-branchesSkill
- rate-limitSkill
- readmeSkill
- rebaseSkill
- refactorSkill
- regexSkill
- releaseSkill
- resolve-conflictsSkill
- retrySkill
- review-diffSkill
- scaffoldSkill
- secrets-scanSkill
- security-headersSkill
- seedSkill
- soft-deleteSkill
- sqlSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Require a clean working tree: If there are uncommitted changes, stop and tell the user to commit or stash first — a rewrite with a dirty …
- Very specific: line 34
Verify nothing was lost: after rewriting, confirm git diff <base>..HEAD is identical to before (same tree), and the test suite still passes.
- Distinctive: line 39
Never rewrite history with a dirty tree or without a recoverable backup (reflog/backup branch).
- Very specific: line 41
Use --force-with-lease, never a bare --force, when a push is needed — and only after the user confirms.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Branch state
!git status --short 2>/dev/null
!git log --oneline --no-merges "$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)"..HEAD 2>/dev/null | head -30
!git branch --show-current 2>/dev/null
Instructions
Tidy the current branch's commits onto its base ($ARGUMENTS if given, else main/master) so the history that merges is clean and logical. History rewriting is destructive — be careful and confirm before rewriting.
Before touching history
- Require a clean working tree. If there are uncommitted changes, stop and tell the user to commit or stash first — a rewrite with a dirty tree risks losing work.
- Confirm the branch isn't shared, or that collaborators know. Rewriting commits others have pulled forces a
--force-pushthat rewrites their view. If the branch is already pushed, note that a force-push (--force-with-lease) will be needed and confirm that's acceptable. - Make a safety net: record the current tip (
git rev-parse HEAD) or suggest a backup ref (git branch backup/<name>) so the pre-squash state is recoverable via reflog if anything goes wrong. - Identify the base with
git merge-baseand review the commits above. Propose how to group them into logical units (e.g. squash allfixup/wip/address reviewcommits into the feature commit they belong to) before doing anything.
Squashing
- Prefer the safest mechanism that fits:
- Whole branch into one commit:
git reset --soft <base>then a singlegit commit— simple and avoids interactive rebase. - Selective grouping: a non-interactive autosquash (
git rebase --autosquash) when commits were made with--fixup, or scripted reword — interactive-irebase isn't available in this environment, so drive it with explicit commands.
- Whole branch into one commit:
- Write clear messages for the resulting commits (Conventional Commits if the repo uses them — see the
commit-messageskill). One commit per logical change, each message explaining the why. - Verify nothing was lost: after rewriting, confirm
git diff <base>..HEADis identical to before (same tree), and the test suite still passes. The content must be unchanged — only the history shape changes. - Don't push automatically. Show the resulting
git log --onelineand the exactgit push --force-with-leasecommand, and let the user run it.
Rules
- Never rewrite history with a dirty tree or without a recoverable backup (reflog/backup branch). State the recovery path.
- The final tree must be byte-identical to before squashing — verify with a diff. Squashing changes history, never content.
- Use
--force-with-lease, never a bare--force, when a push is needed — and only after the user confirms. Don't push on their behalf unless asked. - Be cautious on shared branches: call out who is affected before any rewrite.
- End with the new history, confirmation the diff is unchanged and tests pass, and the push command the user can run.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

