You can include keywords in your pull request titles and descriptions, as well as commit messages, to automatically close issues in GitHub.

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:

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

For example, to close an issue numbered 123, you could use the phrases "Closes #123" in your pull request description or commit message. Once the branch is merged into the default branch, the issue will close.

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.

For example, 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.