Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Use the tracked organization-owned fork as the pull request head

Aperta
#14,511 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, github, go, shell

Direzione di ricerca

Look at the pr create command implementation, likely in pkg/cmd/pr/create/create.go. Understand how the --head flag is parsed and how the compare URL is built for the --web flow. The GitHub compare syntax OWNER:REPOSITORY:BRANCH needs to be integrated. Check existing tests for pr create to see how to add scenarios for organization-owned forks.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-triage
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. When --web is 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.

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 used with web mode
    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 --web`
    Then GitHub’s pull request form opens for "org/upstream"
    And "other-org/upstream-fork" is selected as the head repository
    And "feature-branch" is selected as the head branch
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-branch can be rendered in the compare URL as other-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.

Lingua principale
Go
Stelle
46.3k
Fork
9.1k
Merge medio
1g 7h
PR unite (30g)
76

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cli/cli

Tutte le issue di cli/cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.