Към всички skills

git-clean-branches

UfoMiao · Инструменти

Safely find and clean up merged or stale Git branches with dry-run mode and custom base/protected branches support

Оригинален текст · няма потвърден превод на български

Теми: agent · ai · ai-agent · bmad-method · ccr · claude · claude-4 · claude-ai · claude-code · cli · gpt · gpt-5 · llm · llm-code · nodejs

Първо прочетете инструкцията.

Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.

Оригинален SKILL.md
GitHub хранилище
Звезди на репото
6080
Лиценз
MIT
Последна проверка на записа
21.09.2026 г.

Добавете в своя инструмент.

Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.

npx skills add UfoMiao/zcf

Страницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.

Откъс от SKILL.md

Началото на файла на автора, без превод.

Claude Command: Clean Branches

This command safely identifies and cleans up merged or stale Git branches. Runs in read-only preview (--dry-run) mode by default, requiring explicit instructions to perform deletions.


Usage

# [Safest] Preview branches to be cleaned without executing any deletions
/git-cleanBranches --dry-run

# Clean local branches merged to main and inactive for over 90 days (requires individual confirmation)
/git-cleanBranches --stale 90

# Clean local and remote branches merged to release/v2.1 (auto-confirm)
/git-cleanBranches --base release/v2.1 --remote --yes

# [Dangerous] Force delete an unmerged local branch
/git-cleanBranches --force outdated-feature

Options

  • --base <branch>: Specify the base branch for cleanup (defaults to repository's main/master).
  • --stale <days>: Clean branches with no commits for specified days (disabled by default).
  • --remote: Also clean remote merged/stale branches.
  • --dry-run: Default behavior. Only list branches to be deleted without executing any operations.
  • --yes: Skip individual confirmations and delete all identified branches directly (suitable for CI/CD).
  • --force: Use -D to force delete local branches (even if unmerged).

What This Command Does

  1. Configuration and Safety Checks

    • Update Information: Automatically executes git fetch --all --prune to ensure branch status is current.
    • Read Protected Branches: Reads the list of branches that should not be cleaned from Git config (see "Configuration" below).
    • Determine Base: Uses --base parameter or auto-detected main/master as comparison baseline.
  2. Analysis and Identification (Find)

    • Merged Branches: Find local (and remote if --remote is added) branches fully merged to --base.
    • Stale Branches: If --stale <days> is specified, find branches with last commit N days ago.
    • Exclude Protected Branches: Remove all configured protected branches from cleanup list.
  3. Report and Preview (Report)

    • Clearly list "merged branches to be deleted" and "stale branches to be deleted".
    • Without --yes parameter, command ends here, waiting for user confirmation to re-execute (without --dry-run).

Целият SKILL.md в GitHub