git - Git 提交消息的推荐格式

标签 git version-control formatting conventions

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/

相关文章:

git - 版本控制工具可以处理富文本文档吗?

python - 如何从列表中删除所有符合特定格式的字符串?

带有许多移动文件和文件夹的 Git rebase/merge 分支

git - 当我需要其他分支的一些代码时如何为功能创建分支(未 merge 到开发分支中)

python - 难以理解 Paul Heckel 的 Diff 算法

version-control - 版本控制应考虑哪些 checkin 策略?

C - 如何存储 XML 字符串并保持格式?

google-apps-script - 如何通过 Apps 脚本在 Google 表格中显示 "Clear Format"

git - 如何列出所有 Git 子模块的 URL?

git status --short : missing "Your branch is ahead of ' origin/master' by 1 commit"