Skip to content

Git commits messages convention

Matt Kadlubowski edited this page Feb 23, 2022 · 1 revision

Introduction

Conventional Commits shield Gitmoji shield

πŸ’Œ This project uses Conventional Commits, and Gitmoji commits conventions for the default branch (main) only.

We want commit messages to be:

  • short - withing one line (entire line maximum of 72 characters),
  • crystal-clear - quickly and briefly explaining the changes,
  • easy to navigate through the git log (with emojis and references).

Pull Requests

πŸ”° We know that writing commit messages might be overwhelming for beginners. For this reason, we simplified the process. We're using Squash and merge strategy for every Pull Request.

πŸ’‘ Pieces of advice:

Try to make your Pull Requests changes small.
It is better to break your changes into smaller Pull Requests.
Don't bring too much into one plate. Otherwise, it will be harder for you to think about a suitable title for your Pull Request to summarize the changes.

Title

‼️ The most important for us is the Pull Request title, which has to follow our convention, with the following pattern:

<type><scope>: <emoji> <description> <reference>

Whereas:

Tag Required? Description Example
<type> ❗ Yes Overall type of the Pull Request. fix
<scope> No Scope of the changes are related to. Wrapped with parentheses. (helpers/isModule)
<emoji> ❗ Yes Emoji from the Gitmoji. You are free to add a new one, as long as it makes sense. Use emoji, not the code (.e.g. :bug:). πŸ›
<description> ❗ Yes Short and brief explanation of the changes. Keep in mind that everything has to fix within 72 characters. Capitalize the subject line, use the imperative mood and do not end with a period. Incorrect return type
<reference> No GitHub reference number to the Issue or Pull Request for more detailed information. Wrapped in parentheses. Starts with #. You don't need to add it for the Pull Request title, as during "Squash and merge" it will automatically append. (#10)

Summary:

fix(helpers/isModule): πŸ› Incorrect return type (#11)

More examples:

chore: ⬆️ Upgrade dependencies
feat(packages/eslint-config): ✨ Add support for `React`

Commits messages in the Pull Request

πŸ“© As for the pushed commits messages convention inside the Pull Request... whatever helps you sail your boat. πŸ˜‰
Although, we recommend reading the article "How to Write a Git Commit Message" first.

βœ… Also, inside the Pull Request, you are allowed to:

  • force push to your Pull Request,
  • rebase the history.

However, keep in mind that those are advanced practices. So, firstly, make sure you learn and understand about how it works. These are recommended resources:


Writing a commit message

There is more than one way to write a commit message. We are Terminal Nerds πŸ€“!!!, so, obviously we recommend using CLI.

Using CLI

🌟 The current recommended CLI (Command Line Interface) tool for both of these commit conventions is the gacp Node.js package. Install it globally.

Using Visual Studio Code

This extension should ease the process of writing a commit message.