Git Commit Message Standard
Git commit message standard for XWOS
3 minute read
Format
# [Header] <type>(<scope>): :emoji: <subject>
# - type: feat, fix, perf, refactor, style, revert, docs, test, ci,
# chore, milestone, release, revision, alpha, beta, rc
# - scope: can be empty
# - subject: a verb-led phrase, no trailing period
# - header occupies exactly one line
# - each line must not exceed 72 characters (Chinese characters count as 2)
#
# [Body] description
# - why is this change needed?
# - how was the problem diagnosed?
# - what are the side effects of this change?
# - each line must not exceed 72 characters (Chinese characters count as 2)
#
# [Footer] <token:> <text>
# - issue ID or link
# - BREAKING CHANGE
# - each line must not exceed 72 characters (Chinese characters count as 2)
Reference: https://www.conventionalcommits.org/
Git Commit Message Format Rules
- Header
- The header must be prefixed with an optional type, which may be
followed by an optional scope. The scope must be enclosed in
English parentheses, after which an optional English
!may follow to indicate a BREAKING CHANGE. - Type descriptions
- feat: new feature
- emoji
- add
:sparkles: - remove
:fire: - config-related
:wrench: - dependency upgrade
:arrow_up: - add code to be improved later
:poop: - add .o or .a files
:package:
- add
- emoji
- fix: bug fix
- emoji
- fix critical bug
:ambulance: - fix bug
:bug: - fix warning
:rotating_light: - fix security issue
:lock:
- fix critical bug
- emoji
- perf: performance optimization
- emoji
- performance optimization
:zap::racehorse: - remove dead code
:coffin:
- performance optimization
- emoji
- refactor: code refactoring
- emoji
- major refactor
:hammer: - add
:sparkles: - refactor
:recycle: - remove
:fire: - config-related
:wrench: - breaking change
:boom: - add logging
:loud_sound: - remove logging
:mute: - reorganize paths
:truck: - API update due to third-party dependency upgrade
:alien:
- major refactor
- emoji
- style: formatting (e.g. trailing whitespace removal)
- emoji
:art:
- emoji
- revert: revert a commit
- emoji
- revert code
:rewind: - downgrade dependency
:arrow_down:
- revert code
- emoji
- docs: documentation
- emoji
- add documentation
:memo: - modify .md documents
:book: - modify comments in source code
:bulb:
- add documentation
- emoji
- test: testing
- emoji
- add tests
:white_check_mark: - add negative tests (tests that trigger errors)
:test_tube:
- add tests
- emoji
- ci: system integration
- emoji
:construction_worker:
- emoji
- chore: miscellaneous uncategorized tasks
- emoji
- config-related
:wrench: - branch merge
:twisted_rightwards_arrows:
- config-related
- emoji
- milestone: release a major version
- emoji
:bookmark:
- emoji
- release: release a minor version
- emoji
:bookmark:
- emoji
- revision: release a revision
- emoji
:bookmark:
- emoji
- alpha: release an alpha version
- emoji
:bookmark:
- emoji
- beta: release a beta version
- emoji
:bookmark:
- emoji
- rc: release an rc version
- emoji
:bookmark:
- emoji
- feat: new feature
- The subject in the header must follow the type with a colon
:and a space, then the emoji symbol, followed by another space. - The header must not end with any punctuation.
- The header must occupy exactly one line.
- BREAKING CHANGE refers to:
- API prototype modification
- API removal
- The header must be prefixed with an optional type, which may be
followed by an optional scope. The scope must be enclosed in
English parentheses, after which an optional English
- Body
- The body must be separated from the header by one blank line.
- Footer
- The footer must be separated from the body by one blank line.
- Each footer entry must have a word as its token:
- Format: token followed by
:and a space, e.g.token: - Alternatively: token followed by a space
and#, e.g.token:
- Format: token followed by
- A footer entry may span multiple lines until a new token is encountered.
- No blank lines between lines within the same footer entry.
Character Set Rules
Use UTF-8 entirely.
Configuration
- Set environment variable:
export LESSHARESET=utf-8
- Set character encoding:
git config i18n.commitencoding utf-8 # Set commit log encoding to UTF-8
git config i18n.logoutputencoding utf-8 # Set log output encoding to UTF-8
git config core.quotepath false # Use UTF-8 for paths with non-ASCII characters
git config gui.encoding utf-8 # Set GUI encoding to UTF-8
Trailing Whitespace Rules
In principle, use \n (LF) as the line terminator. Auto-generated code
is exempt from this rule.
Windows NTFS File Permission Issues
On NTFS, file modes may default to 100644 and cannot be changed with chmod.
Configure Git to ignore file mode changes:
git config core.filemode false