Closing issues using keywords
You can include keywords in your pull request descriptions, as well as commit messages, to automatically close issues in GitHub.
In this article
- About issue references
- Closing an issue in the same repository
- Closing an issue in a different repository
- Closing multiple issues
About issue references
When a pull request or commit references a keyword and issue number, it creates an association between the pull request and the issue. When the pull request is merged into your repository's default branch, the corresponding issue is automatically closed.
The following keywords, followed by an issue number, will close the issue:
For example, to close an issue numbered
123, you could use the phrase "Closes #123" or "Closes: #123" in your pull request description or commit message. Once the branch is merged into the default branch, the issue will close.
When you reference an issue in a pull request description, a link to the pull request will be displayed on the issue page. If the pull request and the issue are in different repositories, the link will only be displayed after the pull request is merged and if the person who merged the pull request has permission to close the issue.
Closing an issue in the same repository
To close an issue in the same repository, use one of the keywords above followed by a reference to the issue number. For example, a commit message with
Fixes #45 will close issue 45 in that repository once the commit is merged into the default branch.
If the commit is in a non-default branch, the issue will remain open and the issue will be referenced with a tooltip.
Closing an issue in a different repository
To close an issue in another repository, use the
username/repository#issue_number syntax, as described in "Autolinked references and URLs."
For example, including
Closes example_user/example_repo#76 will close the referenced issue in that repository, provided you have push access to that repository.
Closing multiple issues
To close multiple issues, preface each issue reference with one of the above keywords. You must use the keyword before each issue you reference for the keyword to work.
This closes #34, closes #23, and closes example_user/example_repo#42 would close issues #34 and #23 in the same repository, and issue #42 in the "example_user/example_repo" repository.