git-squash
Skill96 starsChanged 2 months agoMITView on GitHub
Squash a feature branch into one commit via soft reset to the merge base, ready for a clean PR.
- Deletes or force-pushes
- Commits and pushes
2 other projects use a version of this.
Adopted by
Most recently taken up by
- mjun0812/skillstheir own version, first seen Aug 25, 2026
- alainbrown/skillstheir own version, first seen May 28, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- alainbrown/skills★ 1same name
- mjun0812/skills★ 1same 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 repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- toolkit/AGENTS.mdAGENTS.md
- agents-brainSkill
- agents-docsSkill
- agents-introspectionSkill
- ai-pruneSkill
- autoresearchSkill
- brainstormSkill
- chromium-browserSkill
- claude-handoffSkill
- cli-castSkill
- cli-coingeckoSkill
- cli-ghSkill
- cli-justSkill
- codebase-designSkill
- code-polishSkill
- codex-handoffSkill
- commitSkill
- copy-transcript-pathSkill
- effect-tsSkill
- evm-atlasSkill
- fresh-eyes-sweepSkill
- frontend-designSkill
- grill-meSkill
- html-debriefSkill
- html-playgroundSkill
- interview-meSkill
- large-file-refactorSkill
- naming-refactorSkill
- node-deps-bumperSkill
- pdfSkill
- release-bumperSkill
- repo-cross-pollinationSkill
- repo-harmonizationSkill
- repo-renameSkill
- skill-doctorSkill
- skill-harmonizationSkill
- skill-mapSkill
- skill-writingSkill
- spreadsheetsSkill
- tailwind-cssSkill
- task-handoffSkill
- todo-archiveSkill
- tool-finderSkill
- vitestSkill
- wrap-upSkill
- yeetSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
If these instructions are already present in the conversation from a slash or dollar invocation, follow them directly.
- Very specific: line 47
Use --subject exactly when supplied.
- Distinctive: line 55
Keep the subject imperative, specific, and without a trailing period.
- Distinctive: line 60
Write the final message to a scratch file outside the repository.
- Distinctive: line 73
If any operation fails after mutation but before the replacement commit completes, the helper restores the original HEAD and exact index.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Git Squash
If these instructions are already present in the conversation from a slash or dollar invocation, follow them directly; do not invoke this skill again through a skill tool.
Squash the current feature branch into one commit representing its net change relative to the resolved default branch.
Arguments
--subject <line>: require this exact first line in the replacement commit message.--base <branch>: override default-branch detection.
Without --subject, the agent writes a subject from the surviving net diff in the repository's message format. Without
--base, the helper resolves origin/HEAD, then local/remote main, master, or trunk.
Plan Interface
Resolve the helper from this SKILL.md. Write its JSON to a scratch path outside the repository so preflight remains
clean:
uv run "<skill-dir>/scripts/git-squash.py" plan \
[--cwd <repo>] [--base <branch>] [--subject <line>] > <plan.json>plan is read-only. It verifies the Git worktree, attached branch, clean tree/index, resolved base, non-default current
branch, merge base, positive ahead count, and remote facts. It returns schemaVersion: 1, the immutable original HEAD,
merge base, base ref, commits in chronological order, unique authors, tree/remote state, and rollback facts. A failed
precondition exits without changing history.
Show the branch, base ref, merge base, commits replaced, tree state, remote state, and rollback HEAD in a compact plain table before mutation.
Agent-Owned Commit Message
Inspect the plan's commits and the net diff from mergeBase..originalHead. The net diff is authoritative; intermediate
commits supply intent and attribution only. Inspect targeted hunks when the summary is ambiguous.
Use --subject exactly when supplied. Otherwise read format under [message] in <git-root>/.agents/commit.toml;
its value is natural or conventional, and an absent file or key means conventional.
natural: write a natural-language imperative subject with no type prefix, such asAdd retry to webhook delivery.conventional: choose the type from the surviving outcome:feat,fix,refactor,docs,test,build,ci,chore(deps),style,perf,revert,ai, orchore. Do not call the changechoremerely because it is a squash. Keep the subject lowercase after the prefix.
Keep the subject imperative, specific, and without a trailing period. Add at most five body bullets for distinct
surviving outcomes; omit the body when the subject is sufficient. Do not dump paths or statistics. Append one
Co-authored-by: Name <email> trailer for each plan author other than the current Git user. The agent owns all semantic
wording and must ensure every statement is supported by the net diff.
Write the final message to a scratch file outside the repository.
Apply Interface
uv run "<skill-dir>/scripts/git-squash.py" apply \
--plan <plan.json> --message-file <message.txt>apply binds the rewrite to the plan's original HEAD, branch, merge base, base ref, clean state, rollback index, and
optional subject. It revalidates them immediately before mutation; a stale plan fails without changing history. It
soft-resets to the merge base, verifies the staged net diff is non-empty, and commits from the message file.
If any operation fails after mutation but before the replacement commit completes, the helper restores the original HEAD and exact index. It leaves working-tree files untouched. Do not reproduce the reset/rollback sequence manually or continue after a helper failure without inspecting its diagnostic and current Git state.
Report
On success, report the plan's replaced count, resolved base ref, new hash, and subject. If the branch exists on origin,
state the exact next action git push --force-with-lease; do not run it unless explicitly requested.
Lead with ### ✅ Squashed — <old count> commits → 1. Keep preflight facts, hashes, commands, errors, and rollback
wording plain and exact.
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.

