Skip to content

gh pr checkout should allow you to provide a path to checkout to #12984

Open

Description

@kilasuit

Describe the bug

gh pr checkout should allow you to provide a path to checkout to & not need to be the current path

Affected version

gh version 2.88.1 (2026-03-12)
https://github.com/cli/cli/releases/tag/v2.88.1

Steps to reproduce the behavior

gh pr checkout 27032 --repo PowerShell/PowerShell C:\ps\pr\27032

Expected vs actual behavior

Expected

command runs and clones the pr branch only to this path

Actual

accepts at most 1 arg(s), received 2

Logs

as above

workaround

create the directory -> cd into it -> clone repo -> run gh checkout

Activity

  1. BagToad commented on Mar 21, 2026

    @BagToad
    Member

    Hey @kilasuit thank you for the write up - could you talk more about your use-case?

    I'm wondering if we added worktree support, that would actually be more ideal for you?

  2. added
    more-info-needed
    on Mar 21, 2026
  3. kilasuit commented on Mar 23, 2026

    @kilasuit
    Author

    @BagToad -I wouldn't be opposed to worktree support as I see where it could be of use in future.

    I hope the below expanded usecase helps

    The full usecase is

    As a user of a tool & one that I may contribute to or perhaps don't currently contribute to but may want to from checking out the current PR to a custom path at point of checkout, like other git commands allow to map that user experience.

    • This could be because the PR contains changes that should fix a bug that I may be experiencing & I want to confirm whether it does or not.
    • Alternatively, the PR may have stalled and as such I either have been asked to by maintainers to start from this existing point & I want to add to the initial work done as part of the PR to give the original PR creator credit for the work they did initially.
    • I want to run this from any path on my system and this not output into my Current Working Directory.

    The latter of the two however has the issue of potentially needing lots more behind the scenes git work to achieve like setting up the additional remote from the PR Author's fork, which I dnot's but with potential new flags to gh checkout this should be doable.

  4. removed
    more-info-needed
    on Mar 23, 2026
  5. added
    enhancement
    gh-pr
    on Mar 30, 2026
  6. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  7. removed
    needs-triage
    on Mar 30, 2026
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

    enhancementgh-prstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions