是否有可能在git提交消息中自动有一个链接到GitHub问题编号?
当前回答
如果你想链接到一个GitHub问题并关闭该问题,你可以在Git提交消息中提供以下行:
Closes #1.
Closes GH-1.
Closes gh-1.
(三种方法都可以。)请注意,这将链接到该问题,并关闭它。你可以在这篇博客文章中找到更多信息(大约1:40开始观看嵌入的视频)。
我不确定类似的语法是否会简单地链接到一个问题而不关闭它。
其他回答
为了将问题编号链接到你的提交消息,你应该添加: 在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
如果你想链接到一个GitHub问题并关闭该问题,你可以在Git提交消息中提供以下行:
Closes #1.
Closes GH-1.
Closes gh-1.
(三种方法都可以。)请注意,这将链接到该问题,并关闭它。你可以在这篇博客文章中找到更多信息(大约1:40开始观看嵌入的视频)。
我不确定类似的语法是否会简单地链接到一个问题而不关闭它。
如果提交包含#issuenbr, Github会添加一个引用(偶然发现的)。
我作为程序员的第一个项目是一个叫做stagecoach的gem,它允许在分支上的每个提交消息中自动添加一个github issue编号,这是一个尚未真正回答的问题的一部分。
本质上,在创建分支时,您将使用一个自定义命令(例如stagecoach -b <branch_name> -g <issue_number>),然后在yml文件中将问题编号分配给该分支。然后有一个提交钩子自动将问题编号追加到提交消息。
我不推荐它用于生产,因为当时我只编程了几个月,我不再维护它,但它可能会引起某些人的兴趣。
你也可以交叉引用回购:
githubuser/repository#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下载文件的最新版本的存储库?