mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 11:02:01 -04:00
Adds a `pnpm worktree:new <branch>` script that creates a git worktree as a sibling directory of the repo root, with branch slashes replaced by dashes (e.g. `feat/foo` → `../feat-foo`). Shell helpers in `shell/wt.fish` and `shell/wt.sh` wrap the script to also `cd` into the new worktree. Documents setup and usage in CONTRIBUTING.md.
11 lines
311 B
Bash
11 lines
311 B
Bash
# Worktree helper for bash/zsh.
|
|
# Add to your shell config:
|
|
# source /path/to/pnpm/shell/wt.sh
|
|
#
|
|
# Usage:
|
|
# wt <branch-name> — create a worktree for a branch and switch to it
|
|
# wt <pr-number> — create a worktree for a GitHub PR and switch to it
|
|
wt() {
|
|
cd "$(pnpm worktree:new "$@" | tail -1)"
|
|
}
|