Closing Issues via Commit Messages

Image of Chris Wanstrath

Recently we changed the way closing issues via commit message
works on GitHub.

Now when you enter “Fixes #33” in a commit message, issue 33
will only be closed once the commit is merged into your
default branch (usually master).

This is super useful because it means the issue’s open / closed
status will map to your default branch. If the bug isn’t fixed
in your default branch, the issue will remain open. Once the
commit with the fix is merged into your default branch the
issue will be automatically closed.

When you do make a commit in a non-default branch with the
“Fixes #33” syntax, the issue will be referenced with a tooltip:

image

If you work primarily in a non-master branch, such as dev,
you can change your default branch on the repository settings page:

image

Didn’t know about this feature? You can use any of these keywords to close an issue via commit message:

close, closes, closed, fixes, fixed

All of them work the same, including this behavior.

Enjoy!

Join us at GitHub Universe

Our largest product and community conference is returning to the Palace of Fine Arts in San Francisco, November 13-14. Hear what's next for the GitHub platform, find inspiration for your next project, and connect with developers who are changing the world.

Get tickets

GitHub Actions now supports CI/CD

GitHub Actions makes it easier to automate how you build, test, and deploy your projects on any platform, including Linux, macOS, and Windows. Try out the beta before GitHub Actions is generally available on November 13.

Sign up for the beta