Skip to content

gh pr checkout default should be the same as gh pr list, and optionally also support --limit #11111

Open

Description

@kahlstrm

Describe the feature or problem you’d like to solve

Before gh pr checkout had the interactive mode support added, I had a DIY version of it:

gh pr list | fzf | awk '{print $1}' | xargs gh pr checkout

That worked quite well, but I have started using gh pr checkout interactive mode instead.

However, I noticed that the number of PRs listed with the new interactive mode is limited to 10, and that value is hardcoded. In contrast, the old version's default seems to be 30 and can even be overridden with the --limit flag.

Proposed solution

Either change the default limit to match gh pr list, add --limit support to gh pr checkout interactive mode, or both.

How will it benefit CLI and its users?
Users can have a more flexible way of using the gh pr checkout interactive mode.

Additional Context

I have already a local checkout with these changes, but noticed the CONTRIBUTING.md after implementing this.

Activity

  1. williammartin commented on Jun 16, 2025

    @williammartin
    Member

    @BagToad I think you did the original implementation of this, would you mind triaging it since you probably have context on the current behaviour.

  2. BagToad commented on Jun 16, 2025

    @BagToad
    Member

    Thanks for the issue @kahlstrm 🙏 & thanks for the ping @williammartin

    Here's some context for everyone, before anything actionable:

    This was feedback I knew was coming when we did this because I felt it myself in #9868 (comment) under the "💭 Listing only 10 PRs feels like it might not be enough" heading.

    In that comment, I brought up having a --limit flag, but noted that this is a trailblazing move as other commands that list out things interactively don't have a --limit flag AFAIK. I hesitate on what solution is best here because whatever we choose will no-doubt become the standard and we will be stuck with it.

    I'll also just note that the 10 pull request limit comes from alignment with run view which is a bit of a closer partner than pr list because run view is prompting for a thing and then doing something with the selection, just like we are with pr checkout here. I'm not saying I like 10 or that I like 30 instead, but that's context on where it came from. To be honest, I think raising this to 30 would still be a band-aid.


    Moving forward, I think it would be good to get the rest of the maintainer team's opinion on --limit since that seems to be the most ideal solution to me right now. Please see #9868 (comment) for other options, if interested.

    @cli/code-reviewers:

    • How do you feel about the --limit flag controlling how many items come out in an interactive prompt like when gh pr checkout and run view are run with no args?
    • Do you have any concerns with this becoming a standard form factor for commands that do this?
    • Does this feel like something we want a differently named flag for?
  3. added
    needs-designAn engineering task needs design to proceed
    and removed on Jun 16, 2025
  4. BagToad commented on Jun 16, 2025

    @BagToad
    Member

    💭 In the meantime, I'm considering this triaged and pending the team's investigation and feedback.

  5. kahlstrm commented on Jun 16, 2025

    @kahlstrm
    Author

    Thanks for the issue @kahlstrm 🙏 & thanks for the ping @williammartin

    Here's some context for everyone, before anything actionable:

    This was feedback I knew was coming when we did this because I felt it myself in #9868 (comment) under the "💭 Listing only 10 PRs feels like it might not be enough" heading.

    In that comment, I brought up having a --limit flag, but noted that this is a trailblazing move as other commands that list out things interactively don't have a --limit flag AFAIK. I hesitate on what solution is best here because whatever we choose will no-doubt become the standard and we will be stuck with it.

    I'll also just note that the 10 pull request limit comes from alignment with run view which is a bit of a closer partner than pr list because run view is prompting for a thing and then doing something with the selection, just like we are with pr checkout here. I'm not saying I like 10 or that I like 30 instead, but that's context on where it came from. To be honest, I think raising this to 30 would still be a band-aid.

    Moving forward, I think it would be good to get the rest of the maintainer team's opinion on --limit since that seems to be the most ideal solution to me right now. Please see #9868 (comment) for other options, if interested.

    @cli/code-reviewers:

    • How do you feel about the --limit flag controlling how many items come out in an interactive prompt like when gh pr checkout and run view are run with no args?
    • Do you have any concerns with this becoming a standard form factor for commands that do this?
    • Does this feel like something we want a differently named flag for?

    Thanks for the reply and background!

    To be honest, I think raising this to 30 would still be a band-aid.

    I agree, as I was just finding a middle ground for past of the least effort to get rid of my problem 😄.

    Also, if there are several of these interactive lists that are considered, then perhaps a design decision could be made to about having the behavior similarity with commands close in terms of context (pr list and pr checkout) or in terms of behavior (the interactive part of pr checkout and run view). In either case a good idea would be to add a constant value that would be used for all of these to document this relation. Just an idea that came to mind 😄

    As said, I've already implemented a version with --limit of this in my fork, but I guess the limit would also be required for run view as well given the similar nature🤔

  6. BagToad commented on Feb 6, 2026

    @BagToad
    Member

    Coming back to this after having implemented a new prompt type that is coming up in our next release - it's a multiselect that includes a search option for gh pr edit assignees and reviewers, and it looks like this:

    ? Reviewers  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
    > [ ]  Search (43 more)
      [x]  cli/code-reviewers
      [x]  babakks (Babak K. Shandiz)
      [x]  BagToad (Kynan Ware)
    

    I think I'd like to have a similar UX here for gh pr checkout that uses a single select prompt and presents a search option. Since displaying a larger list of PRs doesn't completely solve the problem - it only makes the list more unweildly - I think we need to do something like this to make gh pr checkout without an arg truly practical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-prrelating to the gh pr commandneeds-designAn engineering task needs design to proceedneeds-investigationCLI team needs to investigate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions