Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 958
Mika Tuupola Avatar asked Nov 06 '09 12:11

Mika Tuupola


People also ask

How do you link a commit in GitHub issues?

To link to an issue, choose the Links tab, and then choose Add Link>Existing item. From the Add link dialog, select one of the GitHub link types, enter the URL to the commit, pull request, or issue and then choose OK.

Can you add a link to git commit message?

How to Link Commits to GitHub Issues. If you use the correct format in your commit message, your commit will be automatically linked to a GitHub Issue or Pull Request. To do this, put a # followed the Issue or Pull Request number. This will automatically create a link in the commit message.

How do I reference a commit in GitHub?

To reference a commit, simply write its SHA-hash, and it'll automatically get turned into a link.

How do I reference another issue in GitHub?

You can reference issues between repositories by mentioning user/repository#number in an issue. Once we see something like that — say, github/enterprise#59 — we'll make sure to update issue #59 in github's enterprise repository and let you know where it was referenced from.


1 Answers

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.

like image 100
NARKOZ Avatar answered Sep 28 '22 11:09

NARKOZ