Search code examples
gitgithubgit-commit

Link to the issue number on GitHub within a commit message


Is it somehow possible to automatically have a link to GitHub issue number in the git commit message?


Solution

  • Just include #xxx in your commit message to reference an issue without closing it.

    With new GitHub issues 2.0 you can use these synonyms to reference an issue and close it (in your commit message):

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

    You can also substitute #xxx with gh-xxx.

    Referencing and closing issues across repos also works:

    fixes user/repo#xxx
    

    Check out the documentation available in their Help section.