NAR*_*KOZ 909
只需#xxx
在提交消息中包含引用问题而不关闭它.
使用新的GitHub问题2.0,您可以使用这些同义词来引用问题并将其关闭(在您的提交消息中):
fix #xxx
fixes #xxx
fixed #xxx
close #xxx
closes #xxx
closed #xxx
resolve #xxx
resolves #xxx
resolved #xxx
您也可以替代#xxx
使用gh-xxx
.
fixes user/repo#xxx
Run Code Online (Sandbox Code Playgroud)
查看其"帮助"部分中提供的文档.
mip*_*adi 164
如果要链接到GitHub问题并关闭该问题,可以在Git提交消息中提供以下行:
Closes #1.
Closes GH-1.
Closes gh-1.
Run Code Online (Sandbox Code Playgroud)
(这三个中的任何一个都可以工作.)请注意,这将链接到该问题并关闭它.你可以在这篇博文中找到更多信息(大约1:40开始观看嵌入式视频).
我不确定类似的语法是否只是链接到一个问题而不关闭它.
nar*_*eso 64
您还可以交叉引用回购:
githubuser/repository#xxx
Run Code Online (Sandbox Code Playgroud)
xxx是问题编号
小智 61
如果github包含#issuenbr(偶然发现),则会添加对提交的引用.
xer*_*ero 14
他们在他们的博客上写了关于新问题2.0的一篇很好的文章 https://github.com/blog/831-issues-2-0-the-next-generation
同义词包括
使用提交消息中的任何关键字将使您的提交提及或关闭问题.
Suh*_*nam 12
为了将问题编号链接到您的提交消息,您应该添加:
#issue_number
在您的 git 提交消息中。
来自 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
Run Code Online (Sandbox Code Playgroud)
您还可以参考存储库:
githubuser/repository#issue_number
Run Code Online (Sandbox Code Playgroud)
就像对其他答案的补充一样:如果您甚至不想用问题编号编写提交消息并且碰巧使用Eclipse进行开发,那么您可以安装 eGit 和 Mylyn 插件以及 Mylyn 的 GitHub 连接器。然后 Eclipse 可以自动跟踪您正在处理的问题并自动填写提交消息,包括所有其他答案中显示的问题编号。
有关该设置的更多详细信息,请参阅http://wiki.eclipse.org/EGit/GitHub/UserGuide
我作为程序员的第一个项目是一个名为stagecoach的 gem ,它(除其他外)允许将github 问题编号自动添加到分支上的每个提交消息,这是尚未真正回答的问题的一部分.
基本上,在创建分支时,您将使用自定义命令(类似于stagecoach -b <branch_name> -g <issue_number>
),然后将问题编号分配给 yml 文件中的该分支。然后有一个提交钩子,自动将问题编号附加到提交消息。
我不会推荐它用于生产用途,因为当时我只编程了几个月并且不再维护它,但有人可能会对它感兴趣。