Using Git Worktrees
Create isolated git worktrees with smart directory selection and safety verification
Install
npx skills add obra/clank --skill Using Git Worktreesgit clone --depth 1 https://github.com/obra/clank.git /tmp/clank
mkdir -p ~/.claude/skills
cp -r /tmp/clank/skills/collaboration/using-git-worktrees ~/.claude/skills/Using-Git-WorktreesPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Using Git Worktrees ## Overview Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching. **Core principle:** Systematic directory selection + safety verification = reliable isolation. **Announce at start:** "I'm using the Using Git Worktrees skill to set up an isolated workspace." ## Directory Selection Process Follow this priority order: ### 1. Check Existing Directories ```bash # Check in priority order ls -d .worktrees 2>/dev/null # Preferred (hidden) ls -d worktrees 2>/dev/null # Alternative ``` **If found:** Use that directory. If both exist, `.worktrees` wins. ### 2. Check CLAUDE.md ```bash grep -i "worktree.*director" CLAUDE.md 2>/dev/null ``` **If preference specified:** Use it without asking. ### 3. Ask User If no directory exists and no CLAUDE.md preference: ``` No worktree directory found. Where should I create worktrees? 1. .worktrees/ (project-local, hidden) 2. ~/.clank-worktrees/<project-name>/ (global location) Which would you prefer? ``` ## Safety Verification ### For Project-Local Directories (.worktrees or worktrees) **MUST verify .gitignore before creating worktree:** ```bash # Check if directory pattern in .gitignore grep -q "^\.worktrees/$" .gitignore || grep -q "^worktrees/$" .gitignore ``` **If NOT in .gitignore:** Per Jesse's rule "Fix broken things immediately": 1. Add appropriate line to .gitignore 2. Commit the change
Details
- Skill name
Using Git Worktrees- Repository
- obra/clank
- Path
skills/collaboration/using-git-worktrees/SKILL.md- Repo updated
- 9 October 2025
FAQ
What does the Using Git Worktrees skill do?
Create isolated git worktrees with smart directory selection and safety verification
How do I install the Using Git Worktrees skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add obra/clank --skill Using Git Worktrees. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Using Git Worktrees popular?
It lives in obra/clank, which has 43 GitHub stars and 26 forks.
Related skills
Gardening Skills Wiki
43obra/clank
Maintain skills wiki health - check links, naming, cross-references, and coverage
Remembering Conversations
43obra/clank
Search previous Claude Code conversations for facts, patterns, decisions, and context using semantic or text search
Brainstorming Ideas Into Designs
43obra/clank
Interactive idea refinement using Socratic method to develop fully-formed designs
Diff Intake
48amplitude/mcp-marketplace
Reads a PR or branch diff and produces a structured YAML change brief for downstream analytics instrumentation skills. Use this as the first step whenever a user shares a PR link, branch comparison, or raw diff and wants to understand what changed, what needs tracking, or how to instrument a feature. Trigger on phrases like "review this PR", "what changed in this branch", "help me instrument this diff", "check analytics coverage for this change", or any request to start the analytics review workflow.
Spec Idea
43inite-ai/inite-brain-service
Turn an idea for INITE Brain into a well-formed GitHub issue — no code. Use when someone wants to propose, suggest or request something for Brain ("it would be great if Brain…", "can you file this idea") but not build it themselves.
Distributed Mesh
45Azure-Samples/agent-skills-dotnet-demo
How to coordinate with squads on different machines using git as transport
Browse the most popular Claude skills, all git & code review skills, or write your own with the skills generator.