search

Home  >  Q&A  >  body text

Github上git commit 提交注释的规范

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

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

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

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

ringa_leeringa_lee2777 days ago936

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-24 09:15:41

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

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-24 09:15:41

    • 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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-24 09:15:41

    Recommend this article and write your Commit Message

    reply
    0
  • Cancelreply