是否有可能在git提交消息中自动有一个链接到GitHub问题编号?


当前回答

如果提交包含#issuenbr, Github会添加一个引用(偶然发现的)。

其他回答

如果你想链接到一个GitHub问题并关闭该问题,你可以在Git提交消息中提供以下行:

Closes #1.
Closes GH-1.
Closes gh-1.

(三种方法都可以。)请注意,这将链接到该问题,并关闭它。你可以在这篇博客文章中找到更多信息(大约1:40开始观看嵌入的视频)。

我不确定类似的语法是否会简单地链接到一个问题而不关闭它。

他们在博客上写了一篇关于新2.0的文章 https://github.blog/2011-04-09-issues-2-0-the-next-generation/

同义词包括

修复# xxx 固定# xxx 解决# xxx 关闭# xxx 关闭# xxx 关闭# xxx

在提交消息中使用任何关键字将使您的提交被提及或关闭一个问题。

为了将问题编号链接到你的提交消息,你应该添加: 在git提交消息中使用#issue_number。

从Udacity Git提交消息样式指南提交消息

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

你也可以引用存储库:

githubuser/repository#issue_number

你也可以交叉引用回购:

githubuser/repository#xxx

XXX是发行号

作为其他答案的补充:如果您甚至不想编写带有问题编号的提交消息,并且恰好使用Eclipse进行开发,那么您可以为Mylyn安装eGit和Mylyn插件以及GitHub连接器。然后,Eclipse可以自动跟踪您正在处理的问题,并自动填充提交消息,包括在所有其他答案中显示的问题编号。

有关该设置的更多详细信息,请参见http://wiki.eclipse.org/EGit/GitHub/UserGuide