옵션
집 Skill Git 및 버전 관리 using-git-worktrees

현재 작업 공간과 분리해야 하는 기능 작업을 시작할 때나 구현 계획을 실행하기 전에 사용합니다. 스마트한 디렉터리 선택 및 안전성 검증을 통해 격리된 Git 작업 트리를 생성합니다.

...모든 것을 확장하십시오
61
업데이트 된 시간 2026년 6월 29일

소개 using-git-worktrees

'using-git-worktrees' 스킬은 Git 작업 트리 관리 과정을 간소화하여, 개발자가 단일 저장소를 공유하는 독립된 작업 공간을 생성할 수 있도록 설계되었습니다. 이 기능은 현재 작업 공간과 분리되어야 하는 새로운 기능 개발을 시작하거나 구현 계획을 실행할 때 특히 유용합니다. 체계적인 디렉터리 선택 및 안전성 검증을 활용하여, 이 스킬은 개발자가 충돌의 위험이나 메인 리포지토리에 실수로 커밋하는 일 없이 여러 브랜치에서 동시에 작업할 수 있도록 보장합니다.

자주 묻는 질문

이 스킬을 사용하여 새 워크트리를 생성하려면 어떻게 해야 하나요?

디렉터리 선택 절차를 따라 적절한 위치를 확인하고, 필요한 경우 .gitignore를 확인한 다음, 지정된 브랜치 이름으로 워크트리를 생성하세요.

이 스킬은 모든 Git 저장소와 호환되나요?

예, Git 저장소가 표준 규칙을 따르고 프로젝트 설정에 필요한 파일이 포함되어 있다면 호환됩니다.

워크트리를 설정한 후 테스트가 실패하면 어떻게 되나요?

테스트가 실패하면, 이 스킬은 실패 사항을 보고하고 추가 작업을 진행할지 아니면 문제를 조사할지 묻습니다.

이 스킬을 전역 디렉터리 설정에 사용할 수 있나요?

네, 이 스킬은 .gitignore 검증 없이 전역 디렉터리 내에 워크트리를 생성하는 기능을 지원합니다.

두 로컬 디렉터리가 모두 존재하는 경우 어떻게 해야 하나요?

두 디렉터리가 모두 발견될 경우, 이 스킬은 'worktrees' 디렉터리보다 '.worktrees' 디렉터리를 우선적으로 사용합니다.

GitHub에서 보기

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

# Check in priority orderls -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

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. ~/.config/superpowers/worktrees/<project-name>/ (global location)Which would you prefer?

Safety Verification

For Project-Local Directories (.worktrees or worktrees)

MUST verify directory is ignored before creating worktree:

# Check if directory is ignored (respects local, global, and system gitignore)git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

If NOT ignored:

Per Jesse's rule "Fix broken things immediately":

  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 (~/.config/superpowers/worktrees)

No .gitignore verification needed - outside project entirely.

Creation Steps

1. Detect Project Name

project=$(basename "$(git rev-parse --show-toplevel)")

2. Create Worktree

# Determine full pathcase $LOCATION in  .worktrees|worktrees)    path="$LOCATION/$BRANCH_NAME"    ;;  ~/.config/superpowers/worktrees/*)    path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"    ;;esac# Create worktree with new branchgit worktree add "$path" -b "$BRANCH_NAME"cd "$path"

3. Run Project Setup

Auto-detect and run appropriate setup:

# Node.jsif [ -f package.json ]; then npm install; fi# Rustif [ -f Cargo.toml ]; then cargo build; fi# Pythonif [ -f requirements.txt ]; then pip install -r requirements.txt; fiif [ -f pyproject.toml ]; then poetry install; fi# Goif [ -f go.mod ]; then go mod download; fi

4. Verify Clean Baseline

Run tests to ensure worktree starts clean:

# Examples - use project-appropriate commandnpm testcargo testpytestgo 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 implement <feature-name>

Quick Reference

SituationAction
.worktrees/ existsUse it (verify ignored)
worktrees/ existsUse it (verify ignored)
Both existUse .worktrees/
Neither existsCheck CLAUDE.md → Ask user
Directory not ignoredAdd to .gitignore + commit
Tests fail during baselineReport failures + ask
No package.json/Cargo.tomlSkip dependency install

Common Mistakes

Skipping ignore verification

  • Problem: Worktree contents get tracked, pollute git status
  • Fix: Always use git check-ignore before creating project-local worktree

Assuming directory location

  • Problem: Creates inconsistency, violates project conventions
  • Fix: Follow priority: existing > CLAUDE.md > ask

Proceeding with failing tests

  • Problem: Can't distinguish new bugs from pre-existing issues
  • Fix: Report failures, get explicit permission to proceed

Hardcoding setup commands

  • Problem: Breaks on projects using different tools
  • Fix: Auto-detect from project files (package.json, etc.)

Example Workflow

You: I'm using the using-git-worktrees skill to set up an isolated workspace.[Check .worktrees/ - exists][Verify ignored - git check-ignore confirms .worktrees/ is ignored][Create worktree: git worktree add .worktrees/auth -b feature/auth][Run npm install][Run npm test - 47 passing]Worktree ready at /Users/jesse/myproject/.worktrees/authTests passing (47 tests, 0 failures)Ready to implement auth feature

Red Flags

Never:

  • Create worktree without verifying it's ignored (project-local)
  • Skip baseline test verification
  • Proceed with failing tests without asking
  • Assume directory location when ambiguous
  • Skip CLAUDE.md check

Always:

  • Follow directory priority: existing > CLAUDE.md > ask
  • Verify directory is ignored for project-local
  • Auto-detect and run project setup
  • Verify clean test baseline

Integration

Called by:

  • brainstorming (Phase 4) - REQUIRED when design is approved and implementation follows
  • Any skill needing isolated workspace

Pairs with:

  • finishing-a-development-branch - REQUIRED for cleanup after work complete
  • executing-plans or subagent-driven-development - Work happens in this worktree

모든 파일

1개 파일

using-git-worktrees 설치

스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.

ZIP 다운로드

저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.

git clone https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/using-git-worktrees/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

복사 복사
빠른 설정: skill 폴더를 .claude/skills/로 복사하면 Claude가 해당 스킬을 자동으로 감지하여 사용합니다.

관련 스킬

github-project-management
업데이트 된 시간 2026년 6월 29일
readme-blueprint-generator
업데이트 된 시간 2026년 7월 5일
finishing-a-development-branch
업데이트 된 시간 2026년 6월 29일
changelog-generator
업데이트 된 시간 2026년 6월 29일
OR