github-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub PR Tool

GitHub PR 工具

Fetch and merge GitHub pull requests into your local branch. Perfect for:
  • Trying upstream PRs before they're merged
  • Incorporating features from open PRs into your fork
  • Testing PR compatibility locally
将GitHub拉取请求(PR)获取并合并到你的本地分支。适用于:
  • 在PR合并前试用上游的PR
  • 将开放PR中的功能整合到你的分支中
  • 本地测试PR的兼容性

Prerequisites

前提条件

  • gh
    CLI authenticated (
    gh auth login
    )
  • Git repository with remotes configured
  • 已认证的
    gh
    CLI(执行
    gh auth login
  • 已配置远程仓库的Git仓库

Commands

命令

Preview a PR

预览PR

bash
github-pr preview <owner/repo> <pr-number>
Shows PR title, author, status, files changed, CI status, and recent comments.
bash
github-pr preview <owner/repo> <pr-number>
显示PR标题、作者、状态、变更文件、CI状态以及最新评论。

Fetch PR branch locally

在本地获取PR分支

bash
github-pr fetch <owner/repo> <pr-number> [--branch <name>]
Fetches the PR head into a local branch (default:
pr/<number>
).
bash
github-pr fetch <owner/repo> <pr-number> [--branch <name>]
将PR的头部获取到本地分支(默认:
pr/<number>
)。

Merge PR into current branch

将PR合并到当前分支

bash
github-pr merge <owner/repo> <pr-number> [--no-install]
Fetches and merges the PR. Optionally runs install after merge.
bash
github-pr merge <owner/repo> <pr-number> [--no-install]
获取并合并PR。可选择在合并后执行安装操作。

Full test cycle

完整测试流程

bash
github-pr test <owner/repo> <pr-number>
Fetches, merges, installs dependencies, and runs build + tests.
bash
github-pr test <owner/repo> <pr-number>
获取、合并、安装依赖,并运行构建和测试。

Examples

示例

bash
undefined
bash
undefined

Preview MS Teams PR from clawdbot

预览来自clawdbot的MS Teams PR

github-pr preview clawdbot/clawdbot 404
github-pr preview clawdbot/clawdbot 404

Fetch it locally

在本地获取该PR

github-pr fetch clawdbot/clawdbot 404
github-pr fetch clawdbot/clawdbot 404

Merge into your current branch

将其合并到你的当前分支

github-pr merge clawdbot/clawdbot 404
github-pr merge clawdbot/clawdbot 404

Or do the full test cycle

或者执行完整测试流程

github-pr test clawdbot/clawdbot 404
undefined
github-pr test clawdbot/clawdbot 404
undefined

Notes

注意事项

  • PRs are fetched from the
    upstream
    remote by default
  • Use
    --remote <name>
    to specify a different remote
  • Merge conflicts must be resolved manually
  • The
    test
    command auto-detects package manager (npm/pnpm/yarn/bun)
  • 默认从
    upstream
    远程仓库获取PR
  • 使用
    --remote <name>
    指定其他远程仓库
  • 合并冲突需要手动解决
  • test
    命令会自动检测包管理器(npm/pnpm/yarn/bun)