Git Worktree Setup
Create an isolated git worktree for a feature or fix branch.
Note: This is a documentation-only repo (no node_modules, no type check). Setup is instant.
Usage
bash
/worktree feature/pr-9-skill-improvements # Create worktree from main
/worktree fix/typo-in-guide # Fix branch
/worktree feat/new-section --fast # Skip gitignore checkNaming convention: Always use prefix/description format.
- Branch:
feature/pr-9-skill-improvements - Directory:
.worktrees/feature-pr-9-skill-improvements
Implementation
Execute this script with branch name from $ARGUMENTS:
bash
#!/bin/bash
set -euo pipefail
# Parse flags
RAW_ARGS="${ARGUMENTS:-}"
BRANCH_NAME="$RAW_ARGS"
SKIP_CHECK=false
if [[ "$RAW_ARGS" == *"--fast"* ]]; then
SKIP_CHECK=true
BRANCH_NAME="${BRANCH_NAME// --fast/}"
fi
# Validate branch name
if [ -z "$BRANCH_NAME" ]; then