Agent skill · Workflow & Productivity

using-git-worktrees

Use when a coding task needs a concurrent checkout, unrelated dirty state blocks safe branch switching, or the user or repository explicitly requires a worktree.

GanyuanRangithub.com/GanyuanRanGitHub ↗
claude-codecodexMIT
Install
npx skills add GanyuanRan/Aegis --skill using-git-worktrees --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 4 KB
Bundled scripts: none
Path: skills/using-git-worktrees/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 902 · +79 this week
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Using Git Worktrees ## Overview A worktree is an exception for simultaneously checking out another Git history, not a general safety badge. Prefer the current workspace and reuse an existing suitable worktree. A branch decision and a worktree decision are separate. **Core principle:** create only with necessity and ownership evidence; pair every created worktree with a cleanup path. **Announce at start:** explain which concrete checkout conflict requires a worktree. ## Step 0: Environment Detection Before mutation, record the repository root, `HEAD`, branch/detached state, staged/unstaged/untracked paths, active Git operations, and: ```bash git worktree list --porcelain ``` Stop on detached HEAD, unresolved conflicts, or an active merge/rebase/ cherry-pick/revert/bisect. Preserve user state: no automatic stash, reset, clean, broad staging, or commit. Before deciding necessity or placement, read the smallest relevant project `AGENTS.md`, `CLAUDE.md`, current authority, and existing worktree convention. Repository policy may require or forbid isolation and owns any approved in-repo location; do not discover that policy after creating the checkout. ## Step 1: Necessity Decision Crea

What's inside
Steps it walks through
  1. Overview
  2. Step 0: Environment Detection
  3. Step 1: Necessity Decision
  4. Step 2: Safe Placement
  5. Step 3: Create the Minimum Checkout
  6. Step 4: Authority-Led Setup and Baseline
  7. Step 5: Handoff and Cleanup Ownership
  8. Red Flags
  9. Integration
Commands it runs
git worktree list --porcelain
Existing branch
git worktree add <exact-path> <branch>
New independently justified branch
git worktree add -b <branch> <exact-path> <start-point>
More from Aegis
All skills →
About this skill
What does the using-git-worktrees skill do?

Use when a coding task needs a concurrent checkout, unrelated dirty state blocks safe branch switching, or the user or repository explicitly requires a worktree.

How do I install it?

Run `npx skills add GanyuanRan/Aegis --skill using-git-worktrees --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From GanyuanRan/Aegis, a repository with 902 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going