squash-branch

Squash all commits on the current branch into a single local commit.

2|Updated May 25, 2021
One-click install
npx skills add https://github.com/kang8/.dotfiles --skill squash-branch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: squash-branch
Source: https://github.com/kang8/.dotfiles/tree/main/claude/.claude/skills/squash-branch
Command: npx skills add https://github.com/kang8/.dotfiles --skill squash-branch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Squash all commits on the current branch into a single commit and produce a clear final message based on the combined changes, then stop before pushing so you can review and force-push yourself.

Core Features & Use Cases

  • Local squash workflow: collapses all commits on the active branch into one, preserving the final state.
  • Message synthesis: drafts a final commit message from the diff and original commit notes.
  • Safe handoff: provides guidance on pushing with --force-with-lease and makes no automatic pushes.

Quick Start

Ask the AI to squash the current branch into a single commit locally.

Frequently Asked Questions about squash-branch

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

FAQPage Schema
How do I squash all commits on a git branch into a single commit?

Squashing a branch collapses all local commits into a single commit. It determines the base via upstream, synthesizes a final commit message from the combined diff and original notes, and stops before pushing so you can review.

When should I squash commits in my version-control workflow?

Squash commits when you need a clean git history before merging. It condenses intermediate work-in-progress commits into a single cohesive commit with a synthesized message based on the overall diff.

Does squashing a branch automatically push the changes to the remote repository?

No, squashing operates locally and makes no automatic pushes. It stops after creating the single commit so you can review changes, guiding you to manually push using git push --force-with-lease when ready.

How is the final commit message generated when squashing a branch?

The final commit message is drafted by synthesizing the combined diff and original commit notes. This ensures the new single commit message accurately reflects all changes collapsed from the previous branch commits.

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

The safest way to force push a squashed branch is using git push --force-with-lease. This overwrites remote history with your single squashed commit while preventing accidental overwrites of new upstream changes.