squashing-history

Squash all main branch commits into one Initial commit with backup and diff checks.

3|1|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/SocketDev/socket-btm --skill squashing-history
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: squashing-history
Source: https://github.com/SocketDev/socket-btm/tree/main/.claude/skills/squashing-history
Command: npx skills add https://github.com/SocketDev/socket-btm --skill squashing-history

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a safe, auditable method to rewrite a Git history by squashing all commits on the main branch into a single "Initial commit" while preserving code integrity, with a backup branch for rollback and explicit user confirmation before destructive actions.

Core Features & Use Cases

  • Backup-first history rewrite: creates a timestamped backup branch to restore if needed.
  • Integrity verification: verifies no code changes by diffing against the backup.
  • User-controlled force push: requires explicit confirmation before pushing to origin/main.
  • Applicability: ideal for public releases, simplifying contributor history, or removing sensitive data after prior edits.

Quick Start

Follow the Phase-based workflow: Phase 1 checks, Phase 2 creates backup, Phase 3 records state, Phase 4 soft-resets to first commit, Phase 5 creates a single "Initial commit", Phase 6 validates zero diffs, Phase 7 confirms readiness, Phase 8 force-push after consent, Phase 9 completes and documents rollback.

Frequently Asked Questions about squashing-history

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

FAQPage Schema
How do I squash all git commits into one initial commit for a public release?

You squash all git commits by creating a backup branch, soft-resetting to the first commit, creating a single new commit, verifying zero diff against the backup, and force-pushing to origin/main after explicit user confirmation.

Can I restore my git history if squashing commits goes wrong?

Yes, you can restore git history using the timestamped backup branch created before any destructive actions. This backup preserves the original commit state for complete rollback if the integrity checks fail.

What is the safest way to force push a squashed commit to origin main?

The safest way to force push a squashed commit is using a workflow that requires explicit user confirmation before executing the push, preceded by a backup branch creation and diff-based integrity verification to ensure no code changes occurred.

Does squashing git history verify that no code changes occurred during the rewrite?

Yes, squashing git history includes a diff-based integrity check that compares the final state against the timestamped backup branch, verifying zero differences to ensure code integrity is fully preserved before the force push.

When should I squash all commits on my main branch into a single commit?

You should squash commits when preparing repositories for public release, reducing noise from WIP commits, simplifying contributor history across teams, or removing sensitive data after prior edits to ensure a clean project timeline.