/git:squash --pattern <regex> | --hashes <h1,h2,...> | --range <N> [--dry-run]from git
Squashes git commits by pattern, hash list, or last N commits without opening an editor. Handles rebase planning, target validation, and message composition.
Ships in git. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Fold a run of commits into one. The rebase backend of this plugin does the rewrite: it builds the todo, sets the editors inside its own process, creates a timestamped backup branch, re-checks the plan against the branch, and leaves a conflict resumable. This skill only chooses which commits fold.
$ARGUMENTS
| Mode | Selection |
|---|---|
--range N | the last N commits, folded into the oldest |
--hashes h1,h2,... | the listed commits, folded into the oldest of them |
--pattern <regex> | every commit whose subject matches, case-insensitive, folded into the oldest match |
--dry-run | validate and print the plan, rewrite nothing |
Range. --range N: the range is N. Otherwise the range is the branch:
origin/dev when it exists, else the remote default branch
(git rev-parse --abbrev-ref origin/HEAD). No remote at all, or on that
branch itself: ask how far back to look, and use N.
run `"${CLAUDE_PLUGIN_ROOT}/scripts/rebase.ts" plan {range}`
On ok: false, report error and detail and stop: dirty-worktree
lists the files to commit or stash first, rebase-already-in-progress
points at /git:rebase continue|skip|abort.
Targets. From plan.commits, oldest first: the commits whose hash
starts with a listed hash, or whose subject matches the pattern. Fewer
than two targets: say so and stop. A listed hash outside the range: name
it and stop.
The targets must be consecutive. The backend folds a squash into the
commit right above it, never across a kept commit: with fixA, other, fixB the second fix would fold into other. Non-consecutive targets:
list the commits sitting between them and stop; /git:rebase on the
range is the tool for that case.
Message. Read each target with git log -1 --format=%B <hash> and
compose one message for the combined commit: a subject in the convention
of git log --oneline -10, then the bodies that still hold. Print it.
Steps. One step per commit of the range, in the order of
plan.commits:
pick every commit outside the targets, message null
pick the oldest target, message null
squash every later target; message null, except the LAST one,
which carries the combined message
Apply.
run `printf '%s' '{"base": "{plan.base}", "steps": {steps_json}}' \
| "${CLAUDE_PLUGIN_ROOT}/scripts/rebase.ts" apply [--dry-run]`
With --dry-run in $ARGUMENTS, pass it through: print plan_text and
stop. Without it, the backend rewrites and reports. On ok: true: the
new tip, result.commits commits on the branch, and backup_ref, with
git branch -D {backup_ref} as the way to drop it once the history looks
right.
On ok: false: plan-stale means the branch moved, start over at step 1;
conflict pauses the rebase, print every line of guidance and stop, the
user resolves and runs /git:rebase continue; exec-failed means the
message was not applied, offer /git:rebase abort, never continue. Any
other error: report error and detail; backup_ref, when set, restores
the branch with git reset --hard.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bengous/claude-code-plugins --plugin git4 skills in this plugin
/commitCommit the current work with a message that follows the repo's convention, closing the branch's issue when its name carries a number. Use when the user asks to commit, to record the work, or to save a change to history./gpg-sign-historyGPG-sign the unsigned commits of the current branch behind a backup branch, keeping every tree, author and date, and checking each new commit against the one it replaces./rebaseInteractive rebase of the current branch with a visual plan and reworked commit messages, no editor. Use when the user asks to rebase, rewrite, reorder, reword, or clean up commits, or to continue, skip, or abort a paused rebase.Other plugins' skills for the same job