是否有可能在git提交消息中自动有一个链接到GitHub问题编号?
当前回答
你也可以交叉引用回购:
githubuser/repository#xxx
XXX是发行号
其他回答
作为其他答案的补充:如果您甚至不想编写带有问题编号的提交消息,并且恰好使用Eclipse进行开发,那么您可以为Mylyn安装eGit和Mylyn插件以及GitHub连接器。然后,Eclipse可以自动跟踪您正在处理的问题,并自动填充提交消息,包括在所有其他答案中显示的问题编号。
有关该设置的更多详细信息,请参见http://wiki.eclipse.org/EGit/GitHub/UserGuide
如果你想链接到一个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
你也可以交叉引用回购:
githubuser/repository#xxx
XXX是发行号
我作为程序员的第一个项目是一个叫做stagecoach的gem,它允许在分支上的每个提交消息中自动添加一个github issue编号,这是一个尚未真正回答的问题的一部分。
本质上,在创建分支时,您将使用一个自定义命令(例如stagecoach -b <branch_name> -g <issue_number>),然后在yml文件中将问题编号分配给该分支。然后有一个提交钩子自动将问题编号追加到提交消息。
我不推荐它用于生产,因为当时我只编程了几个月,我不再维护它,但它可能会引起某些人的兴趣。
推荐文章
- git索引到底包含什么?
- 以树形输出git分支
- 如何点Go模块的依赖在Go。Mod到回购中的最新提交?
- 乳胶渲染在README。md在Github上
- 为什么调用git分支——unset-upstream来修复?
- Windows git“警告:LF将被CRLF取代”,这是警告尾巴向后吗?
- git中的哈希冲突
- git可以自动在空格和制表符之间切换吗?
- Git暂存文件列表
- 在Markdown Jekyll中使用图像说明
- 如何将git配置存储为存储库的一部分?
- 如何修改GitHub拉请求?
- 如何在Github和本地删除最后n次提交?
- 我如何调试git/git-shell相关的问题?
- 错误:无法使用rebase进行拉取:您有未分阶段的更改