squash-branch

Squash all commits on a feature branch into a single commit. Use when the user wants to clean up commit history, squash commits, or consolidate branch changes into one commit.

16 stars

Best use case

squash-branch is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Squash all commits on a feature branch into a single commit. Use when the user wants to clean up commit history, squash commits, or consolidate branch changes into one commit.

Teams using squash-branch should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/squash-branch/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/ai-agents/squash-branch/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/squash-branch/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How squash-branch Compares

Feature / Agentsquash-branchStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Squash all commits on a feature branch into a single commit. Use when the user wants to clean up commit history, squash commits, or consolidate branch changes into one commit.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Squash Branch Skill

Squash all commits on a feature branch into a single commit by generating a patch, recreating the branch from the base, and applying the patch.

## Parameters

The user should provide:
- **feature_branch**: The branch to squash (e.g., `jose/vectors`, `feature/my-feature`)
- **base_branch**: The branch to squash against (e.g., `mainline`, `main`, `master`)
- **commit_message** (optional): If not provided, prompt the user for a commit message

## Instructions

1. **Verify current state**: Ensure the working directory is clean and you're on the feature branch
   ```bash
   git status
   git branch --show-current
   ```

2. **Generate the patch**: Create a diff between the base branch and feature branch
   ```bash
   git diff <base_branch>...<feature_branch> > /tmp/squash-branch.patch
   ```

3. **Switch to base branch and delete feature branch**:
   ```bash
   git checkout <base_branch>
   git branch -D <feature_branch>
   ```

4. **Recreate feature branch from base and apply patch**:
   ```bash
   git checkout -b <feature_branch>
   git apply /tmp/squash-branch.patch
   ```

5. **Prompt for commit message**: If no commit message was provided, use AskUserQuestion to ask the user what commit message they want

6. **Stage and commit**:
   ```bash
   git add -A
   git commit -m "<commit_message>

   Co-Authored-By: Claude <noreply@anthropic.com>"
   ```

7. **Show final result**: Display the new clean commit history
   ```bash
   git log --oneline <base_branch>..<feature_branch>
   git diff --stat <base_branch>...<feature_branch>
   ```

## Example Usage

User: "Squash my feature/auth branch against main with message 'Add user authentication'"

User: "Clean up the commit history of jose/vectors against mainline"

User: "/squash-branch feature_branch=dev/new-feature base_branch=main"

## Important Notes

- This operation is destructive to the local branch history - make sure changes are not pushed and nothing other than the feature branch is modified
- Always verify the patch was created successfully before deleting the branch
- If the patch application fails, the original branch is already deleted - warn the user about this risk
- The patch file is stored in /tmp and will be cleaned up by the system

Related Skills

repoint-branch

16
from diegosouzapw/awesome-omni-skill

Extract independent changes from a feature branch into a new PR targeting main.

analyzing-branches

16
from diegosouzapw/awesome-omni-skill

Use when analyzing another branch's iteration journals to extract findings, decisions, and insights from divergent work

analyzing-branch-status

16
from diegosouzapw/awesome-omni-skill

Use when user wants detailed status report for single autonomy branch including iteration timeline and metrics progression

agent-ops-branch-workflow

16
from diegosouzapw/awesome-omni-skill

Standardized branch creation with type detection, issue ID extraction, and worktree setup. Creates working branches (-WB) and integrates with selective-copy for clean PRs.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

obsidian-daily

16
from diegosouzapw/awesome-omni-skill

Manage Obsidian Daily Notes via obsidian-cli. Create and open daily notes, append entries (journals, logs, tasks, links), read past notes by date, and search vault content. Handles relative dates like "yesterday", "last Friday", "3 days ago".

obsidian-additions

16
from diegosouzapw/awesome-omni-skill

Create supplementary materials attached to existing notes: experiments, meetings, reports, logs, conspectuses, practice sessions, annotations, AI outputs, links collections. Two-step process: (1) create aggregator space, (2) create concrete addition in base/additions/. INVOKE when user wants to attach any supplementary material to an existing note. Triggers: "addition", "create addition", "experiment", "meeting notes", "report", "conspectus", "log", "practice", "annotations", "links", "link collection", "аддишн", "конспект", "встреча", "отчёт", "эксперимент", "практика", "аннотации", "ссылки", "добавь к заметке".

observe

16
from diegosouzapw/awesome-omni-skill

Query and manage Observe using the Observe CLI. Use when the user wants to run OPAL queries, list datasets, manage objects, or interact with their Observe tenant from the command line.

observability-review

16
from diegosouzapw/awesome-omni-skill

AI agent that analyzes operational signals (metrics, logs, traces, alerts, SLO/SLI reports) from observability platforms (Prometheus, Datadog, New Relic, CloudWatch, Grafana, Elastic) and produces practical, risk-aware triage and recommendations. Use when reviewing system health, investigating performance issues, analyzing monitoring data, evaluating service reliability, or providing SRE analysis of operational metrics. Distinguishes between critical issues requiring action, items needing investigation, and informational observations requiring no action.

nvidia-nim

16
from diegosouzapw/awesome-omni-skill

NVIDIA NIM inference microservices for deploying AI models with OpenAI-compatible APIs, self-hosted or cloud

numpy-string-ops

16
from diegosouzapw/awesome-omni-skill

Vectorized string manipulation using the char module and modern string alternatives, including cleaning and search operations. Triggers: string operations, numpy.char, text cleaning, substring search.

nova-act-usability

16
from diegosouzapw/awesome-omni-skill

AI-orchestrated usability testing using Amazon Nova Act. The agent generates personas, runs tests to collect raw data, interprets responses to determine goal achievement, and generates HTML reports. Tests real user workflows (booking, checkout, posting) with safety guardrails. Use when asked to "test website usability", "run usability test", "generate usability report", "evaluate user experience", "test checkout flow", "test booking process", or "analyze website UX".