Clark To Do The blog of Clark

Git Commit 信息格式

参考自: AngularJS Git Commit Message Conventions

commit message 的格式


<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

每行不能超过100个字符! 会使 github 以及各种 git 工具上的信息更加易读.

Subject

Subject 包含对于本次修改的简要描述.

<type>

  • feat (功能性)
  • fix (bug 修复)
  • docs (文档)
  • style (代码样式, 例如: 缺少分号等)
  • refactor (重构)
  • test (添加确实的测试用例)
  • chore (日常维护)

<scope>

Scope 可以是任意指定了本次变更相关的信息. 例如: $location, $browser, $compile, $rootScope, ngHref, ngClick, ngView 等等…

<subject>

  • 使用祈使句, 现在式时态: “change”, 而不是 “changed” 和 “changes”
  • 不要大写一个字母
  • 结尾无需句号

Message body

  • 一样使用祈使句, 现在式时态: “change”, 而不是 “changed” 和 “changes”
  • 包含本次变更的动机和变更前后的差异

http://365git.tumblr.com/post/3308646748/writing-git-commit-messages http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Breaking changes

所有重大改动必须在底部提及本次改动的描述信息, 理由以及迁移说明

BREAKING CHANGE: isolate scope bindings definition has changed and
    the inject option for the directive controller injection was removed.

    To migrate the code follow the example below:

    Before:

    scope: {
      myAttr: 'attribute',
      myBind: 'bind',
      myExpression: 'expression',
      myEval: 'evaluate',
      myAccessor: 'accessor'
    }

    After:

    scope: {
      myAttr: '@',
      myBind: '@',
      myExpression: '&',
      // myEval - usually not useful, but in cases where the expression is assignable, you can use '='
      myAccessor: '=' // in directive's template change myAccessor() to myAccessor
    }

    The removed `inject` wasn't generally useful for directives so there should be no code using it.

Referencing issues

被关闭的 bug 应该另起一行在底部单独列出, 并且使用 “Closes” 前缀, 例如

Closes #234

or in case of multiple issues:

Closes #123, #245, #992
comments powered by Disqus