Skip to main content

git-wtpr

Opens or deletes a git-wt worktree for a GitHub pull request. Use when creating, switching to, or removing a PR worktree.

来源信息

仓库
ryoppippi/dotfiles
最近来源活动
2026年7月25日 19:23
检测到的 SKILL.md 语言
英语
星标
268
Forks
5

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
git-wtpr
description
Opens or deletes a git-wt worktree for a GitHub pull request. Use when creating, switching to, or removing a PR worktree.
# Git Worktrees for Pull Requests (git-wtpr) Use `git wtpr` to create or switch to a worktree checked out at a PR head. Builds on `git-wt` — prefer this over `gh pr checkout` when isolation in a worktree is needed. ## Usage ```sh git wtpr <number|url> [git-wt flags...] git wtpr <number|url> -d | -D ``` Examples: ```sh git wtpr 25 git wtpr https://github.com/owner/repo/pull/3984 git wtpr 25 -D # remove that PR worktree ``` Interactive use (with `git-wtpr --init fish`) **cds into the worktree**, same as `git wt`. Do not pass `--nocd` unless you only need the path. Confirm availability with `command -v git-wtpr` or `git-wtpr --help`. ## Behaviour 1. Resolves the PR with `gh pr view` (number or URL). 2. Ensures the current clone matches the PR repository. 3. Fetches `pull/<n>/head` from the remote. 4. Creates or switches a worktree via `git wt` on the PR head branch name. 5. If the head branch is `main`/`master`, uses `pr-<number>` instead. 6. Shell integration cds into that worktree (unless `--nocd` / `wt.nocd`). Status goes to stderr. The worktree path is the last stdout line. With `-d` (safe) or `-D` (force) the PR worktree and its branch are deleted instead — the PR is still resolved to get the branch name, but step 3 is skipped. ## Workflow for agents 1. Run from the correct repository clone (not a random directory). 2. Use `git wtpr --nocd <pr>` — shell `cd` does not persist across tool calls, so capture the printed path and use it as the working directory. 3. Verify inside the worktree: `git branch --show-current` and `git status --short`. 4. To clean up afterwards, run `git wtpr <pr> -D` from the same clone (or `git wt -D <branch>`). For other lifecycle operations (list, rename), use the `git-wt` skill. ## Related - `git-wt` skill for worktree create/switch/delete/rename - `agents/shared/git-worktrees.md` for when not to create a new worktree
在 GitHub 查看