squash

squash is a command for Claude Code from bengous/claude-code-plugins. It costs 12 tokens per session (693 once invoked), scanned A, original, MIT.

A Git command for combining several commits into fewer commits without opening a text editor. It can select commits by text pattern, commit hash, or a simple range.

In plain words
What is it for?
It helps squash matching or selected commits, combine the last number of commits, preview the result, and continue without using Vim.
Why use it?
It reduces a noisy series of commits while showing a preview and allowing confirmation first. An optional backup branch and dry-run mode provide safer review before rewriting history.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Part of the git-tools plugin — 6 skills, 2 commands shipped together

Good fit It helps squash matching or selected commits, combine the last number of commits, preview the result, and continue without using Vim.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/bengous/claude-code-plugins/squash
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/bengous/claude-code-plugins

Made for: Claude Code.

Or install git-tools, the plugin that ships this one along with the rest of its 6 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for squash

README.md
[![agentmods](https://agentmods.dev/badge/commands/bengous/claude-code-plugins/squash/github.svg)](https://agentmods.dev/commands/bengous/claude-code-plugins/squash)
Your own site
<a href="https://agentmods.dev/commands/bengous/claude-code-plugins/squash"><img src="https://agentmods.dev/badge/commands/bengous/claude-code-plugins/squash/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for squash

Your own site · 80×15
<a href="https://agentmods.dev/commands/bengous/claude-code-plugins/squash"><img src="https://agentmods.dev/badge/commands/bengous/claude-code-plugins/squash.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 693 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00012 $0.00693
Opus 5 $0.00006 $0.00347
Sonnet 5 $0.00002 $0.00139
Haiku 4.5 $0.00001 $0.00069

Measured 6d ago against content hash d0bf521aa5c7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

squash scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

git-tools/commands/squash.md · 101 lines

How it starts

The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Git Squash (No Editor)

Squash git commits interactively without vim. Supports pattern matching, specific hashes, or simple ranges.

Arguments

$ARGUMENTS

Usage Examples

# Squash all commits matching a pattern (e.g., "shellcheck", "fix:", "WIP")
/squash --pattern "shellcheck"

# Squash specific commits by hash
/squash --hashes "abc123,def456,ghi789"

# Squash last N commits (simple case, all contiguous)
/squash --range 5

# Add --backup to create backup branch automatically
/squash --pattern "refactor" --backup

# Dry run to preview (no changes)
/squash --pattern "test" --dry-run

How It Works

  1. Analyze commits and identify targets to squash
  2. Show preview of what will be squashed
  3. Ask for confirmation using AskUserQuestion
  4. (Optional) Create backup branch
  5. Execute rebase using GIT_SEQUENCE_EDITOR (no vim!)

Mode Details

Pattern mode:

  • Pattern matching is case-insensitive
  • First matching commit becomes the base (keep)
  • All subsequent matching commits are squashed into it
  • Non-matching commits in between are preserved

Hashes mode:

  • First hash is the base (keep)
  • Remaining hashes are squashed into first
  • Order matters!

Range mode:

  • Simple git reset --soft HEAD~N + new commit
  • All N commits must be contiguous at HEAD
  • Fast and safe for simple cases

Requirements

  • Clean working directory (no uncommitted changes)
  • Must be on a branch (not detached HEAD)

Implementation

Parse the arguments and execute the appropriate strategy:

For --range N:

# Create backup if requested
git branch backup-$(date +%s) HEAD

# Soft reset and recommit
git reset --soft HEAD~N
git commit -m "Squashed N commits"

For --pattern or --hashes:

# 1. List commits to find matches
git log --oneline HEAD~50..HEAD

# 2. Find the base commit (oldest matching)
# 3. Generate a sed script that changes "pick" to "squash" for target commits
# 4. Execute: GIT_SEQUENCE_EDITOR="sed -i '<script>'" git rebase -i <base>^

Read the full file on GitHub · 101 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 101 lines · 12 tokens per session scan A d0bf521aa5c7

Subscribe to this mod's changes

squash is a command published in the GitHub repository bengous/claude-code-plugins (4 stars, last pushed 4d ago), licensed MIT. It adds 12 tokens to every session and 693 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.