gh pr list

gh pr list [flags]

列出 GitHub 仓库中的拉取请求。

搜索查询语法在此处记录:https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests

选项

--app <string>
按 GitHub App 作者筛选
-a, --assignee <string>
按分配者筛选
-A, --author <string>
按作者筛选
-B, --base <string>
按基分支筛选
-d, --draft
按草稿状态筛选
-H, --head <string>
按头部分支筛选
-q, --jq <expression>
使用 jq 表达式过滤 JSON 输出
--json <fields>
输出具有指定字段的 JSON
-l, --label <strings>
按标签筛选
-L, --limit <int> (default 30)
要获取的最大项目数
-S, --search <query>
使用查询搜索拉取请求
-s, --state <string> (default "open")
按状态筛选:{open|closed|merged|all}
-t, --template <string>
使用 Go 模板格式化 JSON 输出;请参阅“gh help formatting”
-w, --web
在 Web 浏览器中列出拉取请求

从父命令继承的选项

-R, --repo <[HOST/]OWNER/REPO>
使用 [HOST/]OWNER/REPO 格式选择另一个存储库

别名

gh pr ls

JSON 字段

additions, assignees, author, autoMergeRequest, baseRefName, body, changedFiles, closed, closedAt, comments, commits, createdAt, deletions, files, headRefName, headRefOid, headRepository, headRepositoryOwner, id, isCrossRepository, isDraft, labels, latestReviews, maintainerCanModify, mergeCommit, mergeStateStatus, mergeable, mergedAt, mergedBy, milestone, number, potentialMergeCommit, projectCards, projectItems, reactionGroups, reviewDecision, reviewRequests, reviews, state, statusCheckRollup, title, updatedAt, url

示例

List PRs authored by you
$ gh pr list --author "@me"

List only PRs with all of the given labels
$ gh pr list --label bug --label "priority 1"

Filter PRs using search syntax
$ gh pr list --search "status:success review:required"

Find a PR that introduced a given commit
$ gh pr list --search "<SHA>" --state merged
 	

另请参阅

正在使用中

默认行为

您将看到最新的 30 个打开的项目。

# Viewing a list of open pull requests
~/Projects/my-project$ gh pr list

Pull requests for owner/repo

#14  Upgrade to Prettier 1.19                           prettier
#14  Extend arrow navigation in lists for MacOS         arrow-nav
#13  Add Support for Windows Automatic Dark Mode        dark-mode
#8   Create and use keyboard shortcut react component   shortcut

~/Projects/my-project$

使用标志过滤

您可以使用标志来过滤列表以满足您的特定用例。

# Viewing a list of closed pull requests assigned to a user
~/Projects/my-project$ gh pr list --state closed --assignee user

Pull requests for owner/repo

#13  Upgrade to Electron 7         electron-7
#8   Release Notes Writing Guide   release-notes

~/Projects/my-project$