You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pr checkout <full PR url> should exit if the PR is in a completely different repo #15099
Describe the feature or problem you’d like to solve
If you're in repo-a, and you run the command gh pr co https://github.com/example/repo-b/pull/1234, it'll check out the tracked contents repo-b in your repo-a working directory even though they're completely different repos.
Proposed solution
This is probably easier said than done, but detect if I pasted the link to a PR in a completely unrelated repo and refuse to check it out (maybe with a flag to force it?). I think easiest way to implement might be: if the repo in the command argument isn't already configured as a remote, check whether it is a fork of any of the configured remotes.
Additional context
I'm jumping between PRs and terminal tabs really frequently these days, I have accidentally pasted the wrong PR URL into my shell and checked out a completely unrelated repo twice now. I know it's user error, but it's also a behavior that I can't really think of a valid use case for.
Thanks for the clear use case. GitHub CLI 2.105.0 accepts a pull request URL from another repository and does not provide a repository-relationship safety check or override flag. The request is therefore a real gap: when the selected pull request's base repository is unrelated to the current checkout, gh pr checkout can fetch it into the current working tree. A useful guard would distinguish an unrelated repository from the normal fork case while preserving an explicit way to proceed. This is ready to be considered as an enhancement to gh pr checkout.
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 wantedContributions 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.
Hi @cli/code-reviewers! I noticed that "gh pr checkout" can check out a PR from an unrelated repository into the current working tree. Would the team consider accepting a repository-relationship safety check, and could you clarify the acceptance criteria and whether this could be marked "help wanted"? I won't start an external PR without that approval.
Activity
cli-triage commentedon Nov 18, 2026
Thanks for the clear use case. GitHub CLI 2.105.0 accepts a pull request URL from another repository and does not provide a repository-relationship safety check or override flag. The request is therefore a real gap: when the selected pull request's base repository is unrelated to the current checkout,
gh pr checkoutcan fetch it into the current working tree. A useful guard would distinguish an unrelated repository from the normal fork case while preserving an explicit way to proceed. This is ready to be considered as an enhancement togh pr checkout.Supporting reports
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
github-actions commentedon Nov 18, 2026
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 wantedContributions 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.
chirag-gupta7 commentedon Nov 19, 2026
Hi @cli/code-reviewers! I noticed that "gh pr checkout" can check out a PR from an unrelated repository into the current working tree. Would the team consider accepting a repository-relationship safety check, and could you clarify the acceptance criteria and whether this could be marked "help wanted"? I won't start an external PR without that approval.