branches-clean

Delete non-main local and remote Git branches one-by-one with safety checks.

12|5|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/Clyra-AI/gait --skill branches-clean-clyra-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: branches-clean
Source: https://github.com/Clyra-AI/gait/tree/main/.agents/skills/branches-clean
Command: npx skills add https://github.com/Clyra-AI/gait --skill branches-clean-clyra-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Delete non-main local and remote branches one-by-one with safety checks to avoid accidental loss of work.

Core Features & Use Cases

  • One-by-one local branch deletion with safety checks (never delete main).
  • Remote branch deletions for configured remotes (default origin), with per-branch verification.
  • Generates a final report listing deleted and remaining branches, plus any skipped or failed branches.

Quick Start

Clean up all non-main branches by deleting them one-by-one after validating the repository and ensuring main is current.

Frequently Asked Questions about branches-clean

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

FAQPage Schema
How do I safely delete local and remote Git branches without losing uncommitted work?

To safely delete Git branches, this process enforces one-by-one deletions with safety checks, switching to main first, ensuring it is up-to-date, and verifying each branch before deletion to prevent accidental loss of work.

What is the best way to prune all non-main branches in a Git repository with multiple branches?

The best way to prune non-main branches is through one-by-one deletion with safety checks. It switches to main, fetches and prunes configured remotes like origin, verifies each branch individually, and produces a final summary of deleted and remaining branches.

Can I delete remote Git branches one-by-one while ensuring main is up-to-date?

Yes, you can delete remote Git branches one-by-one with per-branch verification. The process ensures main is fully up-to-date before proceeding with any deletions on configured remotes, defaulting to origin, to avoid accidental loss.

Why does my Git branch cleanup skip the main branch during deletion?

Git branch cleanup skips main because the safety checks explicitly prevent main from being deleted. The process enforces this rule while deleting all other non-main local and remote branches one-by-one, ensuring the core branch remains intact.

Does Git branch cleanup work for repositories with multiple configured remotes?

Yes, Git branch cleanup works for repositories with multiple remotes by defaulting to origin and applying per-branch verification during remote deletion. It fetches and prunes remotes before executing one-by-one deletions of non-main branches.

What happens to skipped or failed branches during Git branch cleanup?

Skipped or failed branches during Git branch cleanup are captured in a final report. The process lists all deleted and remaining branches along with any skipped or failed ones, providing a complete summary of the outcome.