using-git-worktrees

Creates session-specific git worktrees and branches for Claude Code isolation.

Updated Mar 21, 2026
One-click install
npx skills add https://github.com/ManfronEnrico/thesis-manifold --skill using-git-worktrees-manfronenrico
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/ManfronEnrico/thesis-manifold/tree/main/.agents/skills/using-git-worktrees
Command: npx skills add https://github.com/ManfronEnrico/thesis-manifold --skill using-git-worktrees-manfronenrico

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps keep Claude Code sessions isolated by automatically creating a git worktree per session, avoiding cross-session staging conflicts and enabling safe experimentation.

Core Features & Use Cases

  • Create a dedicated worktree directory under .cc/worktrees/<slug>/ for each session.
  • Enforce "one session → one worktree → one branch" policy to prevent collisions.
  • Provide step-by-step workflow: verify .cc/ is gitignored, derive branch name, check existing worktrees, create, open, and cleanup.
  • Reference the branch naming convention and integration with /draft-commit for cleanup/audit.
  • Use case: starting a new Claude Code session with isolated working directory to avoid accidental commits across sessions.

Quick Start

Use the using-git-worktrees skill to set up an isolated workspace for a new Claude Code session.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I isolate Claude Code sessions using git worktrees to prevent staging conflicts?

To isolate Claude Code sessions, this skill automatically creates a dedicated git worktree under .cc/worktrees and a corresponding branch for each session. This enforces a one-worktree-per-session policy to prevent cross-session staging conflicts.

What is the workflow for creating a git worktree for a new Claude Code session?

The workflow involves verifying .cc/ is gitignored, deriving a branch name, checking existing worktrees, creating the worktree, opening it, and cleaning up. It includes safety checks and branch-mismatch handling to standardize the process.

How do I clean up git worktrees after finishing a Claude Code session?

You clean up git worktrees by using the /draft-commit flow. This workflow guides the cleanup and audit process, ensuring that the isolated branch and worktree directory are safely removed after your session ends.

Do I need to gitignore the .cc/ directory before setting up worktree isolation?

Yes, you must verify that the .cc/ directory is gitignored before creating worktrees. This prevents the session-specific worktree directories from being accidentally committed to your main repository branch.

What happens if there is a branch name mismatch when creating a git worktree?

The skill implements branch-mismatch handling to address naming collisions during worktree creation. It applies safety checks and a documented branch naming convention to standardize the process and prevent errors.