Repository navigation
Use the tracked organization-owned fork as the pull request head #14511
Description
Activity
This is a clear, well-specified enhancement request (one of three sibling sub-issues of #10093, alongside #14510 and #14512), so I found no duplicates. I'm suggesting
enhancementandgh-prlabels.A concrete starting point for investigation:
gh pr create's "skip push" path already resolves the head repo from tracked git remote/branch config viaTryDetermineDefaultPRHead, but when building the qualified head ref for the API it only prefixes the owner whenheadRepo.RepoOwner() != baseRepo.RepoOwner()— see. Since an organization-owned fork can share the same owner as the upstream repository (the scenario this issue calls out), that owner check fails to distinguish the fork from upstream, so the qualifier gets dropped even though the resolvedcli/pkg/cmd/pr/create/create.go
Lines 933 to 936 in a3d31e2
qualifiedHeadRef := shared.NewQualifiedHeadRefWithoutOwner(defaultPRHead.BranchName) if headRepo.RepoOwner() != baseRepo.RepoOwner() { qualifiedHeadRef = shared.NewQualifiedHeadRef(headRepo.RepoOwner(), defaultPRHead.BranchName) } headRepocorrectly points at the fork. That looks like the mechanism this issue wants changed: the qualifier should be based on whetherheadRepoandbaseRepoare the same repository (e.g.ghrepo.IsSame), not merely the same owner.Generated by Issue Triage (skills-driven) for #14511 · copilot · auto · 46.1 AIC · ⌖ 2.2 AIC · ⊞ 10.9K · ◷
- addedenhancementa request to improve CLIa request to improve CLIgh-prrelating to the gh pr commandrelating to the gh pr command
on Sep 24, 2026 github-actions commented
on Sep 24, 2026 on Sep 24, 2026 – with GitHub ActionsContributorMore actionsThank 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.
Describe the feature or problem you’d like to solve
An organization can own more than one fork that could supply a pull request branch. An organization and branch alone are therefore not always enough to identify the contributor’s intended head repository.
As a contributor working in an organization with multiple forks, I want to identify the exact head repository, so that the pull request is created from the fork I intended.
Proposed solution
Allow
gh pr create --head ORGANIZATION/REPOSITORY:BRANCHto identify the exact organization-owned head repository. When--webis used, translate that value into GitHub’s repository-qualified compare syntax so the pull request form opens with the intended head repository and branch selected.Additional context
This is a sub-issue of #10093.
GitHub’s compare flow represents an exact fork as
OWNER:REPOSITORY:BRANCH. For example,other-org/upstream-fork:feature-branchcan be rendered in the compare URL asother-org:upstream-fork:feature-branch.Supporting evidence:
The syntax is documented for GHES 3.10 and newer. All currently supported GHES versions are newer than that; the exact implementation floor for older, unsupported GHES releases is unknown.