用WEB前端框架AngularJS的Git信息提交規範

Commit信息的格式


每次提交,Commit信息都包括三個部分:header,body,footer。

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


例如:

fix(release): need to depend on latest rxjs and zone.js

The version in our package.json gets copied to the one we publish, and users need the latest of these.


1. Header
    其中header是必須的,包括type、scope、subject三個字段,header的scope字段是可選的。

1.1 Type ( AngularJS框架中給出的規範)

  • feat: 新功能(feature)
  • fix:bug修補
  • docs:文檔的更改
  • perf:代碼更改提高性能
  • style: 格式的更改(不影響代碼運行的變動,比如:空格,代碼格式化,丟失分號等)
  • refactor:重構(即不是新增功能,也不是修改bug的代碼變動)
  • test:增加測試或者更正已經存在的測試
  • chore:構建過程或輔助工具的變動
  • build:更改影響構建系統或者額外的依賴(例如:gulp,npm)
  • ci:更改CI配置文件和腳本(例如:Travis,Circle)
  • revert: 如果返回之前的提交時說明的 type 類型使用 revert

1.2 Scope
    用於描述更改內容影響的範圍或文件,例如:

    docs(changelog): update change log to beta.5
    docs(readme.md): update readme
1.3 Subject
    主要是對於提交目的的簡短描述。

2. Body
    Body部分主要是針對本次 commit 的詳細描述。使用現在時;而且應該說明代碼變動的動機,以及和上一次變動行爲進行對比。

3. Footer
包括兩種情況

1)Breaking changes (不兼容變動)

    Breaking changes wiki A change in one part of a software system that potentially causes other components to fail; occurs most often in shared libraries of code used by multiple applications 軟件系統的一個部分發生變化,可能導致其他組件發生故障;在多個應用程序使用的共享代碼庫中經常出現.

需要以 BREAKING CHANGE: 開頭,緊跟一個空格或者兩個空行,後面是本次變動的描述信息。

2) Referencing issues (引用問題)

    本次代碼的變動如果也針對某個 issue 的關閉,那麼以 "Closes" 關鍵詞開頭,如:     Closes #234


例子

fix($compile): couple of unit tests for IE9

Older IEs serialize html uppercased, but IE9 does not...
Would be better to expect case insensitive, unfortunately jasmine does
not allow to user regexps for throw expectations.

Closes #392
Breaks foo.bar api, foo.baz should be used instead
feat($compile): simplify isolate scope bindings

Changed the isolate scope binding options to:
  - @attr - attribute binding (including interpolation)
  - =model - by-directional model binding
  - &expr - expression execution binding

This change simplifies the terminology as well as
number of choices available to the developer. It
also supports local name aliasing from the parent.

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 generaly useful for directives so there should be no code using it.


參考


AngularJS Git Commit Message Conventions

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章