是否有可能在git提交消息中自动有一个链接到GitHub问题编号?
当前回答
只需在提交消息中包含#xxx来引用一个问题而不关闭它。
在新的GitHub问题2.0中,你可以使用这些同义词来引用一个问题并关闭它(在你的提交消息中):
解决# xxx 修复# xxx 固定# xxx 关闭# xxx 关闭# xxx 关闭# xxx 解决# xxx 解决# xxx 解决# xxx
你也可以用gh-xxx代替#xxx。
在回购中引用和关闭问题也可以:
fixes user/repo#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
只需在提交消息中包含#xxx来引用一个问题而不关闭它。
在新的GitHub问题2.0中,你可以使用这些同义词来引用一个问题并关闭它(在你的提交消息中):
解决# xxx 修复# xxx 固定# xxx 关闭# xxx 关闭# xxx 关闭# xxx 解决# xxx 解决# xxx 解决# xxx
你也可以用gh-xxx代替#xxx。
在回购中引用和关闭问题也可以:
fixes user/repo#xxx
请在他们的帮助部分查看可用的文档。
如果提交包含#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添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- 在GitHub上有一个公共回购的私人分支?
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- 只用GitHub动作在特定分支上运行作业
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 是否有一个链接到GitHub下载文件的最新版本的存储库?