Skip to content
Back to skills

Squash Commits

ASecurity

Turns a messy branch history into a few clear commits with proper messages, showing the plan before rewriting anything.

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 15, 2026
ai-agentsgit

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill squash-commits --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Squash Commits?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Squash Commits
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-squash-commits-ai-agent-templates/badge)](https://www.skillsdirectory.com/skills/workspace-templates-squash-commits-ai-agent-templates)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: squash-commits
description: Turns a messy branch history into a few clear commits with proper messages, showing the plan before rewriting anything.
disable-model-invocation: true
---

Squash the commits on this branch. Instructions: $ARGUMENTS (for example the base branch or "single commit").

1. Find the base: `git merge-base HEAD <base>` with the given base or the default branch. Show `git log --oneline <base>..HEAD` and `git diff --stat <base>..HEAD`.
2. If any of these commits exist on a shared remote branch that others may use, warn and ask before continuing.
3. Propose groups: related commits by files and purpose, ordered so each group builds and passes tests alone. Give each a message in the project's style (check recent `git log -n 10 --oneline`), with a body explaining why.
4. Print the plan: new commit message, commits folded into it, files.
5. Create a backup: `git branch backup/<branch>-<date>`.
6. After approval, rewrite without interactive tools: `git reset --soft <base>` then commit each group by staging its files, or a scripted `git rebase`. Verify `git diff backup/<branch>` is empty.

Report the new log and the backup name. Do not push; mention that `--force-with-lease` is required if already pushed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.