using-git-worktrees

using-git-worktrees is a skill for Claude Code, Codex from alexei-led/cc-thingz. It costs 81 tokens per session (728 once invoked), scanned A, original, MIT.

A workflow for creating separate folders from one Git project, each tied to a different branch. These Git worktrees let you work on several branches at the same time.

In plain words
What is it for?
Use it to start isolated feature, bug-fix, or experimental work, especially when the current folder has uncommitted changes or multiple branches must be active at once.
Why use it?
It keeps unfinished changes in one branch from interfering with feature work, fixes, or experiments in another. It also avoids repeatedly switching branches when tasks need to stay open together.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to start isolated feature, bug-fix, or experimental work, especially when the current folder has uncommitted changes or multiple branches must be active at once.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alexei-led/cc-thingz/using-git-worktrees
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alexei-led/cc-thingz --skill using-git-worktrees
Clone the repo
git clone --depth 1 https://github.com/alexei-led/cc-thingz

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for using-git-worktrees

README.md
[![agentmods](https://agentmods.dev/badge/skills/alexei-led/cc-thingz/using-git-worktrees/github.svg)](https://agentmods.dev/skills/alexei-led/cc-thingz/using-git-worktrees)
Your own site
<a href="https://agentmods.dev/skills/alexei-led/cc-thingz/using-git-worktrees"><img src="https://agentmods.dev/badge/skills/alexei-led/cc-thingz/using-git-worktrees/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for using-git-worktrees

Your own site · 80×15
<a href="https://agentmods.dev/skills/alexei-led/cc-thingz/using-git-worktrees"><img src="https://agentmods.dev/badge/skills/alexei-led/cc-thingz/using-git-worktrees.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 728 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00081 $0.00728
Opus 5.5 $0.00032 $0.00291
Sonnet 5.5 $0.00016 $0.00146
Haiku 4.5 $0.00008 $0.00073

Measured 15d ago against content hash f9e62ffe1ebd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

using-git-worktrees scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 15d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/cleanup-worktree.sh, scripts/setup-worktree.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/skills/using-git-worktrees/SKILL.md · 52 lines

How it starts

The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Git Worktrees

A worktree gives parallel work its own folder and branch while the main worktree stays clean on the integration branch. Each project gets one sibling root, <project>.worktrees/, with one directory per branch named by its slug (/ → -, so feature/auth → feature-auth). Remove the worktree and branch after the PR merges.

A plain branch switch with no parallel work needs no worktree: check git status --short, then git switch <branch>. Trivial solo one-liners may also stay in the main worktree.

Create

Check git status --short and git worktree list first. Leave uncommitted changes where they are and never stash them silently; pass --allow-dirty only when the user has authorized isolating new work while keeping them.

scripts/setup-worktree.sh <branch> [--base <ref>] [--allow-dirty] [--setup] [--test]

The script runs git worktree add from the main worktree root. It checks out an existing local or origin branch instead of recreating it, and refuses an existing path, a branch checked out in another worktree, or a dirty tree without --allow-dirty. It reports base divergence from local refs without fetching.

  • --setup does a frozen install with the declared package manager and lockfile (uv for Python). Conflicting lockfiles or manager declarations stop it. A setup failure exits non-zero but still prints the path.
  • --test runs the detected baseline tests. Failures only warn.
  • A skipped setup or test is not a pass.

Clean up one worktree

scripts/cleanup-worktree.sh [branch]

A cleanup request authorizes removal of a clean, verified merged worktree and its branch without another confirmation. The script fetches first and verifies Git ancestry, a merged PR bound to the repository/base/head, or an equivalent squash patch without gh. It preserves new commits and uncommitted files, including ignored files. For an exception, show the exact target, full tip OID, commits and files at risk, then ask once. After consent, recheck the tip and files and run --force <branch> yourself; never require the user to copy and run the command. Main, protected, and locked worktrees remain guarded even with force. For bulk or stale cleanup and command-local hook consent, use cleanup-git. Leave git pull out of cleanup; update the integration worktree separately only when clean and requested.

Read the full file on GitHub · 52 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 15d ago Changed f9e62ffe1ebd
  2. 20d ago Changed · +3 lines · +23 tokens per session 5e5c663cd6d6
  3. 22d ago Changed · -57 lines 4b1166b43c85
  4. 1mo ago Changed · +5 lines 1cf7875eb455
  5. 1mo ago First seen · 101 lines · 58 tokens per session scan A 695fa96c973a

Subscribe to this mod's changes

using-git-worktrees is a skill published in the GitHub repository alexei-led/cc-thingz (38 stars, last pushed 11d ago), licensed MIT. It adds 81 tokens to every session and 728 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.