Skip to content

Commit Guideline

Nguyễn Xuân Nhân edited this page Dec 21, 2023 · 1 revision

Commit Message Format

git commit -m <type>: <body>

Type

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)`
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation`
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)`
  • docs: Documentation only changes
  • feat: A new feature (example scopes: init, add, remove, ...)
  • fix: A bug fix (example scopes: init, add, remove, ...)
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Reverts a previous commit
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

Body

Use the body to explain what and why vs. how. The body should include the motivation for the change and contrast this with previous behavior. The body should also include any relevant notes about implementation. This is where you can go into detail about the changes and reasons. You can also use the body to explain your commit if it is complex. The body is optional and is not always needed. Not all commits are complex enough to warrant a body. Limit the body to 50 characters.

Commitlint Support

We use commitlint to lint our commit messages. Commitlint checks if your commit message meets the conventional commit format. If you don't follow the format, commitlint will warn you.

Examples

git commit -m "feat: add hat wobble"
git commit -m "fix: remove error message"
git commit -m "docs: explain hat wobble"
git commit -m "style: hat wobble"
git commit -m "refactor: share logic between 4d3d3d3 and flarhgunnstow"
git commit -m "test: ensure Tayne retains clothing"
git commit -m "chore: add Oyster build script"

References