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?
#xxx in your commit message to reference an issue without closing it.
You can also substitute
Referencing and closing issues across repos also works:
Check out the documentation available in their Help section.
Read more... Read less...
If you want to link to a GitHub issue and close the issue, you can provide the following lines in your Git commit message:
Closes #1. Closes GH-1. Closes gh-1.
(Any of the three will work.) Note that this will link to the issue and also close it. You can find out more in this blog post (start watching the embedded video at about 1:40).
I'm not sure if a similar syntax will simply link to an issue without closing it.
You can also cross reference repos:
xxx being the issue number
github adds a reference to the commit if it contains #issuenbr (discovered this by chance).
they have an nice write up about the new issues 2.0 on their blog https://github.blog/2011-04-09-issues-2-0-the-next-generation/
- fixes #xxx
- fixed #xxx
- fix #xxx
- closes #xxx
- close #xxx
- closed #xxx
using any of the keywords in a commit message will make your commit either mentioned or close an issue.
In order to link the issue number to your commit message, you should add:
#issue_number in your git commit message.
Example Commit Message from Udacity Git Commit Message Style Guide
feat: Summarize changes in around 50 characters or less More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of the commit and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); various tools like `log`, `shortlog` and `rebase` can get confused if you run the two together. Explain the problem that this commit is solving. Focus on why you are making this change as opposed to how (the code explains that). Are there side effects or other unintuitive consequenses of this change? Here's the place to explain them. Further paragraphs come after blank lines. - Bullet points are okay, too - Typically a hyphen or asterisk is used for the bullet, preceded by a single space, with blank lines in between, but conventions vary here If you use an issue tracker, put references to them at the bottom, like this: Resolves: #123 See also: #456, #789
You can also reference the repositories: