Note: The special keywords in a pull request description are interpreted when the pull request targets the repository's default branch. However, if the PR's base is any other branch, then these keywords are ignored, no links are created and merging the PR has no effect on the issues. If you want to link a pull request to an issue using a keyword, the PR must be on the default branch.
关于链接的议题和拉取请求
You can link an issue to a pull request using a supported keyword in the pull request description.
当您将拉取请求链接到拉取请求指向的议题,如果有人正在操作该议题,协作者可以看到。 If the pull request and the issue are in different repositories, GitHub Enterprise Server 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.
将链接的拉取请求合并到仓库的默认分支时,其链接的议题将自动关闭。 For more information about the default branch, see "Changing the default branch."
使用关键词将拉取请求链接到议题
You can link a pull request to an issue by using a supported keyword in the pull request's description or in a commit message (please note that the pull request must be on the default branch).
- close
- closes
- closed
- fix
- fixes
- fixed
- 解决
- resolves
- resolved
关闭关键词的语法取决于议题是否与拉取请求在同一仓库中。
链接的议题 | 语法 | 示例 |
---|---|---|
同一仓库中的议题 | KEYWORD #ISSUE-NUMBER | Closes #10 |
不同仓库中的议题 | KEYWORD OWNER/REPOSITORY#ISSUE-NUMBER | Fixes octo-org/octo-repo#100 |
多个议题 | 对每个议题使用完整语法 | Resolves #10, resolves #123, resolves octo-org/octo-repo#100 |
您也可以在提交消息中使用关闭关键词。 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.