Github上git commit 提交注释的规范
ringa_lee
ringa_lee 2017-04-24 09:13:41
0
3
934

例如注释有这样的(转载)

一般情况下,提交 GIT 时的注释可以分成几类,可以用几个动词开始:

  • Added ( 新加入的需求 )
  • Fixed ( 修复 bug )
  • Changed ( 完成的任务 )
  • Updated ( 完成的任务,或者由于第三方模块变化而做的变化 )

尽量将注释缩减为一句话,不要包含详细的内容。
假如有 Issues 系统,其中可以包含 Issue 的 ID。比如:Issue #123456
包含作者的信息。比如 by Bruce
完整例子:
git commit -m 'Issue #[issue number] by [username]: [Short summary of the change].'
Related articles

大家的注释方式规范如何?

ringa_lee
ringa_lee

ringa_lee

reply all(3)
刘奇

Personal habits:

  1. To fix an Issue, just write: fixed #XX
  2. The small change can be explained clearly in one sentence.
  3. For major changes, create an Issue yourself to explain clearly the situation, plans, and changes. . . . , and then the same as 1

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. . .

大家讲道理
  • Mod: remove unused code, means Modify
  • Add: a new module to have faster process, means Add
  • Rem: deprecate unused modules, means remove
  • Ref: improved the implementation of module X, means Refactory

Some 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

伊谢尔伦

Recommend this article and write your Commit Message

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template