# ベースブランチとプルリクエストを同期させ続ける

マージする前に、競合を解決し、互換性を確保するために、ベース ブランチからの変更で pull request ブランチを更新します。

## pull request の同期を維持する方法について

マージする前に、競合をキャッチしたり、早期に失敗をテストしたりするために、プル要求ブランチをベース ブランチからの変更で更新します。 マージの競合がなく、ブランチがベース ブランチの背後にある場合は、プル要求ページからブランチを更新できます。

> \[!NOTE]
> pull request の HEAD ブランチが保護されたブランチの場合、 `Update branch` ボタンを使用できない場合があります。 「[保護されたブランチについて](/ja/enterprise-cloud@latest/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)」を参照してください。

ベース ブランチを変更すると、プル要求ブランチでマージの競合が発生する場合は、ブランチを更新する前に競合を解決してください。 「[マージ競合](/ja/enterprise-cloud@latest/pull-requests/reference/merge-conflicts)」を参照してください。

pull request ページから、ベース ブランチをヘッド ブランチにマージするか、変更を最新のベース ブランチに再調整することで更新できます。 リベースでは、マージコミットを作成せずに直線的な履歴を作成します。 「[支店](/ja/enterprise-cloud@latest/pull-requests/reference/branches#three-dot-and-two-dot-git-diff-comparisons)」を参照してください。

## プルリクエストのブランチを更新する

1. リポジトリ名の下にある \[**pull requests]\(プル要求<svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-git-pull-request" aria-label="git-pull-request" role="img"><path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg>** をクリックします。
2. 「Pull requests」一覧で、更新するプルリクエストをクリックします。
3. ページの下部付近にあるマージ セクションで、ブランチを更新する方法を選択します。
   * **\[ブランチを更新]** をクリックして、従来のマージを実行します。

     ![pull request の \[マージ\] セクションのスクリーンショット。](/assets/images/help/pull_requests/pull-request-update-branch-with-dropdown.png)

   * \[更新ブランチ] ドロップダウン メニューをクリックし、\[ **Rebase で更新**] をクリックし、\[ **Rebase Branch** ] をクリックしてベース ブランチをリベースして更新します。

     ![Pull request の \[merge\] セクションのスクリーンショット。 ドロップダウン メニューが展開され、\[マージ コミットで更新する\] オプションと \[リベースで更新する\] オプションが表示されています。](/assets/images/help/pull_requests/pull-request-update-branch-rebase-option.png)

## 詳細については、次を参照してください。

* [Pull Request](/ja/enterprise-cloud@latest/pull-requests/reference/pull-requests)
* [プルリクエストのステージの変更](/ja/enterprise-cloud@latest/pull-requests/how-tos/create-pull-requests/changing-the-stage-of-a-pull-request)