Derex.dev

Fun and Effective Commit Messages

Conventional Commits is a set of rules. These rules help you write clear and consistent commit messages. Think of it like a secret code. It helps you and your teammates talk better about code changes. Here are some of the most common types of commit messages you’ll encounter:

New Feature!

When you add something exciting to your application, like a shiny new button or a cool new page, you use feat. This tells everyone, “Hey, check out this awesome new feature!”

Example:

feat: add a dark mode toggle


Squash Bugs!

If you find and fix a pesky bug that’s been causing trouble, you’ll want to use fix. This shows that you’ve solved a problem, making the app better for everyone.

Example:

fix: correct typo in the login error message


The Little Things

Sometimes, you need to make changes that don’t change how the app works. This could be updating a library or cleaning up the code. You call these chores. They keep everything tidy without changing any features.

Example:

chore: update README with installation instructions


Document the Journey

When you make changes to the documentation—like fixing a typo or adding new instructions—you’ll use docs. This is important because it helps everyone understand how to use the app.

Example:

docs: update API documentation for new endpoints


Make It Pretty

If you change how the code looks without changing what it does, use style. This includes fixing indentation or removing extra spaces. This keeps the code looking sharp!

Example:

style: format code to follow style guide


Improve the Code

When you change the code to make it better, but you don’t add features or fix bugs, you use refactor. This is all about improving the structure of the code.

Example:

refactor: simplify user authentication logic


Speed Things Up

If you make changes that make the app faster or more efficient, you’ll want to use perf. Everyone loves a speedy app!

Example:

perf: optimize image loading for faster page rendering


Ensure Quality

When you add tests to check that your code works or fix existing tests, you use test. This helps keep the code reliable.

Example:

test: add unit tests for user login functionality


The Foundation

You mark changes that affect the build system or external dependencies with build. This includes things like updating a package. This ensures your project runs efficiently.

Example:

build: upgrade to latest version of Node.js


Continuous Integration

If you make changes related to continuous integration configurations, you’ll use ci. This helps automate the testing and deployment process.

Example:

ci: update GitHub Actions workflow for deployment


Going Back in Time

When you need to undo a previous change, you use revert. It’s like hitting the rewind button!

Example:

revert: remove feature that caused crashes

The Why?

Using these conventions helps keep your commit history clear and organized. It’s like having a well-labeled filing cabinet for all your code changes. When everyone follows the same rules, understanding the project becomes easier. This is especially helpful when you look back at your work months later.

The specification for Conventional Commits can be found at [Conventional Commits](https://www.conventionalcommits.org/). This specification outlines a lightweight convention on top of commit messages, making it easier to create an explicit commit history and automate tools based on these messages.

Did I make a mistake? Please consider sending a pull request .