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."
Puedes configurar una solicitud de cambios para que se fusione automáticamente cuando se cumplan todos los requisitos de fusión. Para obtener más información, consulta la sección "Fusionar una solicitud de cambios automáticamente".
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."
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."
Note: Si borras una rama de encabezado después de haber fusionado su solicitud de extracción, GitHub verificará cualquier solicitud de extracción abierta en el mismo repositorio que especifique la rama borrada como su rama base. GitHub actualiza automáticamente cualquier solicitud de extracción, cambiando su rama base a la rama base de la solicitud de extracción que se ha fusionado. For more information, see "About branches."
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.
Puedes enlazar una solicitud de cambios a una propuesta para mostrar que se está haciendo una corrección actualmente y para cerrar dicha propuesta automáticamente cuando alguien fusione la solicitud de cambios. Para obtener más información, consulta la sección "Vincular una solicitud de extracción a un informe de problemas".
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
-
Debajo del nombre de tu repositorio, da clic en Solicitudes de cambios.
-
In the "Pull Requests" list, click the pull request you'd like to merge.
-
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: Rebase and merge will always update the committer information and create new commit SHAs. For more information, see "About pull request merges."
-
If prompted, type a commit message, or accept the default message.
Para obtener información acerca de los mensajes de confirmación predeterminados para las fusiones de combinación, consulta "Acerca de las fusiones de solicitudes de extracción."
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.
- 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.
Para aprender más sobre el CLI de GitHub, consulta la sección "Acerca del CLI de GitHub".
To merge a pull request, use the gh pr merge
subcommand. Replace pull-request
with the number, URL, or head branch of the pull request.
gh pr merge pull-request
Follow the interactive prompts to complete the merge. For more information about the merge methods that you can choose, see "About pull request merges."
Alternatively, you can use flags to skip the interactive prompts. For example, this command will squash the commits into a single commit with the commit message "my squash commit", merge the squashed commit into the base branch, and then delete the local and remote branch.
gh pr merge 523 --squash --body "my squash commit" --delete-branch
Further reading
- "Reverting a pull request"
- "Syncing your branch" using GitHub Desktop
- "About pull request merges"
- "Addressing merge conflicts"