← スキル一覧に戻る

git-worktrees
by erikpr1994
⭐ 0🍴 0📅 2026年1月22日
SKILL.md
name: git-worktrees description: "Use for parallel branch development with workspace isolation."
Git Worktrees
Work on multiple branches simultaneously. Each worktree = isolated workspace.
Workflow
FETCH -> git fetch origin (ensure latest remote state)
LOCATE -> Find .worktrees/ or worktrees/
VERIFY -> Ensure directory is gitignored
CREATE -> git worktree add .worktrees/name origin/main -b branch/name
SETUP -> Install dependencies
BASELINE -> Verify tests pass
WORK -> Implement in isolation
CLEANUP -> git worktree remove when done
Create Worktree
# ALWAYS fetch first to get latest remote state
git fetch origin
# Check existing directories
ls -d .worktrees worktrees 2>/dev/null
# Verify gitignored
git check-ignore -q .worktrees || echo ".worktrees/" >> .gitignore
# Create from origin/main (NOT local main) to ensure latest code
git worktree add .worktrees/feature-auth origin/main -b feature/auth
cd .worktrees/feature-auth
# Setup
[ -f package.json ] && npm install
# Baseline
npm test # Must pass before changes
Why origin/main? Local main may be behind remote. Always base new work on the latest remote state to avoid merge conflicts and building on stale code.
Cleanup
cd /path/to/main/repo
git worktree remove .worktrees/feature-auth
git branch -d feature/auth # If merged
Commands
git worktree list # List all
git worktree add .worktrees/fix bugfix/123 # Existing branch
git worktree remove .worktrees/feature # Remove
git worktree prune # Clean stale
Decision Criteria
| Situation | Action |
|---|---|
| Feature needs isolation | Create worktree |
| Quick one-file fix | Regular branch |
| Baseline tests fail | Ask user before proceeding |
| Work complete | Remove worktree |
Red Flags
- Skipping
git fetch originbefore creating worktree - Creating from local
maininstead oforigin/main - Creating without verifying gitignored
- Proceeding with failing baseline
- Leaving stale worktrees
Pairs with: pr-workflow, commit-discipline, tdd
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です