Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

git-worktrees

БесплатноБез исполняемых скриптовНе проверен

Create isolated git workspaces for feature development. Smart directory selection, safety verification, and cross-platform support (Windows/Unix).

xenitV1от xenitV1★ 227 звёзд на GitHub

Об этом скилле

# 🌳 GIT WORKTREES: ISOLATED WORKSPACES > **Philosophy:** Isolation prevents contamination. Work on features without affecting the main workspace. Systematic directory selection + safety verification = reliable isolation. **ISOLATION INTEGRITY MANDATE (CRITICAL):** Never create worktrees in directories that are not explicitly ignored by Git. AI-generated workflows often fail by polluting the primary repository with tracked worktree data. You MUST verify that the destination directory is within `.gitignore` before execution. Furthermore, you MUST ensure a 'Clean Baseline' by running tests before starting any feature work in a new worktree to avoid cross-contamination of artifacts. --- ## 🎯 OVERVIEW Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching. **Benefits:** - Work on feature branch without stashing changes - Test in isolation without affecting main workspace - Run long processes without blocking other work - Easy cleanup when feature is complete

📋 WHEN TO USE

Use before:

  • Starting new feature development
  • Implementing plans from @planning-mastery
  • Making experimental changes
  • Working on multiple features in parallel Skip for:
  • Quick bug fixes on current branch
  • Documentation updates
  • Configuration changes

📁 DIRECTORY SELECTION PROCESS

Follow this priority order:

1. Check Existing Directories

Unix/macOS:

ls -d .worktrees 2>/dev/null     # Preferred (hidden)
ls -d worktrees 2>/dev/null      # Alternative

Windows (PowerShell):

if (Test-Path ".worktrees") { ".worktrees" }
elseif (Test-Path "worktrees") { "worktrees" }

If found: Use that directory. If both exist, .worktrees wins.

2. Check CLAUDE.md

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. %USERPROFILE%\.config\maestro\worktrees\<project>\ (global location)
Which would you prefer?
## 🔒 SAFETY VERIFICATION ### For Project-Local Directories **MUST verify directory is ignored before creating worktree:** **Unix/macOS:** ```bash git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null ``` **Windows (PowerShell):** ```powershell git check-ignore -q .worktrees 2>$null if ($LASTEXITCODE -ne 0) { git check-ignore -q worktrees 2>$null } ``` **If NOT ignored:** 1. Add appropriate line to .gitignore 2. Commit the change 3. Proceed with worktree creation **Why critical:** Prevents accidentally committing worktree contents to repository. ### For Global Directory No .gitignore verification needed - outside project entirely. ## 🔨 CREATION STEPS ### 1. Detect Project Name **Unix/macOS:** ```bash project=$(basename "$(git rev-parse --show-toplevel)") ``` **Windows (PowerShell):** ```powershell $project = Split-Path -Leaf (git rev-parse --show-toplevel) ``` ### 2. Create Worktree **Unix/macOS:** ```bash # Project-local path=".worktrees/$BRANCH_NAME" git worktree add "$path" -b "$BRANCH_NAME" cd "$path" # Or global path="$HOME/.config/maestro/worktrees/$project/$BRANCH_NAME" mkdir -p "$(dirname "$path")" git worktree add "$path" -b "$BRANCH_NAME" cd "$path" ``` **Windows (PowerShell):** ```powershell # Project-local $path = ".worktrees\$BRANCH_NAME" git worktree add $path -b $BRANCH_NAME Set-Location $path # Or global $path = "$env:USERPROFILE\.config\maestro\worktrees\$project\$BRANCH_NAME" New-Item -ItemType Directory -Force -Path (Split-Path $path) git worktree add $path -b $BRANCH_NAME Set-Location $path ``` ### 3. Run Project Setup Auto-detect and run appropriate setup: **Cross-platform:** ```bash # Node.js if [ -f package.json ]; then npm install; fi # Python if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f pyproject.toml ]; then poetry install; fi # Rust if [ -f Cargo.toml ]; then cargo build; fi # Go if [ -f go.mod ]; then go mod download; fi ```

Windows (PowerShell):

# Node.js
if (Test-Path "package.json") { npm install }

# Python
if (Test-Path "requirements.txt") { pip install -r requirements.txt }
if (Test-Path "pyproject.toml") { poetry install }

# Rust
if (Test-Path "Cargo.toml") { cargo build }

# Go
if (Test-Path "go.mod") { go mod download }

4. Verify Clean Baseline

Run tests to ensure worktree starts clean:

# Use project-appropriate command
npm test
pytest
cargo test
go test ./...

If tests fail: Report failures, ask whether to proceed or investigate. If tests pass: Report ready.

5. Report Location

Worktree ready at <full-path>
Tests passing (<N> tests, 0 failures)
Ready to im
Полный SKILL.md на GitHub

Установить git-worktrees в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Glob
Grep
Bash

FAQ

Что делает скилл git-worktrees?

Create isolated git workspaces for feature development. Smart directory selection, safety verification, and cross-platform support (Windows/Unix).

Как установить скилл git-worktrees?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл git-worktrees запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить git-worktrees с