worktree-status

Audit git worktrees for dirty state and merge status against main.

18|8|Updated Jun 17, 2026
One-click install
npx skills add https://github.com/PyModel/pythinker-code --skill worktree-status-pymodel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-status
Source: https://github.com/PyModel/pythinker-code/tree/main/.agents/skills/worktree-status
Command: npx skills add https://github.com/PyModel/pythinker-code --skill worktree-status-pymodel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working with multiple git worktrees, it is hard to know which branches are merged, which have uncommitted changes, and which worktrees can be safely removed without losing work. This Skill audits every worktree and reports its status in a clear table. ## Core Features & Use Cases - Worktree Audit: Lists every worktree with its branch, dirty state, and merge status relative to origin/main. - Squash-Merge Detection: Uses a per-file content diff against the merge-base to detect squash-merged branches that git merge-base --is-ancestor misses. - Safe Cleanup: Removes only user-approved worktrees and deletes branches only when no longer needed. - Use Case: Before cleaning up a dozen feature worktrees, run the audit to confirm which branches are merged and clean, then remove only the safe ones. ## Quick Start Ask the agent to show the status of all git worktrees and identify which ones can be safely cleaned up.

Frequently Asked Questions about worktree-status

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

FAQPage Schema
How do I check which git worktrees can be safely deleted?

List all worktrees with git worktree list, check each for uncommitted changes via git status, and verify the branch is merged into main. A worktree is safe to remove only when it is both clean and merged.

How to detect squash-merged branches in git?

Find the merge-base between the branch and main, list files the branch changed, then diff each file between the branch and main. If all changed files are identical, the branch was squash-merged even though ancestry checks fail.

Why does git merge-base --is-ancestor miss merged branches?

It only checks commit ancestry, so squash merges and rebases rewrite history and break the ancestor relationship. Follow up with a content diff of the branch's changed files against main to confirm the changes are present.

Why must I pull main before checking worktree merge status?

Merge detection compares branches against origin/main, so a stale local main produces false 'not merged' results. Pulling latest main first ensures ancestry and content diff checks reflect the current state.

Can I remove a git worktree that has uncommitted changes?

You can force removal, but uncommitted changes will be lost permanently. Always check git status in the worktree first and commit or stash any work before running git worktree remove.