|
| 1 | +# Better Find and Replace Development Guidelines |
| 2 | + |
| 3 | +* [Commit Message Standards](#commit-message-standards) |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## <a name="commit-message-standards"></a> Git Commit Standards |
| 8 | + |
| 9 | +To maintain a clean and understandable project history, we follow strict rules for writing git commit messages. These messages not only enhance readability but are also used to automatically generate the **Better Find and Replace changelog**. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +### Commit Message Structure |
| 14 | + |
| 15 | +Each commit message should follow this structure: |
| 16 | + |
| 17 | +``` |
| 18 | +<type>(<scope>): <subject> |
| 19 | +
|
| 20 | +<body> |
| 21 | +
|
| 22 | +<footer> |
| 23 | +``` |
| 24 | + |
| 25 | +- The **header** is **mandatory**. |
| 26 | +- The **scope** in the header is **optional**. |
| 27 | +- Each line should be no longer than **100 characters**, to ensure readability on GitHub and other tools. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +### Reverting a Commit |
| 32 | + |
| 33 | +To revert a commit: |
| 34 | + |
| 35 | +- Start the message with `revert:` followed by the original commit's header. |
| 36 | +- The body should include: |
| 37 | + `This reverts commit <hash>.` |
| 38 | + |
| 39 | +> You can use the [`git revert`](https://git-scm.com/docs/git-revert) command to generate this automatically. |
| 40 | +
|
| 41 | +--- |
| 42 | + |
| 43 | +### Commit Types |
| 44 | + |
| 45 | +Use one of the following types to describe the purpose of the commit: |
| 46 | + |
| 47 | +- **feat**: Introduce a new feature |
| 48 | +- **fix**: Resolve a bug |
| 49 | +- **docs**: Documentation-only changes |
| 50 | +- **style**: Code style changes (e.g., whitespace, formatting, semicolons) |
| 51 | +- **refactor**: Code changes that neither fix a bug nor add a feature |
| 52 | +- **perf**: Code changes that improve performance |
| 53 | +- **test**: Add or update tests |
| 54 | +- **chore**: Changes to tooling, build process, or non-code files |
| 55 | +- **ci**: CI/CD configuration changes (e.g., GitHub Actions, Travis) |
| 56 | +- **build**: Changes to build system or external dependencies (e.g., npm, webpack) |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +### Scope |
| 61 | + |
| 62 | +Use a scope to clarify the area affected, for example: |
| 63 | + |
| 64 | +- `Shipping` |
| 65 | +- `Tax` |
| 66 | +- `Vendor` |
| 67 | + |
| 68 | +Use `*` if the change impacts multiple areas. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +### Subject |
| 73 | + |
| 74 | +The subject line should: |
| 75 | + |
| 76 | +- Be written in **imperative, present tense** (e.g., “add”, “fix”, “update”) |
| 77 | +- Start with a **lowercase** letter |
| 78 | +- **Not** end with a period |
| 79 | + |
| 80 | +Example: |
| 81 | +``` |
| 82 | +fix(tax): correct calculation on inclusive tax |
| 83 | +``` |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +### Body |
| 88 | + |
| 89 | +In the body, use the imperative present tense. |
| 90 | +Describe: |
| 91 | + |
| 92 | +- What was changed |
| 93 | +- Why the change was needed |
| 94 | +- How it differs from previous behavior |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +### Footer |
| 99 | + |
| 100 | +Use the footer to: |
| 101 | + |
| 102 | +- Highlight **breaking changes** |
| 103 | + Start with `BREAKING CHANGE:` followed by an explanation |
| 104 | + |
| 105 | +- Reference GitHub issues using [closing keywords](https://help.github.com/articles/closing-issues-using-keywords/): |
| 106 | + `Closes #123` |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +For a more detailed explanation, refer to the full [Commit Message Style Guide](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#). |
0 commit comments