我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

合并拉取请求

在工作完成时将拉取请求合并到上游分支。 对仓库具有推送权限的任何人都可以完成合并。

本文内容

关于拉取请求合并

如果拉取请求具有合并冲突,或者您在测试前想测试更改,可以本地检出拉取请求,然后使用命令行合并。

不能合并草稿拉取请求。 有关草稿拉取请求的更多信息,请参阅“关于拉取请求”。

如果决定不想让主题分支中的更改合并到上游分支,您可以关闭拉取请求而不合并。

必要的审查

Repository administrators can require that all pull requests receive a specific number of approving reviews from people with write or admin permissions in the repository or from a designated code owner before they're merged into a protected branch. 更多信息请参阅“关于受保护分支”。

When required reviews are enabled, anyone with access to the repository can approve changes in a pull request. However, you won't be able to merge your pull request until the required number of reviewers with write or admin permissions in the repository approve your pull request's changes in their review. For more information about repository permission levels, see "Repository permission levels for an organization." If review is required from a designated code owner and the pull request affects code that has a designated owner, approval from that owner is required.

如果拉取请求在经过审查后发生了更改,并且请求更改的人无法提供批准审查,则仓库管理员或具有写入权限的人员可以取消审查。 更多信息请参阅“忽略拉取请求审查”。

After all required reviewers have approved a pull request, you won't be able to merge it if there are other open pull requests with pending or rejected reviews and those pull requests have a head branch pointing to the same commit. Someone with write or admin permissions will need to approve or dismiss the blocking review on the other pull requests before you can merge.

在 GitHub 上合并拉取请求

  1. Under your repository name, click Pull requests.

    议题和拉取请求选项卡选择

  2. 在“Pull Requests(拉取请求)”列表中,单击要合并的拉取请求。

  3. 根据对仓库启用的合并选项,您可以:

    注:变基并合并始终会更新提交者信息,并创建新的提交 SHA。 更多信息请参阅“关于拉取请求合并”。

  4. If prompted, type a commit message, or accept the default message.

    提交消息字段

  5. Click Confirm merge, Confirm squash and merge, or Confirm rebase and merge.

  6. (可选)删除分支。 这有助于仓库的分支列表保持整洁。

拉取请求使用 --no-ff 选项合并,具有压缩或变基的提交的拉取请求除外,这种拉取请求使用快进选项合并。

You can close corresponding issues using a keyword in your pull request or commit message. 更多信息请参阅“使用关键词关闭议题”。

延伸阅读

问问别人

找不到要找的内容?

联系我们