例如注释有这样的(转载)
一般情况下,提交 GIT 时的注释可以分成几类,可以用几个动词开始:
尽量将注释缩减为一句话,不要包含详细的内容。
假如有 Issues 系统,其中可以包含 Issue 的 ID。比如:Issue #123456
包含作者的信息。比如 by Bruce
完整例子:
git commit -m 'Issue #[issue number] by [username]: [Short summary of the change].'
Related articles
大家的注释方式规范如何?
怪我咯2017-04-24 09:15:41
Personal habits:
fixed #XX
Another advantage here is that #XX
GitHub in the commit log will be displayed as a link to the corresponding Issue, and a prompt will also appear in the corresponding Issue as to which commit this Issue is referenced by.
What’s even more amazing is that, like fixed #XX
, GitHub will automatically close the Issue for you.
In fact, the most important point is that the commit log is for humans to see, so just make it clear. You don’t have to be too formal, and you can’t write it in a way that is only for machines to see.
Negative teaching materials. . . It is said that two completely opposite factions are represented here. . .
大家讲道理2017-04-24 09:15:41
Mod: remove unused code
, means ModifyAdd: a new module to have faster process
, means AddRem: deprecate unused modules
, means removeRef: improved the implementation of module X
, means RefactorySome students want to ask: What should I do if the content in a commit cannot be stated in any of the above statements?
Classmate, that means your commit should be split into multiple small parts
Of course my favorite commit message is still the first commit, the content is First Blood