Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#14,512 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
cli, go, shell

调研方向

The change involves the gh pr create command. Start by examining the command's argument parsing and the logic for resolving the head repository in the codebase, likely in the pkg/cmd/pr/create directory. Look for existing handling of the --head flag and how it interacts with forks. The feature requires understanding GitHub's API for creating pull requests and how to specify a repository-qualified head. Testing will involve verifying the new syntax works correctly and that the --web flag error is properly implemented.

由索引模型根据 Issue 内容生成。

描述

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.

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.

主要语言
Go
星标
46.3k
派生
9.1k
平均合并
1 天 7 小时
30 天内合并 PR
76

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cli/cli 的其他 Issue

查看 cli/cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。