Skip to content

Choose a specific organization-owned fork as the pull request head #14512

Open

Description

@williammartin

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:BRANCH to identify the exact organization-owned head repository.

Feature: Choose a specific organization-owned fork as the pull request head

  Scenario: The selected fork belongs to another organization
    Given the base repository is "org/upstream"
    And "other-org/upstream-fork" is a fork of the base repository
    When the contributor runs `gh pr create --head other-org/upstream-fork:feature-branch`
    Then a pull request is created from "other-org/upstream-fork:feature-branch"
    And the pull request targets "org/upstream"

  Scenario: The selected fork belongs to the same organization as the base repository
    Given the base repository is "org/upstream"
    And "org/upstream-fork" is a fork of the base repository
    When the contributor runs `gh pr create --head org/upstream-fork:feature-branch`
    Then a pull request is created from "org/upstream-fork:feature-branch"
    And the pull request targets "org/upstream"

  Scenario: The organization owns multiple candidate forks
    Given the base repository is "org/upstream"
    And "org/upstream-fork" is a fork of the base repository
    And "org/experimental-upstream-fork" is a fork of the base repository
    When the contributor runs `gh pr create --head org/upstream-fork:feature-branch`
    Then a pull request is created from "org/upstream-fork:feature-branch"
    And the pull request targets "org/upstream"

  Scenario: Repository-qualified head is combined with web mode
    When the contributor runs `gh pr create --head other-org/upstream-fork:feature-branch --web`
    Then the command fails before opening a browser
    And the error explains that a repository-qualified `--head` cannot be used with `--web`
    And the error tells the contributor to omit `--web` or select the fork on GitHub

Additional context

This is a sub-issue of #10093.

This issue introduces the repository-qualified ORGANIZATION/REPOSITORY:BRANCH form. The --web behavior may be refined if GitHub’s web pull-request flow can identify the exact head repository.

Activity

  1. cli-triage commented on Sep 23, 2026

    @cli-triage

    Classification: Enhancement (sub-issue of #10093)

    Duplicate Check: No exact duplicates found. This is one of three closely related sibling sub-issues opened alongside it under #10093: #14510 (single unique organization-owned fork via --head ORGANIZATION:BRANCH) and #14511 (tracked-remote fork resolution). #14512 is distinct from both — it specifically covers the fully-qualified --head ORGANIZATION/REPOSITORY:BRANCH form for disambiguating among multiple candidate forks, so it is not a duplicate, just related scope-splitting of the same parent epic.

    Investigation: The --head value is parsed by ParseQualifiedHeadRef, which splits on : into an owner and branchName, where owner is currently expected to be a single user/org login (see QualifiedHeadRef.owner at lines 25-27). Supporting ORGANIZATION/REPOSITORY:BRANCH would require extending this owner segment to optionally carry a repository name (e.g. via ghrepo.Interface) and threading that through fork resolution in pkg/cmd/pr/create/create.go (where qualifiedHeadRef currently only carries an owner, not a full repo). This is a reasonable, well-scoped feature request with clear acceptance criteria (Gherkin scenarios included) and no missing information needed to start engineering review.

    I'm suggesting enhancement and gh-pr labels for this feature request; no priority label applies since it isn't a bug.

    Generated by Issue Triage (skills-driven) for #14512 · copilot · auto · 45 AIC · ⌖ 1.62 AIC · ⊞ 9.5K · ◷

  2. github-actions commented on Sep 24, 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.

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 command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions