Search code examples
gitgithubatlassian-sourcetree

Close issue on github with a keyword in the comment


I'm trying to close the issues in my project using the keywords in the comment but it doesn't work. I have tried both SourceTree and git by command line and the result is the same. I have tried with the options: close #1, closes #1 and fixes #1.

For example:

git commit -am "close issue fixes #1"

I am working on a branch, not the master. Should something be configured in the GitHub repository?


Solution

  • From the GitHub documentation:

    You can also use closing keywords in a commit message. 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.

    If you don't merge the commit into the default branch, then GitHub doesn't close it. That's because you might decide that you don't like that change and want to fix the problem in a different way instead, so just pushing a commit with the keyword isn't sufficient.