Skip to content

gh pr list: no support for --head <owner>:<branch> syntax #10945

@muzimuzhi

Description

@muzimuzhi

Describe the bug

gh pr list only supports the --head <branch> syntax but not --head <owner>:<branch>.

Meanwhile, gh pr create --head <owner>:<branch> is supported since v2.71.0 (added by #10513 in fixing #575).

Need to check other options which accept a branch name.

https://cli.github.com/manual/gh_pr_list
https://cli.github.com/manual/gh_pr_create

Affected version

gh version 2.72.0 (2025-04-30)
https://github.com/cli/cli/releases/tag/v2.72.0

Steps to reproduce the behavior

--head "typos" finds two closed PRs in latex3/latex repository.

$ GH_PAGER="" gh -R latex3/latex3 pr list --state all --head "typos"

Showing 2 of 2 pull requests in latex3/latex3 that match your search

ID     TITLE                                         BRANCH             CREATED AT
#1610  fix small typos                               mbertucci47:typos  about 6 months ago
#392   Typos in the intro to the l3tl documentation  EvanAad:typos      about 7 years ago

But when specific owner name is provided (`--head ":typos"), no PR is found.

$ GH_PAGER="" gh -R latex3/latex3 pr list --state all --head "mbertucci47:typos"
no pull requests match your search in latex3/latex3
$ GH_PAGER="" gh -R latex3/latex3 pr list --state all --head "EvanAad:typos"
no pull requests match your search in latex3/latex3

Logs

Adding GH_DEBUG=api, it seems the only useful info is that the <owner>:<branch> was correctly passed on to GraphQL variables

$ GH_DEBUG=api GH_PAGER="" gh -R latex3/latex3 pr list --state all --head "mbertucci47:typos"

[...] 
GraphQL variables: {"headBranch":"mbertucci47:typos","limit":30,"owner":"latex3","repo":"latex3","state":["OPEN","CLOSED","MERGED"]}
[...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLIgh-prrelating to the gh pr command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions