Skip to main content

Creating a pull request from a fork

Create a pull request from a fork to propose changes to an upstream repository and collaborate on code effectively.

この機能を使用できるユーザーについて

Anyone with write access to a repository can create a pull request from a user-owned fork. マネージド ユーザーを含む Enterprise のメンバーは、エンタープライズの一部であるリポジトリでのみ変更を提案できます。

Before creating a pull request from a fork, fork the upstream repository and push your changes to a branch in your fork. See リポジトリをフォークする.

In a pull request from a fork, the base branch is where you want to merge your changes, and the compare branch is the branch in your fork that contains your changes. See pull request の作成.

メモ

パブリック リポジトリの pull request を開くには、ヘッドまたはソース ブランチへの書き込みアクセス権が必要です。または、organization が所有するリポジトリの場合は、pull request を開くリポジトリを所有する organization のメンバーである必要があります。

  1. Navigate to the original repository where you created your fork.

  2. ファイルの一覧の上にある黄色のバナーで、 [比較と pull request] をクリックして、関連付けられているブランチの pull request を作成します。

    ファイルの一覧の上にあるバナーのスクリーンショット。

  3. On the page to create a new pull request, click compare across forks.

    Screenshot of the page to open a pull request. The "compare across forks" link is outlined in dark orange.

  4. In the "base branch" dropdown menu, select the branch of the upstream repository where you want to merge changes.

    Screenshot of the page to open a new pull request. The dropdown menus for choosing the base repository and branch are outlined in dark orange.

  5. In the "head fork" dropdown menu, select your fork. Then, use the "compare branch" dropdown menu to select the branch where you made your changes.

    Screenshot of the page to open a new pull request. The dropdown menus for choosing the head repository and compare branch are outlined in dark orange.

  6. プルリクエストのタイトルと説明を入力します。

  7. ユーザーが所有するフォークで、上流のリポジトリに対する push アクセス権を持つ人が pull request を変更することを許可する場合は、 [Allow edits from maintainers] (メンテナからの編集を許可) を選択してください。

    警告

    フォークに GitHub Actions ワークフローが含まれている場合、オプションは [Allow edits and access to secrets by maintainers] になります。 GitHub Actionsワークフローを含むフォークのブランチの編集を許可すると、メンテナにフォークされたリポジトリのワークフローの編集も許可することになり、シークレットの値を明らかにして他のブランチへのアクセスも許可してしまう可能性があります。

  8. レビューの準備が完了している pull request を作成するには、 [pull request の作成] をクリックします。 ドラフトの pull request を作成するには、ドロップダウンを使用して、 [ドラフトの pull request の作成] を選択し、 [ドラフトの pull request] をクリックします。 組織のメンバーである場合は、組織の所有者から下書きプル要求へのアクセスを要求することが必要になることがあります。 「Pull Request」をご覧ください。

ヒント

pull request を作成したら、提案された変更のレビューを特定の人に依頼できます。 詳しくは、「プルリクエストレビューを依頼する」をご覧ください。

Further reading