|
| 1 | +## Git Commit Message Convention |
| 2 | + |
| 3 | +Using conventional commit messages, we can automate the process of generating the CHANGELOG file. All commits messages |
| 4 | +will automatically be validated against the following regex. |
| 5 | + |
| 6 | +``` js |
| 7 | +/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|ci|chore|types|build|improvement)((.+))?: .{1,50}/ |
| 8 | +``` |
| 9 | + |
| 10 | +## Commit Message Format |
| 11 | + |
| 12 | +A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and ** |
| 13 | +subject**: |
| 14 | + |
| 15 | +> The **scope** is optional |
| 16 | +
|
| 17 | +``` |
| 18 | +feat(router): add support for prefix |
| 19 | +
|
| 20 | +Prefix makes it easier to append a path to a group of routes |
| 21 | +``` |
| 22 | + |
| 23 | +1. `feat` is type. |
| 24 | +2. `router` is scope and is optional |
| 25 | +3. `add support for prefix` is the subject |
| 26 | +4. The **body** is followed by a blank line. |
| 27 | +5. The optional **footer** can be added after the body, followed by a blank line. |
| 28 | + |
| 29 | +## Types |
| 30 | + |
| 31 | +Only one type can be used at a time and only following types are allowed. |
| 32 | + |
| 33 | +- feat |
| 34 | +- fix |
| 35 | +- docs |
| 36 | +- style |
| 37 | +- refactor |
| 38 | +- perf |
| 39 | +- test |
| 40 | +- workflow |
| 41 | +- ci |
| 42 | +- chore |
| 43 | +- types |
| 44 | +- build |
| 45 | + |
| 46 | +If a type is `feat` or `fix`, then the commit will appear in the CHANGELOG.md file. However if there is any BREAKING |
| 47 | +CHANGE, the commit will always appear in the changelog. |
| 48 | + |
| 49 | +### Revert |
| 50 | + |
| 51 | +If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. |
| 52 | +In the body it should say: `This reverts commit <hash>`., where the hash is the SHA of the commit being reverted. |
| 53 | + |
| 54 | +## Scope |
| 55 | + |
| 56 | +The scope could be anything specifying place of the commit change. For example: `router`, `view`, `querybuilder` |
| 57 | +, `database`, `model` and so on. |
| 58 | + |
| 59 | +## Subject |
| 60 | + |
| 61 | +The subject contains succinct description of the change: |
| 62 | + |
| 63 | +- use the imperative, present tense: "change" not "changed" nor "changes". |
| 64 | +- don't capitalize first letter |
| 65 | +- no dot (.) at the end |
| 66 | + |
| 67 | +## Body |
| 68 | + |
| 69 | +Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". The body should |
| 70 | +include the motivation for the change and contrast this with previous behavior. |
| 71 | + |
| 72 | +## Footer |
| 73 | + |
| 74 | +The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues |
| 75 | +that this commit **Closes**. |
| 76 | + |
| 77 | +**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit |
| 78 | +message is then used for this. |
0 commit comments