Mika Tuupola Mika Tuupola - 1 month ago 5
Git Question

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?

Answer

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

With new GitHub issues 2.0 1 [2] 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 [3]:

fixes user/repo#xxx

Check out the documentation available in their Help section.