Skip to content
Back to skills

Git Worktree Cleanup And Branch Hygiene

ASecurity

Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 9, 2026
toolsgogit

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add vamseeachanta/workspace-hub --skill git-worktree-cleanup-and-branch-hygiene --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Worktree Cleanup And Branch Hygiene?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Worktree Cleanup And Branch Hygiene
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vamseeachanta-git-worktree-cleanup-and-branch-hygiene/badge)](https://www.skillsdirectory.com/skills/vamseeachanta-git-worktree-cleanup-and-branch-hygiene)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: git-worktree-cleanup-and-branch-hygiene
description: Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos
version: 1.0.0
source: auto-extracted
extracted: 2026-04-14
metadata:
  tags: ["git", "workflow", "automation", "repository-maintenance"]
---

# Git Worktree Cleanup and Branch Hygiene at Scale

When managing automation-heavy repos with accumulated stale worktrees and branches: (1) identify worktrees attached to merged branches via `git worktree list`, (2) remove them with `git worktree remove` before deleting branches (worktrees block deletion), (3) categorize remaining branches by lifecycle (worktree-agent remnants, orphan pre-restructure branches with no common ancestor, superseded feature branches, protected branches), (4) delete merged branches remotely first, then locally, (5) for unmerged branches with value, dry-run merges and resolve conflicts by keeping the current main version if divergence predates recent updates. This prevents disk bloat and merge conflicts from automation artifacts.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…