GitHub CLI 速查表
GitHub CLI 让你在终端中完成所有 GitHub 操作:克隆、创建 PR、审核代码、管理 Issue、触发 Actions。
更新: 2026-07-20·21 条命令
快速开始
``bash
gh auth login
gh repo create my-project --public
gh pr create --fill
gh pr list --state open
gh run list --limit 5
``
启动模式(21)
| 命令 | 难度 | ||
|---|---|---|---|
gh --help显示 gh 帮助 | 基础 | gh --help | |
gh auth login登录 GitHub 账号 | 基础 | gh auth login | |
gh auth status查看登录状态 | 基础 | gh auth status | |
gh repo clone克隆仓库到本地 | 基础 | gh repo clone cli/cli | |
gh repo create创建新仓库(本地+远程) | 基础 | gh repo create my-project --public | |
gh repo forkFork 一个仓库 | 基础 | gh repo fork cli/cli | |
gh pr create创建 Pull Request | 基础 | gh pr create --title 'Fix bug' --body 'Description' | |
gh pr list列出 Pull Request | 基础 | gh pr list --state open | |
gh pr checkout切换到 PR 的本地分支 | 基础 | gh pr checkout 42 | |
gh pr review提交 PR 审核 | 中级 | gh pr review 42 --approve | |
gh pr merge合并 PR | 中级 | gh pr merge 42 --squash | |
gh issue list列出 Issue | 基础 | gh issue list --label bug | |
gh issue create创建 Issue | 基础 | gh issue create --title 'Bug report' --body '...' | |
gh issue close关闭 Issue | 基础 | gh issue close 123 | |
gh run list列出 Actions 工作流运行 | 中级 | gh run list --limit 10 | |
gh run watch实时查看 Actions 运行日志 | 中级 | gh run watch 1234 | |
gh release list列出发布版本 | 基础 | gh release list | |
gh release download下载发布版本中的资源 | 中级 | gh release download v1.0 --pattern '*.tar.gz' | |
gh gist create创建 Gist | 基础 | gh gist create script.py --public | |
gh search repos搜索仓库 | 中级 | gh search repos 'topic:rag language:python' --limit 20 | |
gh config set设置 git 配置项 | 中级 | gh config set git_protocol ssh |
本速查表数据整理自各工具官方文档。最后更新: 2026-07-20。