在提交消息中链接到GitHub上的问题编号

这篇博客讨论了如何在Git提交消息中自动链接到GitHub上的问题编号,并提及关闭问题的关键词。提到了如`修复了#xxx`、`关闭#xxx`等关键字可以链接并关闭问题,还提到了GitHub问题2.0的相关功能。此外,还分享了一些工具和插件,如stagecoach gem和Eclipse的Mylyn插件,以自动化这一过程。
摘要由CSDN通过智能技术生成

是否有可能在git commit消息中自动获得指向GitHub问题编号的链接?


#1楼

您还可以交叉引用回购:

githubuser/repository#xxx

xxx是问题编号


#2楼

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

同义词包括

  • 修复了#xxx
  • 固定#xxx
  • 修复#xxx
  • 关闭#xxx
  • 关闭#xxx
  • 关闭#xxx

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


#3楼

我作为程序员的第一个项目之一就是一个名为stagecoach的gem,它允许在分支上的每个提交消息中自动添加一个github问题号,这是一个尚未真正回答的问题的一部分。

基本上,在创建分支时,您将使用自定义命令(类似于stagecoach -b <branch_name> -g <issue_number> ),然后将问题编号分配给yml文件中的该分支。 然后有一个提交钩子自动将问题编号附加到提交消息。

我不推荐它用于生产用途,因为我只编程了几个月而且我不再维护它,但它可能对某些人感兴趣。


#4楼

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

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

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

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


#5楼

为了将问题编号链接到您的提交消息,您应该在您的git commit消息中添加: #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

#6楼

如果github包含#issuenbr(偶然发现),则会添加对提交的引用。


#7楼

只需在提交消息中包含#xxx即可引用问题而不关闭它。

使用新的GitHub问题2.0,您可以使用这些同义词来引用问题并将其关闭 (在您的提交消息中):

  • fix #xxx
  • fixes #xxx
  • fixed #xxx
  • close #xxx
  • closes #xxx
  • closed #xxx
  • resolve #xxx
  • resolves #xxx
  • resolved #xxx

你也可以用gh-xxx代替#xxx

在repos中引用和关闭问题也有效:

fixes user/repo#xxx

查看其“帮助”部分中提供的文档


#8楼

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值