Commit messages are powerful things. They can describe to your collaborators what you were thinking, provide information during a git blame, and you can close issues via commit messages on GitHub.

When you enter "Fixes #45" into a commit message, issue #45 is closed once that commit is merged into your default branch. If the bug isn't fixed in your default branch, the issue remains open. Once the commit with the fix is merged into your default branch, the issue is automatically closed.

If you make a commit in a non-default branch with the "Fixes #33" syntax, the issue is referenced with a tooltip.

You can use any of the following keywords to close an issue via commit message:

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

Closing issues across repositories

If you refer to a repository by its GFM notation, you can also close issues across repositories. For example, if you include "fixes user/repo#45" in your commit message, it closes the referenced issue, provided you have the permission to push to that repository.

Closing issues with Pull Requests

By including the "closed" keywords into the description of your Pull Requests, you can close issues. Just like with commit messages, if the bug isn't fixed to your default branch, the issue remains open. The issue is automatically closed only when the pull request is merged into your default branch.

Tip: Referencing an issue number within the Pull Request title won't close it! The reference must be in a commit message, or the Pull Request body.

Closing multiple issues

To close multiple issues, simply use the same syntax multiple times for each issue.

For example, "This fixes #34 and also resolves #23, closes user/repo#42" would close issues #34 and #23, as well as issue #42 in user/repo.