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

此版本的 GitHub Enterprise 将停止服务 此版本的 GitHub Enterprise 已停止服务 2020-05-23. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

文章版本: Enterprise Server 2.17

Linking a pull request to an issue

You can link a pull request to an issue to automatically close the issue when the pull request is merged.

本文内容

About linked issues and pull requests

You can link an issue to a pull request using a supported keyword in the pull request description.

When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed. For more information about the default branch, see "Setting the default branch."

Linking a pull request to an issue using a keyword

You can link a pull request to an issue by using a supported keyword in the pull request's description.

  • close
  • closes
  • closed
  • fix
  • fixes
  • fixed
  • resolve
  • resolves
  • resolved

The syntax for closing keywords depends on whether the issue is in the same repository as the pull request.

Linked issue语法示例
Issue in the same repositoryKEYWORD #ISSUE-NUMBERCloses #10
Issue in a different repositoryKEYWORD OWNER/REPOSITORY#ISSUE-NUMBERFixes octo-org/octo-repo#100
Multiple issuesUse full syntax for each issueResolves #10, resolves #123, resolves octo-org/octo-repo#100

You can also use closing keywords in a commit message. The issue will be closed when you merge the commit into the default branch.

延伸阅读

问问别人

找不到要找的内容?

联系我们