git-squash-soft-reset

Squash multiple git commits into one using a non-interactive soft reset.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/cajias/claude-skills --skill git-squash-soft-reset
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-squash-soft-reset
Source: https://github.com/cajias/claude-skills/tree/main/skills/git-squash-soft-reset
Command: npx skills add https://github.com/cajias/claude-skills --skill git-squash-soft-reset

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you combine many git commits into one clean commit without opening an editor or relying on interactive rebase, making it ideal for automation and fast branch cleanup.

Core Features & Use Cases

  • Non-interactive squashing: Uses git reset --soft to collapse all commits on a branch into a single staged change set.
  • Safer push workflow: Recommends --force-with-lease to reduce the risk of overwriting someone else’s remote changes.
  • Hook bypass guidance: Explains when and how to use --no-verify if pre-commit hooks fail in CI or other constrained environments.
  • Use case: A developer finishing a feature branch with many small commits can squash everything into one polished commit before merge.

Quick Start

Use this skill to squash all commits on my current branch into one clean commit based on origin/main and then safely force-push it.

Frequently Asked Questions about git-squash-soft-reset

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

FAQPage Schema
How do I squash git commits without using interactive rebase?

You can squash git commits without interactive rebase by using a non-interactive `git reset --soft` workflow to collapse all commits on a branch into a single staged change set. This avoids opening an editor entirely.

What is the safest way to force push a squashed commit to a remote branch?

The safest way to force push a squashed commit is using `git push --force-with-lease`, which reduces the risk of overwriting someone else's remote changes by verifying the remote branch state before updating.

Can I squash git commits in a CI/CD automation pipeline?

Yes, you can squash git commits in CI/CD automation. The non-interactive soft reset workflow is specifically designed for cases where interactive rebase is impractical or unavailable in constrained environments.

How do I bypass pre-commit hooks when squashing commits in CI environments?

You can bypass pre-commit hooks when squashing commits by using the `--no-verify` flag during your push step, which is guided for scenarios where pre-commit hooks fail in CI or other constrained environments.

Do I need a clean working tree before squashing commits with a soft reset?

Yes, you need a clean working tree before squashing commits. The soft reset workflow requires clean working tree validation to ensure your staged change set accurately reflects the collapsed commits without untracked modifications.