Skip to content
Back to skills

Squash

ASecurity

Squash a feature branch into one clean commit before merging

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsgogit

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill squash --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Squash?

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

Security grade badge for Squash
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-squash/badge)](https://www.skillsdirectory.com/skills/black141312-squash)

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
description: Squash a feature branch into one clean commit before merging
category: git
---

# Squash

Reach for this when a feature branch has many WIP/fixup commits and you want a single, well-described commit on the main history before merge.

1. Update the base so the squash sits on current code: `git fetch origin` then `git rebase origin/main` (resolve conflicts if any).
2. Count the commits to combine: `git log --oneline origin/main..HEAD`.
3. Squash interactively: `git rebase -i origin/main`, keep the first as `pick`, change the rest to `squash` (keeps their messages) or `fixup` (discards them).
4. Write one clear commit message in the editor that summarizes the whole change — subject line plus a body explaining the "why".
5. Alternatively, for a no-rebase squash: `git reset --soft origin/main` then a single `git commit` — collapses all changes into one staged commit.
6. Verify the tree is unchanged (`git diff origin/main` should match the branch's net effect) and tests pass, then `git push --force-with-lease`.
7. Or skip local squashing entirely and use GitHub's "Squash and merge" button if the repo enables it.

## Rules
- Squash only commits unique to your branch; never squash across commits others have based work on.
- Force-push the rewritten branch with `--force-with-lease`, never plain `--force`.
- Preserve the meaningful detail in the final message — don't reduce a real change to "fix stuff".
- `git reset --soft origin/main` is the simplest path when you just want everything as one commit and don't need to reorder.
- If the platform offers squash-merge, prefer it for shared branches so local history stays untouched.

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.

Comments

Loading comments…