paint-brush
Using GitHub as a team: the holy grail of commit messagesby@tom.writer89
1,560 reads
1,560 reads

Using GitHub as a team: the holy grail of commit messages

by Thomas WilliamSeptember 20th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Using GitHub with a team is not as easy as it sounds. In this article, I’ll tell you about one tool I’ve come to know during my team projects — <a href="https://gitmoji.carloscuesta.me/"><strong>gitmojis</strong></a>. It really helped me along the&nbsp;way.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Using GitHub as a team: the holy grail of commit messages
Thomas William HackerNoon profile picture

Using GitHub with a team is not as easy as it sounds. In this article, I’ll tell you about one tool I’ve come to know during my team projects — gitmojis. It really helped me along the way.

First things first — commit message

Each commit message consists of three components: header, body, and footer.

The header is required, and body and footer are optional.

The header includes type(required), scope(optional), and subject(required).

  • type The category used to describe the commit is only allowed to use the following 7 identifiers:
  • feat: new features
  • fix: patching bugs
  • docs:documentation
  • style: format (does not affect the movement of the code)
  • refactor: Refactoring (neither new features nor code changes to fix bugs)
  • test: increase the test
  • chore: Changes to the build process
  • scope The range used to describe the impact of the commit, such as the data layer, the control layer, view layer, etc., varies from project to project.
  • subject Is a short description of the purpose of the commit, no more than 50 characters.

Interestingly enough, commit messages can contain emojis too, which can greatly improve on the clarity and structure of the project history. Try it yourself — put the emoji code at the start of the commit message, push the changes to your GitHub or Bitbucket repository and you’ll see the emoji, as shown in the image below.

What is Gitmoji?

Gitmoji is an emoji guide for GitHub commit messages. This not only has the purpose of making the history look more hip, but you can now use the emojis to tag and structure changes to the project. Of course, this only works if all developers are on the same page in the meaning of the same emojis.

How to use Gitmoji?

To use gitmojis from the command line you’ll need to install gitmoji-cli. Gitmoji-cli helps you to search through the gitmoji list.

To install it just run:

$ npm i -g gitmoji-cli

Well done! Now you can easily use a Gitmoji. Get started by running:

$ gitmoji — help












A gitmoji interactive client for using gitmojis on commit messages.UsagegitmojiOptions — init, -i Initialize gitmoji as a commit hook — remove, -r Remove a previously initialized commit hook — config, -g Setup gitmoji-cli preferences. — commit, -c Interactively commit using the prompts — list, -l List all the available gitmojis — search, -s Search gitmojis — version, -v Print gitmoji-cli installed version — update, -u Sync emoji list with the repo

Please note, the commit functionality can be used directly or via a commit-hook.

In the first case, start the interactive commit client, to auto-generate your commit based on your prompts.

$ gitmoji -c

In the second case, run the init option, add your changes and commit them. After that, the prompts will begin and you commit message will be built.

$ gitmoji -i # this will create the .git/hook/prepare-commit-msg


$ git add .$ git commit

To find the right gitmoji use specific keywords. For example:

$ gitmoji bug linter -s

Run gitmoji -g to set up some gitmoji-cli preferences, such as the auto git add . feature.

This project is open source, that means everyone can participate, suggest, discuss and add new emojis. All the gitmojis displayed are rendered from a JSON file.

However, emojis should be used discretely when submitting code. Otherwise, they are likely to cause misunderstanding. So the open source gitmoji project defines the emoji specification that should be followed when submitting code on github.

Note the commit format will be following:

Git commit -m ‘:emoji1: :emoji2: theme’

For example, commit for document description will look like:

Git commit -m ‘📝 documentation description’

Emoji description

🎨 — 🎨 — Improve code structure / code format

⚡️ — ⚡ — Improve performance

🔥 — 🔥 — Remove code or file

🐛 — 🐛 — Fix bug

🚑 — 🚑 — Critical patch

✨ — ✨ — Introducing new features

📝 — 📝 — Write a document

🚀 — 🚀 — Deployment function

💄 — 💄 — Update UI and style files

🎉 — 🎉 — Initial submission

✅ — ✅ — Increase test

🔒 — 🔒 — Fix security issues

🍎 — 🍎 — Fix problems under macOS

🐧 — 🐧 — Fix problems under Linux

🏁 — 🏁 — Fix problems under Windows

🔖 — 🔖 — Release/version label

🚨 — 🚨 — Remove linter warning

🚧 — 🚧 — Work in progress

💚 — 💚 — Remove linter warning

🚨 — 🚨 — Add CI build system

⬇️ — ⬇️ — Downgrade dependence

⬆️ — ⬆️ — Upgrade dependency

👷 — 👷 — Add CI build system

📈 — 📈 — Add an analytics or tracking code

🔨 — 🔨 — Refactoring

➖ — ➖ — One less dependency

🐳 — 🐳 — Docker-related work

➕ — ➕ — Add a dependency

🔧 — 🔧 — Modify configuration file

🌐 — 🌐 — Internationalization and localization

✏️ — ✏️ — Fix typo

💩 — 💩 — Write error codes that need improvement

From now on every git commit pops up the gitmoji dialog and before you can write your title you will need to pick a gitmoji first.

Note: If you use Windows, some emoji will not display properly.

Thanks for reading! Feel free to reach out to me if you have something to say!