- See how a minor change to your commit message style can make you a better problem solver and team player, help in automatic generation of the changelog and simple navigation through git history (eg. ignoring style changes).
Basic: git commit -m <message>
Detailed: git commit -m <title> -m <description>
Format: <type>(<scope>): <subject>
<scope> is optional
- Without Scope (if change is global and cant be scoped)
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: Chore, Docs, Feat, Fix, Refactor, Style, or Test.
# example
chore: add tailwind css- With Scope
feat(scope): add magical unicorn
^--^^-----^ ^------------------^
| | |
| | +-> Summary in present tense. Starting with add, remove, update, do. Think about: If I commit this, my code would .... add magical unicorn
| |
| +-> optional scope of the commit, component-name, container
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
# Example
feat(search): add support for searching by date rangefeat: (a new feature is introduced with the changes)fix: (bug fix has occured, not a fix to a build script)docs: (changes to the documentation)style: (formatting, missing semi colons, etc; no production code change)refactor: (refactoring production code, eg. renaming a variable)test: (adding missing tests, refactoring tests; no production code change)chore: (changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies or change in production code))perf– (performance improvements)ci– (continuous integration related)build– (changes that affect the build system or external dependencies)revert– (reverts a previous commit)
- Template with detail
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]- If it contains breaking changes.
fix!: fix foo to enable bar
This fixes the broken behavior of the component by doing xyz.
BREAKING CHANGE
Before this fix foo wasn't enabled at all, behavior changes from <old> to <new>
Closes D2IQ-12345- Clearer example
feat(search)!: add support for searching by date range
BREAKING CHANGE: The search API now requires a start and end date to be specified for all searches. The old API, which only accepted a single search term, is no longer supported.
This commit adds a new feature to the search module that allows users to search for records within a specific date range. The date range can be specified using two new fields on the search form: a start date and an end date.
- Adds new fields to the search form for specifying the date range
- Updates the search API to accept the start and end dates as parameters
- Modifies the search results page to display the selected date range
Closes #223- Capitalization and Punctuation: Use lowercase for all and do not end in punctuation. for Non Conventional Commits, remember to capitalize the first word.
- Length: The first line should ideally be no longer than 50 characters, and the body should be restricted to 72 characters.
- Content: Be direct, try to eliminate filler words and phrases in these sentences (examples: though, maybe, I think, kind of). Think like a journalist.
- Footer: Footer could be link to an issue or jira story and begins with keyword closes
Closes D2IQ-<JIRA #> - Body: uses the imperative, present tense: “change” not “changed” nor “changes” and includes motivation for the change and contrasts with previous behavior.
- Scope: The
<scope>can be empty (eg. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.ex. init,config,proxy. - BREAKING CHANGE: a commit that has a footer or appends
!after the type/scope introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.