* Add new structure to index.md * Move all conceptual and troubleshooting content * Add more redirects * Update links * Reorganize "About" article * Tweak some conceptual content * Rename procedural article * Fix article title in index.md * Fix links * Add more redirects * Fix more links * Add redirects for "Managing..." and fix links * Consolidate procedural information * Remove duplicate redirect * Fix indentation * Add 💅 * Add header * Add editing and deleting * 💅 conceptual content * 💅 conceptual content * 💅 troubleshooting article * Clarify default behavior * 💅 gated feature clarification * Add 💅 * Add 💅 * update hardcoded links in tests * Fix gated feature reusable Co-Authored-By: Matt Pollard <mattpollard@users.noreply.github.com> * Step out of the way while Matt improves all of the legacy content Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com> * Tweak gated feature reusable Co-authored-by: Sarah Schneider <sarahs@github.com> Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
5.3 KiB
title, intro, redirect_from, versions
| title | intro | redirect_from | versions | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Merging a pull request | Merge a pull request into the upstream branch when work is completed. Anyone with push access to the repository can complete the merge. |
|
|
About pull request merges
In a pull request, you propose that changes you've made on a head branch should be merged into a base branch. By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch. However, there may be restrictions on when you can merge a pull request into a specific branch. For example, you may only be able to merge a pull request into the default branch if required status checks are passing. For more information, see "About protected branches."
{% data reusables.pull_requests.you-can-auto-merge %}
If the pull request has merge conflicts, or if you'd like to test the changes before merging, you can check out the pull request locally and merge it using the command line.
You can't merge a draft pull request. For more information about draft pull requests, see "About pull requests."
{% data reusables.pull_requests.automatically-delete-branches %}
If you decide you don't want the changes in a topic branch to be merged to the upstream branch, you can close the pull request without merging.
Merging a pull request on {% data variables.product.prodname_dotcom %}
{% data reusables.repositories.sidebar-pr %}
2. In the "Pull Requests" list, click the pull request you'd like to merge.
3. Depending on the merge options enabled for your repository, you can:
- Merge all of the commits into the base branch by clicking Merge pull request. If the Merge pull request option is not shown, then click the merge drop down menu and select Create a merge commit.
- Squash the commits into one commit by clicking the merge drop down menu, selecting Squash and merge and then clicking the Squash and merge button.
- Rebase the commits individually onto the base branch by clicking the merge drop down menu, selecting Rebase and merge and then clicking the Rebase and merge button.

{% note %}
**Note:** Rebase and merge will always update the committer information and create new commit SHAs. For more information, see "[About pull request merges](/articles/about-pull-request-merges#rebase-and-merge-your-pull-request-commits)."
{% endnote %}
-
If prompted, type a commit message, or accept the default message.
{% data reusables.pull_requests.default-commit-message-squash-merge %}

{% data reusables.files.choose-commit-email %}
{% note %}
Note: The email selector is not available for rebase merges, which do not create a merge commit, or for squash merges, which credit the user who created the pull request as the author of the squashed commit.
{% endnote %}
- Click Confirm merge, Confirm squash and merge, or Confirm rebase and merge.
- Optionally, delete the branch. This keeps the list of branches in your repository tidy.
The repository may be configured so that the head branch for a pull request is automatically deleted when you merge a pull request. For more information, see "Managing the automatic deletion of branches."
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@latest" or currentVersion ver_gt "enterprise-server@2.21" %} {% note %}
Note: {% data reusables.pull_requests.retargeted-on-branch-deletion %} For more information, see "About branches."
{% endnote %} {% endif %}
Pull requests are merged using the --no-ff option, except for pull requests with squashed or rebased commits, which are merged using the fast-forward option.
{% data reusables.pull_requests.close-issues-using-keywords %}
Further reading
- "Reverting a pull request"
- "Syncing your branch" using {% data variables.product.prodname_desktop %}
- "About pull request merges"
- "Addressing merge conflicts"