Git commit message 规范

最近使用git,翻找以前的记录, 愈发觉得提交 git 记录时, commit message 很重要, 需要有一定规范.

规范

一般遵守 thoughtbot 规范,这里是详细说明 5 Useful Tips For A Better Commit Message

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# 50-character subject line
#
# 72-character wrapped longer description. This should answer:
#
# * Why was this change necessary?
# * How does it address the problem?
# * Are there any side effects?
#
# Include a link to the ticket, if any.
#
# Add co-authors if you worked on this code with others:
#
# Co-authored-by: Full Name <email@example.com>
# Co-authored-by: Full Name <email@example.com>

Note:

Never use the -m / --message= flag to git commit.

-m的表述内容太少, 不要在正式提交中使用.

参考资料