agentsclimarketplace

Using git worktrees skills doyajin174 using git worktrees

Skill bg-szy/TOP-SKILLS/skills/marketplace/using-git-worktrees__skills-doyajin174-using-git-worktrees

全球最大的 Claude Code 技能聚合库 · 收录 3900+ 来自 12+ 来源的技能,提供在线搜索与趋势分析看板 / The world's largest Claude Code skill aggregation hub — 3900+ skills from 12+ sources with online search and trend dashboard

Install
npx -y skills add bg-szy/TOP-SKILLS --skill using-git-worktrees__skills-doyajin174-using-git-worktrees

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Create isolated git worktrees with smart directory selection and safety verification. Use this when starting feature work that needs isolation, parallel development, or safe experimentation.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

3.9 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Using Git Worktrees

Git worktree를 사용한 격리된 개발 환경 생성 가이드입니다.

When to Use

  • 기능 개발을 위한 격리된 환경 필요 시
  • 여러 브랜치에서 동시 작업 시
  • 안전한 실험이 필요할 때
  • 구현 계획 실행 전 환경 준비 시

Quick Start

# 1. worktree 디렉토리 확인/생성
ls -la ../worktrees/ 2>/dev/null || mkdir -p ../worktrees

# 2. 새 worktree 생성
git worktree add ../worktrees/feature-name -b feature/feature-name

# 3. worktree로 이동
cd ../worktrees/feature-name

# 4. 작업 완료 후 정리
git worktree remove ../worktrees/feature-name

Directory Selection Strategy

권장 구조

project-root/
├── .git/                    # 메인 저장소
├── src/                     # 메인 작업 디렉토리
└── ...

../worktrees/                # worktree 전용 디렉토리
├── feature-auth/           # 인증 기능 작업
├── feature-api/            # API 개발
└── hotfix-critical/        # 긴급 수정

네이밍 규칙

../worktrees/{type}-{name}

types:
- feature-*    기능 개발
- hotfix-*     긴급 수정
- experiment-* 실험적 변경
- review-*     코드 리뷰용

Safety Verification

생성 전 체크리스트

# 1. 현재 상태 확인
git status                    # 미커밋 변경사항 확인
git stash list               # stash 상태 확인

# 2. 브랜치 존재 여부 확인
git branch -a | grep feature-name

# 3. worktree 목록 확인
git worktree list

생성 후 검증

# 1. worktree 상태 확인
git worktree list

# 2. 현재 브랜치 확인
git branch

# 3. 원격 연결 확인
git remote -v

Common Workflows

기능 개발 시작

# 1. 최신 main 기준으로 worktree 생성
git fetch origin
git worktree add ../worktrees/feature-x -b feature/x origin/main

# 2. 의존성 설치 (프로젝트에 따라)
cd ../worktrees/feature-x
npm install  # 또는 pip install -r requirements.txt

# 3. 개발 시작
code .  # 또는 원하는 에디터

코드 리뷰용 환경

# PR 브랜치를 별도 worktree로
git worktree add ../worktrees/review-pr-123 origin/feature/pr-123
cd ../worktrees/review-pr-123
# 테스트 실행, 코드 검토

긴급 수정

# 현재 작업 중단 없이 hotfix
git worktree add ../worktrees/hotfix-critical -b hotfix/critical origin/main
cd ../worktrees/hotfix-critical
# 수정 → 커밋 → PR

Cleanup

개별 worktree 제거

# 1. worktree 제거
git worktree remove ../worktrees/feature-x

# 2. 브랜치도 삭제하려면
git branch -d feature/x

전체 정리

# 1. 모든 worktree 목록
git worktree list

# 2. 정리 (삭제된 worktree 참조 제거)
git worktree prune

# 3. 미사용 worktree 디렉토리 삭제
rm -rf ../worktrees/old-feature
git worktree prune

Best Practices

  1. 일관된 위치: worktree는 항상 ../worktrees/
  2. 명확한 네이밍: 목적이 드러나는 이름 사용
  3. 정기적 정리: 완료된 worktree는 즉시 제거
  4. 독립적 의존성: 각 worktree에서 별도로 의존성 설치
  5. 메인 저장소 보존: worktree에서만 실험적 변경

Troubleshooting

문제해결책
"already checked out"다른 worktree에서 사용 중, 다른 브랜치명 사용
"not a valid ref"git fetch 먼저 실행
의존성 오류worktree에서 새로 설치 필요
변경사항 충돌메인에서 stash 또는 commit 후 진행

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.