Git 提交消息的推荐格式是什么?
最佳答案
当然,它会有所不同,但一种非常常见的格式是这样的(取自 http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html,我认为它总结得很好):
Short (50 chars or less) summary of changes
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 an email 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); tools like rebase can get confused if you run the
two together.
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
它没有解决的一件事是我为自己采用的东西,即在第一行的开头使用短标签来识别它是哪种提交。这可能是诸如 [fix]
之类的标签用于错误修复,[new]
用于新功能或 [dev]
用于仅影响的提交内部结构。使用这样的策略,很容易从提交中自动生成更改日志。
编辑:这是另一个很好的总结,甚至来自这个网站:In git, what are some good conventions to format multiple comments to a single commit
关于git - Git 提交消息的推荐格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4126442/