Atomic commit
每次的commit應該只包含一個邏輯上的變動
你應該避免 把 commit 宣稱要做的事情 與無關的程式碼 一起 commit 進去
- 例如
- 你不應該在修改一個 bug 的同時 又將兩個空白換成四個空白(單純修改 code format) 混在一起 commit
Commit Message Conventions (AngularJS)
Use git commit template
$ curl https://goo.gl/JRPCt2>> ~/.git-commit-template.txt
$ git config --global commit.template ~/.git-commit-template.tx
設定好後 未來就不要使用 git commit -m 'commit message' (除非你記得很清楚格式要怎麼寫)
而是使用 git commit (我們會看到下面的提示)
# Type(<scope>): <subject>
# <body>
# <footer>
# Type should be one of the following:
# * feat (new feature)
# * fix (bug fix)
# * docs (changes to documentation)
# * style (formatting, missing semi colons, etc; no code change)
# * refactor (refactoring production code)
# * test (adding missing tests, refactoring tests; no production code change)
# * chore (updating grunt tasks etc; no production code change)
# Scope is just the scope of the change. Something like (admin) or (teacher).
# Subject should use impertivite tone and say what you did.
# The body should go into detail about changes made.
# The footer should contain any JIRA (or other tool) issue references or actions.
# For a full example of how to write a good commit message, check out
# https://github.com/sparkbox/how_to/tree/master/style/git
- Commit Message 各欄位的意義(docs, feat, fix, refactor, test)
- http://karma-runner.github.io/0.10/dev/git-commit-msg.html
git log 範例
docs: explain hat wobble
feat: add beta sequence
fix: remove broken confirmation message
refactor: share logic between 4d3d3d3 and flarhgunnstow
style: convert tabs to spaces
test: ensure Tayne retains clothing
feat(clock_tracing): xxx
Semantic Commit Messages http://seesparkbox.com/foundry/semantic_commit_messages
- AngularJS Git Commit Message Conventions
- https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
Git Commit Msg http://karma-runner.github.io/0.10/dev/git-commit-msg.html