git-smart-squash

Squash a range of git commits into one commit with a rewritten message after dry-run confirmation.

7|Updated May 13, 2026
One-click install
npx skills add https://github.com/DawnMoon1542/agents-skills --skill git-smart-squash-dawnmoon1542
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-smart-squash
Source: https://github.com/DawnMoon1542/agents-skills/tree/main/git-smart-squash
Command: npx skills add https://github.com/DawnMoon1542/agents-skills --skill git-smart-squash-dawnmoon1542

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long feature branches often accumulate many small, noisy commits that clutter history. This Skill merges a specified range of commits into a single clean commit with a well-structured message, while protecting you through a mandatory dry-run preview and explicit confirmation before any history is rewritten. ## Core Features & Use Cases - Flexible Range Selection: Squash commits between two user-provided hashes, or automatically collect only the commits created during the current conversation. - Dry-Run Preview: Shows the commits to be merged, aggregated diff statistics, and the generated commit message before any write operation occurs. - Safe History Rewriting: Uses git reset --soft when the range ends at HEAD, falls back to scripted interactive rebase otherwise, and always pushes with --force-with-lease. - Use Case: After an agent-driven session produces four incremental commits (feature, fix, refactor, test), run this Skill to collapse them into one descriptive commit before pushing to the remote branch. ## Quick Start Squash all the commits I made in this conversation into a single commit with a proper message.

Frequently Asked Questions about git-smart-squash

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I squash multiple git commits into one?

Specify an older and newer commit hash, and the Skill merges all commits in that inclusive range into one using git reset --soft followed by a new commit. A dry-run preview shows the affected commits and new message before anything executes.

How to squash commits without an interactive rebase editor?

When the newest commit is HEAD, the Skill uses git reset --soft to the parent of the oldest commit and creates a fresh commit, avoiding interactive editors entirely. For mid-branch ranges, it generates a rebase todo script non-interactively.

Can I squash commits that are not at the branch tip?

Yes, but it requires a scripted interactive rebase instead of reset --soft, and all later commits will be rebased. The Skill warns you first and aborts the rebase if conflicts occur.

Why must I use force push after squashing commits?

Squashing rewrites commit history, so the remote rejects a normal push. The Skill uses git push --force-with-lease, which safely overwrites the remote only if no one else has pushed changes in the meantime.

What happens if my working tree has uncommitted changes?

The Skill checks git status before starting and stops immediately if the working tree is dirty. You must commit or stash your changes first, ensuring no uncommitted work is lost during the squash.