好的 commits 是专注的(一个逻辑变更)且带有清晰的消息,说明了什么改变了以及为什么改变。精心编写的 commits 和消息使项目历史可读、有用,便于理解变更、调试和协作。
好的 commit 消息
GOOD message structure:
Short summary line (~50 chars, imperative mood, capitalized, no period)
<blank line>
Optional body: explain WHAT and WHY (not how — the code shows how),
wrap at ~72 chars. Reference issues if relevant.
✅ GOOD:
Add user email validation to registration form
Validate email format before submission to prevent invalid
accounts. Fixes #142.
❌ BAD:
"fixed stuff", "update", "asdf", "changes", "wip"
→ vague, uninformative — useless when reviewing history later
