DEV Community

loading...

Use emojis to enhance commit messages

lyokolux profile image Lyokolux Originally published at blog.lyokolux.space ・2 min read

There is always a problem when choosing the commits message. It's complicated and we often end up with unclear messages like "Improve clarity".

Since then, some conventions have appeared like Angular or more recently the Conventional Commits. What if we put emojis to make it clearer? 🤘

And that's where Gitmoji comes in: putting meaning in emojis for commits messages. For example, we can have:

✨ Add new feature X

🍱 update favicon

🔥 remove unused css files

Gitmojis like :sparkles: can be written for platforms supporting GFM (notably Github and Gitlab).

Advantages and disadvantages

The ➕

  • emojis are more precise than conventions, there are a number of them
  • the reading of the commit message is simplified and universal
  • and it's still pretty cool

The ➖

  • you need to know their meaning
  • writing gitmojis can be tedious

For these negative points, there are solutions:

First the list may seem impressive, and it is! We can start with a small set of the most used and generic gitmojis.

gitmoji emoji Sens
:sparkles: Addition of a new feature
:bug: 🐛 Fix a bug
:recycle: ♻️ Code Refactoring
:fire: 🔥 Code or file deletion
:pencil: 📝 Writing documentation
:bulb: 💡 Add or modify comments in the source code

Then, you have to enter them. Tools exist for this, for example among others, the official site which allows you to copy and paste the gitmoji codes or directly the emojis (the CTRL+F greatly increases the search speed); or a tool in CLI; or a browser extension ✌️ make life more convenient.
Others are also available and listed on a page of the official website.

✨ Adopt a simple convention

The convention mostly used by the Gitmoji community is simple: <gitmoji> Description. The first word of the description starts with a capital letter. That's it. Simple 💯

After several months of use, adding a scope on some posts seems quite useful to me, like: <gitmoji>(scope):. Sometimes this lends itself well to it! Sometimes not so much. Some emojis don't need a scope: as 🙈 means "Add or update a .gitignore file.", the scope is already included in the meaning of the gitmoji.

In short

Gitmoji is awesome and fun, so you might as well use it 😄
May your commits messages be happy and clear!

Discussion (0)

Forem Open with the Forem app