🚀Prettify git commit with gitmoji🐛.

Sivaprasad EV
CodeX
Published in
3 min readMar 1, 2023

If you are a developer like me, Git would be an unavoidable tool in your everyday coding. Git is a Version Control System ( VCS ) Introduced by Linus Torvalds in 2005, and it is now one of the most popular Version Control Systems among developers. In Git, during the commit phase, you will add some messages with it to later identify the activities you have done in a particular file.

A typical git’s commit history will look like this;

normal-git-commit-history

Note : Run the git log command in your terminal to get the complete commit history.

As you can see in the figure above, the commits are not well organized nor grouped properly based on commit messages. For Instance, when I fix a bug it will not show under any bug fix category because Git does not have a mechanism to classify commits based on commit messages.

Gitmoji is a simple solution to this concern. It is a library, and it has some pre-defined emojis that are responsible for grouping and categorizing commit messages. For example, a fire emoji (🔥) specifies removal code or files, and an ambulance emoji ( 🚑 ) indicates a critical hotfix.

A typical commit history using gitmoji will look like this;

gitmoji-commit-history

How about the look and feel of gitmoji commit history? It’s pretty. Isn’t it?

I would say it is pretty enough when comparing to git’s default styling. Considering the above gitmoji commit history, all the commits are now self-explanatory. When you make your git log like this, It is easy to filter out logs based on bugs, hotfixes, or any other features in the future. For example, If you want to filter all the bug-related commits, follow the below steps.

  1. go to gitmoji.dev
  2. click on 🐛emoji to copy that
  3. Once copied, run the below git command
git log --grep <paste-your-emoji>

The above command will list all the commits related to bug fixes.

Note : The grep flag is for searching a given pattern in the git log. It is a Linux command to do the same.

I hope you understand the significance of using gitmoji. Let us see how to Install and make your first gitmoji commit.

Installation

A CLI ( Command Line Interface ) is required to use gitmoji in your application. This can be installed using npm;

npm i -g gitmoji-cli

First commit using gitmoji

I will take you through an example how to commit using gitmoji.

  • First, create a simple text file in a git initialized directory.
  • add some contents into it and do git add command.
  • once all your changes are staged, type gitmoji -c command in the terminal.
  • choose a gitmoji.
  • Enter the commit title.
  • finally, enter the commit message.

Congratulations! you have successfully commited a file using gitmoji.

  • you might have noticed that I have used -c flag with gitmoji command. It is one of the option provided by gitmoji to do a commit.
  • gitmoji supports other useful options too. run gitmoji -h to list them all.

That’s it for this article. I hope you have got something new today.

Thank you for reading. See you next time 👋👋

Next Step

Read more about gitmoji here .

You can also connect with me on linktree.

--

--