Create a Git worktree from a GitHub PR for local testing
Creates a Git worktree from a GitHub PR for isolated testing with dependencies installed.
/plugin marketplace add horuz-ai/claude-plugins/plugin install core@horuz<pr-number>git/pwdgit rev-parse --show-toplevel 2>/dev/null || echo "Not in a git repo"git worktree list 2>/dev/null || echo "No worktrees"ls -la .env* 2>/dev/null || echo "No .env files found"which gh 2>/dev/null && gh auth status 2>&1 | head -3 || echo "gh CLI not found or not authenticated"123)Create a Git worktree from an existing GitHub Pull Request for local testing.
Fetch PR information:
gh pr view $1 --json headRefName,title,number to get PR detailsheadRefNameFetch the PR branch:
gh pr checkout $1 --detach first to fetch the refs (then go back)git fetch origin pull/$1/head:pr-$1Create the worktree:
pr-$1 (e.g., pr-123)../pr-$1git worktree add ../pr-$1 pr-$1 (using the fetched branch)Copy environment files:
.env* files to the new worktree: cp .env* ../pr-$1/Install dependencies:
cd ../pr-$1pnpm installOpen in Cursor:
cursor ../pr-$1 to open the PR worktree in CursorReport success:
/wt-remove pr-$1 to clean up"gh CLI to be installed and authenticated