-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ✨ add commit guidelines #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c2c6747
feat: :sparkles: add commit guidelines
signekb 3ff78b8
chore: add "Workflows" section with the commit guidelines
signekb fe47eed
refactor: :recycle: apply suggestions from code review
signekb 632e511
refactor: :recycle: apply suggestions from code review
signekb 37c695f
chore(pre-commit): :pencil2: automatic fixes
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| # Commits | ||
|
|
||
| This guide covers how we in the Seedcase Project commit changes to our | ||
| repositories. By following a set of guidelines you can ensure that the commit | ||
| history is clear and consistent, which allows for automatic | ||
| generation of changelogs and increasing the version number of the project. | ||
|
|
||
| This page describes when and what to commit, the Conventional | ||
| Commits specification, and how to apply it to both code and non-code | ||
| projects. | ||
|
|
||
| ## When and what to commit | ||
|
|
||
| It's best to follow a few guidelines for when and what you | ||
| commit. In general, aim to: | ||
|
|
||
| - Make atomic commits: Each commit should represent a single logical | ||
| change. | ||
| - Commit often: Make commits frequently to capture progress and | ||
| changes. | ||
| - Write short and meaningful messages: Write clear and descriptive | ||
| commit messages that explain the change by following the [Conventional Commits](#conventional-commits) | ||
| specification for the messages. | ||
|
|
||
| ## Conventional commits {#conventional-commits} | ||
|
|
||
| [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) | ||
| is a specification for writing commit messages that makes it easier to | ||
| understand the history of a project and automate versioning and | ||
| changelogs. | ||
| To learn more about the reasons for using Conventional Commit (with [Gitmoji](https://gitmoji.dev/)), check out the [decision | ||
| post](https://decisions.seedcase-project.org/why-conventional-commits/) | ||
| documenting it. | ||
|
|
||
| The Conventional Commits specification generally follows the format: | ||
|
|
||
| ``` bash | ||
| <type>[optional scope]: <description> | ||
|
|
||
| [optional body] | ||
|
|
||
| [optional footer(s)] | ||
| ``` | ||
|
|
||
| For example: | ||
|
|
||
| ``` bash | ||
| fix: prevent overwriting existing raw files | ||
| ``` | ||
|
|
||
| Where: | ||
|
|
||
| - `<type>` is the type of change. | ||
| - `[optional scope]` indicates the area of the codebase affected by | ||
| the change. | ||
| - `<description>` is a brief summary of the change. | ||
| - `[optional body]` provides additional context or details about the | ||
| change. | ||
| - `[optional footer(s)]` includes breaking changes or references to | ||
| issues/tasks. | ||
|
|
||
| ::: callout-tip | ||
| Do you want an easier time making Conventional Commits and you use VS Code? | ||
| Then install the extension [Conventional | ||
| Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits) | ||
| to help write the messages, which also includes the emojis from Gitmoji. | ||
| Adding emojis is a nice way of making the messages more expressive and visually appealing. | ||
| ::: | ||
|
|
||
| ### Required: type and description | ||
|
|
||
| The `<type>` in Conventional Commits is inspired by [Angular's commit | ||
| message | ||
| conventions](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines) | ||
| and is used to categorise the changes made in the commit: | ||
|
|
||
| - `build`: Changes that affect the build system or external | ||
| dependencies. | ||
| - `ci`: Changes to the CI configuration files and scripts. | ||
| - `docs`: Documentation only changes. | ||
| - `feat`: A new feature. | ||
| - `fix`: A bug fix. | ||
| - `perf`: A code change that improves performance. | ||
| - `refactor`: A code change that neither fixes a bug nor adds a | ||
| feature. | ||
| - `style`: Changes that do not affect the meaning of the code | ||
| (white-space, formatting, missing semi-colons, etc). | ||
| - `test`: Adding tests or correcting existing tests. | ||
| - `revert`: Reverts a previous commit. | ||
| - `chore`: Other changes that don't modify source or test files. | ||
|
|
||
| The `<description>` section is where you write a short summary of the change. | ||
| Write it to be | ||
| descriptive enough to understand the change without needing to look at | ||
| the actual changes. Write it in the imperative, present tense | ||
| (i.e., "change" not "changed" nor "changes"), not capitalized, and | ||
| without a period at the end. | ||
|
|
||
| ### Optional: scope, body, and footer(s) | ||
|
|
||
|
|
||
| Whenever you want to expand on the `<description>`, you can add an | ||
| `[optional body]` that provides more context or details about the | ||
| change. This might include the motivation for the change, how it was | ||
| implemented, or any other relevant information that didn't fit in the | ||
| description. | ||
|
|
||
| The `[optional footer(s)]` is used for various purposes, such as | ||
| indicating breaking changes or referencing issues. The main use for this | ||
| footer is to indicate a breaking change, where you would add a footer in | ||
| the format `BREAKING CHANGE: <description>`. Whenever a breaking change | ||
| is committed, you also need to add a `!` after the `<type>` in the commit message. For example: | ||
|
|
||
| ``` md | ||
| feat!: new feature that breaks existing functionality | ||
|
|
||
| BREAKING CHANGE: This feature changes the way the existing functionality | ||
| works, so it is not backward compatible. | ||
| ``` | ||
|
|
||
signekb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ::: callout-tip | ||
| In the Seedcase Project, we tend not to use `[optional scope]` too | ||
| often. We mostly use it in automatic commits that are generated by tools like | ||
| [Dependabot](https://github.com/dependabot). | ||
| ::: | ||
|
|
||
| ## Conventional commits for non-code projects | ||
|
|
||
| The Conventional Commit specification was created for software or | ||
| code-related projects, but it can also be used for documentation, workshops, | ||
| and other non-code projects. In non-code projects, the `<type>` can be | ||
| adapted so that meaningful changelogs and versioning updates can still be | ||
| generated automatically. | ||
|
|
||
| Some of the `<types>` are the same in documentation and other non-code | ||
| projects as in software projects. The ones that are the same between code and non-code projects are `build`, `ci`, `style`, | ||
| `chore`, and `revert`. The ones that are not relevant for non-code projects are `test`, `perf`, and `docs` (since documentation is often the main thing being changed). | ||
| Instead, use other `<types>` that are more descriptive of the | ||
| change being made, which are different from code projects: | ||
|
|
||
| - `feat`: Changes that add new content. | ||
| - `refactor`: Changes that modify or revise existing content, where | ||
| the meaning or intent stays the same. This is used in editing or | ||
| proofreading phases or tasks. | ||
| - `fix`: Changes that fix typos, grammatical errors, incomplete | ||
| sentences, or other similar writing mix-ups/situations where the | ||
| text doesn't align with our original intent. | ||
|
|
||
|
|
||
| As for emojis, use them in the same way as in software | ||
| projects. The only emoji exception is the `:memo:` (:memo:) emoji that | ||
| is used for documentation-related commits. In the same way as the `docs` | ||
| `<type>`, it is redundant when almost all changes are related to | ||
| documentation. Instead, use other emojis that are more descriptive of | ||
| the change being made or omit the emoji altogether. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.