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

Linking a pull request to an issue

You can link a pull request to an issue to show that a fix is in progress and 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 link a pull request to the issue the pull request addresses, collaborators can see that someone is working on the issue. If the pull request and the issue are in different repositories, GitHub Enterprise will display the link after the pull request is merged, if the person who merges the pull request also has permission to close the issue.

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 repository KEYWORD #ISSUE-NUMBER Closes #10
Issue in a different repository KEYWORD OWNER/REPOSITORY#ISSUE-NUMBER Fixes octo-org/octo-repo#100
Multiple issues Use full syntax for each issue Resolves #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, but the pull request that contains the commit will not be listed as a linked pull request.

延伸阅读

问问别人

找不到要找的内容?

联系我们