worktree
From rtk-ai
Git Worktree Setup for RTK (Rust project)
Install
/worktreeFacts
- Repository
- rtk-ai/rtk
- Status
- Actively maintained
- Last commit
- Model
- haiku
- Source file
- .claude/commands/tech/worktree.md
Source preview
The instructions Claude Code reads when this command runs.
# Git Worktree Setup
Create isolated git worktrees with instant feedback and background Rust verification.
**Performance**: ~1s setup + background `cargo check` (non-blocking)
## Usage
```bash
/worktree feature/new-filter # Creates worktree + background cargo check
/worktree fix/typo --fast # Skip cargo check (instant)
/worktree feature/big-refactor --check # Wait for cargo check (blocking)
```
**Branch naming**: Always use `category/description` with a slash.
- `feature/new-filter` -> branch: `feature/new-filter`, dir: `.worktrees/feature-new-filter`
- `fix/bug-name` -> branch: `fix/bug-name`, dir: `.worktrees/fix-bug-name`
## Implementation
Execute this **single bash script** with branch name from `$ARGUMENTS`:
```bash
#!/bin/bash
set -euo pipefail
trap 'kill $(jobs -p) 2>/dev/null || true' EXIT
# Resolve main repo root (works from worktree too)
GIT_COMMON_DIR="$(git rev-parse --git-common-dir 2>/dev/null)"
if [ -z "$GIT_COMMON_DIR" ]; then
echo "Not in a git repository"
exit 1
fi
REPO_ROOT="$(cd "$GIT_COMMON_DIR/.." && pwd)"
# Parse flags
RAW_ARGS="$ARGUMENTS"
BRANCH_NAME="$RAW_ARGS"
SKIP_CHECK=false
BLOCKING_CHECK=false
if [[ "$RAW_ARGS" == *"--fast"* ]]; then
SKIP_CHECK=true
BRANCH_NAME="${BRANCH_NAME// --fast/}"
fi
if [[ "$RAW_ARGS" == *"--check"* ]]; then
BLOCKING_CHECK=true
BRANCH_NAME="${BRANCH_NAME// --check/}"
fi
# Validate bView full source on GitHub →Other slash commands
feature-development
★ 229,918Workflow command scaffold for feature-development in everything-claude-code.
affaan-mupdated 15d agoMITdatabase-migration
★ 229,918Workflow command scaffold for database-migration in everything-claude-code.
affaan-mupdated 15d agoMITadd-language-rules
★ 229,918Workflow command scaffold for add-language-rules in everything-claude-code.
affaan-mupdated 15d agoMITcommit-push-pr
★ 137,934Commit, push, and open a PR
anthropicsupdated 14d agodedupe
★ 137,934Find duplicate GitHub issues
anthropicsupdated 14d agotriage-issue
★ 137,934Triage GitHub issues by analyzing and applying labels
anthropicsupdated 14d ago