diff --git a/README.md b/README.md index afaf99e..5aa3648 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,17 @@ Create a new worktree for a feature branch and open it instantly in a new tab: hypr my-feature ``` +### Review a pull request + +Open a GitHub PR in a dedicated worktree, including PRs from forks: + +```bash +hypr pr 123 +hypr pr https://github.com/owner/repository/pull/123 +``` + +Requires an authenticated GitHub CLI (`gh`). Reopening a PR preserves your local work. + ### Cleanup Clean up old worktrees. `hypr` checks if branches are merged or if their PRs are closed. diff --git a/docs/clireference.md b/docs/clireference.md index 12f1cfa..4d059ed 100644 --- a/docs/clireference.md +++ b/docs/clireference.md @@ -47,6 +47,33 @@ Branch names are sanitized for the filesystem - slashes become hyphens. For exam You can customize this with the `directory_pattern` setting (see [Configuration](configuration.md)), which supports template variables like `{repo_name}`, `{branch}`, `{repo_parent_dir}`, and environment variables. For example, to organize all worktrees in a central location: `~/.worktrees/{repo_name}/{branch}`. +## `hypr pr ` + +Open a GitHub pull request in its own worktree. Requires the GitHub CLI (`gh`), +authenticated with access to the repository, and Git access to the configured remote. + +```bash +hypr pr 123 +hypr pr https://github.com/owner/repository/pull/123 +hypr pr 123 --terminal vscode --after-init "npm test" -y +``` + +The PR's base repository must match a configured remote. Forked PRs are fetched +through the base repository's PR ref, so no fork remote is needed. A dedicated +local branch named `pr-123` keeps review work separate from the contributor's branch. +An unrelated existing branch with that name is rejected. + +Running the command again opens the existing worktree and preserves local commits +and uncommitted changes. It does not update the branch to the latest PR revision. +The existing create hooks and session initialization settings apply. + +| Option | Description | +| --- | --- | +| `--dir ` | Override the directory pattern when creating a worktree. | +| `--terminal ` | Override the terminal mode. | +| `--after-init