
git-squash
Squash a feature branch into one commit via soft reset to the merge base, ready for a clean PR.
- Installs
- 235
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/paulrberg/agent-skills --skill git-squash- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads git-squash automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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.
FAQ
What does the git-squash skill do?
Squash a feature branch into one commit via soft reset to the merge base, ready for a clean PR.
How do I install git-squash?
Run npx skills add https://github.com/paulrberg/agent-skills --skill git-squash in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/git-squash/ (personal) or .claude/skills/git-squash/ (project).
Which AI agents can use git-squash?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is git-squash safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains git-squash?
It is published by paulrberg in paulrberg/agent-skills. It has 235 recorded installs.
More from paulrberg/agent-skills
effect-ts
paulrberg/agent-skills
Use for nontrivial Effect 4 work including services/layers, typed errors, Schema/JsonSchema, Config, runtime/concurrency, @effect/vitest, effect/ai and @effect/ai-, effect/sql and @effect/sql-, Effect Atom (@effect/atom-), or @prb/effect-next.
tailwind-css
paulrberg/agent-skills
Use for Tailwind v4 styling: add/fix classes, configure or migrate Tailwind, use tailwind-variants, or tw-animate-css.
cli-gh
paulrberg/agent-skills
Use for GitHub CLI automation: repository reads, workflow runs, search, codespaces, releases, configuration, or gh command syntax. Use yeet for contribution writes to PRs, issues, comments, or discussions.
code-polish
paulrberg/agent-skills
Polish changed code when the user explicitly asks, or when an active workflow requests post-implementation simplification and risk-profiled review over a fixed file scope.
yeet
paulrberg/agent-skills
Use for GitHub PR/issue/discussion workflows: create/update PRs, issues, or discussions and post issue or discussion comments; triggers include yeet.
bump-release
paulrberg/agent-skills
Cut a release: bump versions, write changelogs, commit, tag.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.