Skip to main content

Keeping your pull request in sync with the base branch

Update your pull request branch with changes from the base branch to resolve conflicts and ensure compatibility before merging.

Who can use this feature?

People with write permissions to the repository to which the head branch of the pull request belongs can update the head branch with changes that have been made in the base branch.

About keeping your pull request in sync

Before merging, update your pull request branch with changes from the base branch to catch conflicts or test failures early. You can update the branch from the pull request page when there are no merge conflicts and the branch is behind the base branch.

Note

You may not be able to use the Update branch button if the HEAD branch of your pull request is a protected branch. See About protected branches.

If changes to the base branch cause merge conflicts in your pull request branch, resolve the conflicts before updating the branch. See Merge conflicts.

From the pull request page, you can update by merging the base branch into your head branch or by rebasing your changes onto the latest base branch. Rebasing creates a linear history without a merge commit. See Branches.

Updating your pull request branch

  1. Under your repository name, click Pull requests.
  2. In the "Pull requests" list, click the pull request you want to update.
  3. In the merge section near the bottom of the page, choose how to update the branch:
    • Click Update branch to perform a traditional merge.

      Screenshot of the merge section for a pull request.

    • Click the update branch dropdown menu, click Update with rebase, then click Rebase branch to update by rebasing on the base branch.

      Screenshot of the merge section of a pull request. The dropdown menu is expanded, showing "Update with merge commit" and "Update with rebase" options.

Further reading