๐จ [git]: Write better commits with Gitmoji
Gitmoji is an initiative to standardize and explain the use of emojis on GitHub commit messages.
Javid Mougamadou
Notes
Gitmoji is an initiative to standardize and explain the use of emojis on GitHub commit messages.
๐ Intro : How to Write a Git Commit Message
In my case, I only read commits when i would like to track commit changes or to dig commit explanation. Otherwise, I directly read the source code.
Here is an example of good git commit message semantic will look like (according to Gist Semantic Commit Messages)
type must be one of the following mentioned below :
- <build>: Build related changes (eg: npm related/ adding external dependencies)
- <chore>: A code change that external user won't see (eg: change to .gitignore)
- <docs>: Documentation related changes
- <feat>: Introduction of a new feature
- <fix>: Resolve an issue directly linked to development (bugfixes)
- <hotfix>: Resolve an issue directly linked to production (patches)
- <test>: Add/Update test cases
- <performance>: Add code that improves performance
- <refactor>: Update for code for maintainability (clean code)
scope is optional and must be a noun that represents the section of the codebase
Message should be imperative and should describe the commit with a clear message/keywords.
Example of commits :
feat(home, components): Add login modal
fix(home, components): Resolve issue with modal collapses
chore(home): Move icons folder
feat(newsletter): Add Newsletter component
feat(navbar): Add navbar container
๐ Gitmoji
Using emojis on commit messages provides an easy way of identifying the purpose or intention of a commit with only looking at the emojis used. As there are a lot of different emojis I found the need of creating a guide that can help to use emojis easier.
Now we can replace the <type/> with an emoji :
๐จ Improve structure / format of the code.
โก๏ธ Improve performance.
๐ฅ Remove code or files.
๐ Fix a bug.
โจ Introduce new features.
๐ Add or update documentation.
๐ Deploy stuff.
๐ Fix CI Build.
๐ท Add or update CI build system.
๐ง Add or update configuration files.
๐จ Add or update development scripts.
โฐ๏ธ Remove dead code.
Example of commits :
โจ (home, components): Add login modal
๐ (home, components): Resolve issue with modal collapses
๐ (home): Move icons folder
โจ (newsletter): Add Newsletter component
โจ (navbar): Add navbar container
๐ฅ (navbar): Remove old navbar file
โ (home): Add login test case
๐จ (home, component): Improve login modal
๐ฆ๏ธ (npm): Add react-table
๐จ Update script start-server.js
Additionnal icons
๐ณ Add docker-compose.yml
โธ๏ธ (helm): Add postgres helm chart
โธ๏ธ (helm): Update frontend.yaml
โธ๏ธ (helm): Update pvc.yaml
๐ (home): Increase speed load for navbar
๐ (home): Fix issue with MacOS for navbar
Link: EmojiPedia
๐ฆ๏ธ Gitmoji-CLI
A gitmoji interactive client for using gitmojis on commit messages.
Installation
With npm :
On MacOS :
Interactive Client
Start the interactive commit client, to auto generate your commit based on your prompts.
Hook
Run the init option, add your changes and commit them, after that the prompts will begin and your commit message will be built.
git add .
git commit
Search
Search using specific keywords to find the right gitmoji.
List
Pretty print all the available gitmojis.
Config
Run gitmoji -g to setup some gitmoji-cli preferences.
๐จExtensions (Integration with IDE)
Gitmoji for Vscode
Link : https://marketplace.visualstudio.com/items?itemName=Vtrois.gitmoji-vscode
Gitmoji for Atom
Go to Settings (cmd + , or ctrl + ,) > Install and search for gitmoji-atom.
Alternatively, run the following command:
Link : https://atom.io/packages/gitmoji-atom
๐ป Integration with DEV.TO ?
Do you think that we can use it while writing posts for Dev.TO ?
โธ๏ธ Kubernetes
...
Links
- https://emojipedia.org/laptop/
- https://gitmoji.dev/
- https://github.com/carloscuesta/gitmoji
- https://github.com/carloscuesta/gitmoji-cli
- https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716
- https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53
- https://gist.github.com/parmentf/035de27d6ed1dce0b36a
- https://dev.to/i5han3/git-commit-message-convention-that-you-can-follow-1709
- https://dev.to/helderburato/patterns-for-writing-better-git-commit-messages-4ba0
- https://chris.beams.io/posts/git-commit/
Upvote
Javid Mougamadou

Related Articles