Skip to content

Commit 91ceecb

Browse files
authored
Merge branch 'master' into singapore-conf-summary
2 parents dadbd44 + a5beb06 commit 91ceecb

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Following Conventional Commits
3+
description: This guide teaches you how to write clear and structured commit messages using the Conventional Commits standard.
4+
weight: 120
5+
---
6+
7+
When you contribute to a project, you're not just adding code or docs but also context. Your changes become part of the project's history, and your commit messages explain why the changes were made.
8+
9+
In this guide, you'll explore how to write effective commit messages that follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard. This standard helps you create clear, consistent, and semantically meaningful commit messages that are easy to understand and navigate.
10+
11+
## TL;DR
12+
13+
- **Why**: *Explain* the impact of the change and *how* it benefits users or the project.
14+
- **Types**: Prefix with `feat`, `fix`, etc. (PR titles too).
15+
- **How**: Use imperative, clear text. Keep it short, standalone, and in plain English. Use the body for additional details if needed.
16+
17+
## Overview
18+
19+
A clear, well-crafted commit message is like a signpost that guides us through the project's evolution. It helps us understand the context of your change, why you made it, and how it fits into the bigger picture.
20+
21+
Since this is a message that others will read, it is important to provide enough context to understand the change. Therefore, you should avoid vague messages like "fixed bug." Instead, try to be specific.
22+
23+
For example:
24+
25+
> **Bad:** `fixed bug`
26+
27+
> **Good:** `fix: resolve timeout issue on login by renewing session tokens`
28+
29+
### Choosing the right commit type
30+
31+
A set of commit types helps communicate the nature of a change clearly. Using these types makes it easier to understand the impact of a commit at a glance.
32+
33+
The following are some of the most commonly used commit types:
34+
35+
- **feat:** Choose `feat` for new features. If your change adds functionality or improves our project in some way, use this type.
36+
- **fix:** This type is for bug fixes. If your change corrects an issue or resolves a problem, you should use the `fix` type.
37+
- **docs:** `docs` is for documentation changes. If you update a README, add comments, or make other documentation changes, use this type.
38+
- **style:** The `style` type is for changes that don't affect the code's meaning. For example, white-space, formatting, missing semi-colons, etc.
39+
- **refactor:** Use the `refactor` type for code changes that neither fix a bug nor add a feature. If you reorganize code, rename variables, or make other changes that don't affect the code's behavior, use this type.
40+
- **test:** If your change adds or modifies tests, use the `test` type.
41+
- **chore:** The `chore` type is for changes that don't affect the codebase. If you update build scripts, make tooling changes, or perform other maintenance tasks, use this type.
42+
43+
To maintain a clear and structured commit history, all PR titles must follow the Conventional Commits format. This ensures that commit messages and PRs are semantically meaningful and easy to understand.
44+
45+
A PR title that does not follow this format will be rejected by our [Linting bot](https://github.com/asyncapi/community/blob/master/.github/workflows/lint-pr-title.yml), preventing the PR from being merged.
46+
47+
Therefore, you can use the following examples to guide you:
48+
49+
| Bad | Good |
50+
| --- | --- |
51+
| `Add user avatar upload feature` | `feat: add user avatar upload feature` |
52+
| `Fix login issue` | `fix: resolve timeout issue on login by renewing session tokens` |
53+
54+
If you're not sure which type to use, ask yourself what the main *purpose* of your change is. That should help you pick the right type.
55+
56+
### Use the commit body for additional context
57+
58+
Most times, a one-liner is all you need. But when you need to provide more context, use the commit body to explain the reasoning behind the change, how it was implemented, or any nuances that might help others understand the decision.
59+
60+
To add the commit body, add one blank line after the commit message and then specify the details you want to communicate about the commit.
61+
62+
**Example:**
63+
64+
> feat: add user avatar upload feature to improve user experience on profile pages
65+
> (blank line)
66+
> Adds a form field, validation checks, and an API endpoint for avatar uploads. Enhances profile customization.
67+
68+
Some additional tips to keep in mind when writing commit messages include:
69+
70+
- **Be concise:** Keep your messages brief but informative.
71+
- **Check for consistency and completeness:** Make sure your message stands alone and provides enough context.
72+
- **Use English and avoid jargon:** Stick to plain English to make your messages accessible to everyone.
73+
74+
For more information on Conventional Commits, please refer to the [official website](https://www.conventionalcommits.org/en/v1.0.0/). If you have any questions or need help, feel free to reach out to any maintainer or fellow contributor.

0 commit comments

Comments
 (0)