← ClaudeAtlas

reconcilelisted

Consolidate worktrees and clean up stale branches. Use when asked to reconcile, clean up worktrees, consolidate branches, or tidy up a project's git state.
lgtm-hq/ai-skills · ★ 0 · DevOps & Infrastructure · score 66
Install: claude install-skill lgtm-hq/ai-skills
# Reconcile Consolidate worktrees into the main worktree and clean up stale branches for a project. ## Arguments Accepts an optional project name as an argument: - `/reconcile` — reconcile the current working directory's project - `/reconcile py-lintro` — reconcile the project at `~/Code/py-lintro` ## Workflow ### Phase 1 — Discovery 1. **Identify the project root**: - If a project name is given, look for `~/Code/<project-name>` - Otherwise, use the current git repository root - Confirm it's a git repository — if not, stop 2. **Find all worktrees**: ```bash git worktree list ``` 3. **Find sibling directories** that may be related: - List directories matching `<project-name>-*` in the same parent directory - For each, check if it's: - A **worktree** (`.git` is a file pointing to the main repo) - A **separate clone** (`.git` is a directory with same remote) - **Unrelated** (different remote or not a git repo) — ignore these 4. **Collect all branches**: ```bash git branch -vv --no-color ``` ### Phase 2 — Analysis For each branch (excluding `main`/`master`), determine its status: 1. **Check remote tracking**: - If tracking branch shows `gone` → remote branch was deleted (PR likely merged or closed) - If tracking branch exists → check PR status 2. **Check GitHub PR status** (if `gh` is available): ```bash gh pr list --state all --json number,title,headRefName,state ``` - Map each branch to its