From cassiiopeia
Automatically generates Git worktrees from branch names and copies sensitive files like .env, google-services.json, and API keys based on .gitignore. Use for isolated branch development and setup.
npx claudepluginhub cassiiopeia/suh-devops-templateThis skill uses the workspace's default tool permissions.
브랜치명을 입력받아 **Git worktree를 자동 생성하고 민감 파일을 복사**하라.
Creates isolated git worktrees for parallel development without disrupting the main workspace. Includes safety verification, .gitignore checks, and directory selection. Use for feature work or PR reviews.
Creates isolated git worktrees for feature branches needing workspace isolation, with smart directory selection, .gitignore safety checks, auto project setup, and baseline verification.
Creates isolated Git worktrees for feature branches with directory selection, .gitignore safety verification, auto project setup for Node/Rust/Python/Go, and baseline tests.
Share bugs, ideas, or general feedback.
브랜치명을 입력받아 Git worktree를 자동 생성하고 민감 파일을 복사하라.
$ARGUMENTS
사용법을 안내하라:
/init-worktree
20260120_#163_Github_Projects_에_대한_템플릿_개발_필요
# 문자 포함 원본 유지)# 프로젝트 루트로 이동
cd [프로젝트_루트]
# Git 긴 경로 지원 (Windows, 최초 1회)
git config --global core.longpaths true
인코딩 문제 해결을 위해 브랜치명을 코드에 직접 포함시킨 임시 파일을 생성한다.
파일명: init_worktree_temp_{timestamp}.py
# -*- coding: utf-8 -*-
import sys, os, shutil, glob
os.chdir('프로젝트_루트_경로')
branch_name = '브랜치명_원본_그대로'
# worktree_manager 실행
sys.path.insert(0, 'scripts') # 플러그인 루트 scripts/
import worktree_manager
os.environ['GIT_BRANCH_NAME'] = branch_name
os.environ['PYTHONIOENCODING'] = 'utf-8'
sys.argv = ['worktree_manager.py']
exit_code = worktree_manager.main()
if exit_code == 0:
import subprocess
result = subprocess.run(['git', 'worktree', 'list', '--porcelain'],
capture_output=True, text=True, encoding='utf-8')
lines = result.stdout.split('\n')
worktree_path = None
for i, line in enumerate(lines):
if line.startswith(f'branch refs/heads/{branch_name}'):
worktree_path = lines[i-1].replace('worktree ', '')
break
if worktree_path:
print(f'WORKTREE_PATH={worktree_path}')
sys.exit(exit_code)
실행 (Windows에서는 -X utf8 필수):
python -X utf8 init_worktree_temp_{timestamp}.py
실행 후 임시 파일 삭제.
Worktree 생성 성공 후 .gitignore를 분석하여 민감 파일을 동적으로 복사한다.
복사 대상 식별 (.gitignore에서):
| 카테고리 | 패턴 |
|---|---|
| Firebase | google-services.json, GoogleService-Info.plist |
| 서명 키 | key.properties, *.jks, *.p12, *.p8, *.mobileprovision |
| 빌드 설정 | Secrets.xcconfig, 민감한 *.xcconfig |
| 환경 변수 | *.env |
| IDE 로컬 | settings.local.json |
복사 규칙:
android/app/google-services.json → worktree/android/app/google-services.json)절대 복사 금지:
build/, target/, .gradle/ (빌드 산출물)node_modules/, Pods/, .dart_tool/ (의존성).report/, .run/, .idea/ (캐시)*.log, *.class, *.pyc (임시 파일)✅ Worktree 생성 완료!
📍 경로: [worktree_path]
📋 복사된 파일:
✅ android/app/google-services.json
✅ ios/Runner/GoogleService-Info.plist
# 문자: Git 브랜치명에서는 원본 유지, 폴더명에서만 _로 변환_로 변환{프로젝트명}-Worktree/ 폴더 (예: RomRom-FE-Worktree)worktree_manager.py를 다음 순서로 탐색:
scripts/worktree_manager.py