l-init-wt
Initialize a git worktree for the project with proper symlinks. Use when: (1) User says 'init worktree' or 'init wt', (2) Setting up a new worktree for parallel development.
Initialize Git Worktree
Create a git worktree with the specified directory name and optional base branch.
Arguments
$ARGUMENTSformat:{dirName} [baseBranch]dirName(required): Name for the worktree directorybaseBranch(optional): Base branch to create from. If not specified, uses current branch.
Examples
/init-wt d0116-fix-bugs origin/main # Create from origin/main
/init-wt d0116-fix-bugs # Create from current branch
Workflow
- Parse arguments to extract
dirNameand optionalbaseBranch - Run
pnpm run init-worktree {dirName} [baseBranch] - Report the result
Execution
# With base branch
pnpm run init-worktree {dirName} {baseBranch}
# Without base branch (uses current branch)
pnpm run init-worktree {dirName}
Output
After successful creation, output:
- The worktree path:
worktrees/{dirName}/ - Command to navigate:
cd worktrees/{dirName}
Notes
- The
init-worktreescript handles symlink setup for.envfiles - If baseBranch is not specified, the worktree is created from the current branch
- For remote branches, always pull latest before creating worktree