Emoji-Log: A new way to write Git commit messages

Emoji-Log: A new way to write Git commit messages

Add context to your commits with Emoji-Log.

Emojis on a keyboard
Image credits : 

Photo byΒ iabzdΒ onΒ Unsplash


Subscribe now

Get the highlights in your inbox every week.

I'm a full-time open source developerβ€”or, as I like to call it, an 🎩 open sourcerer. I've been working with open source software for over a decade and built hundreds of open source software applications.

I also am a big fan of the Don't Repeat Yourself (DRY) philosophy and believe writing better Git commit messagesβ€”ones that are contextual enough to serve as a changelog for your open source softwareβ€”is an important component of DRY. One of the many workflows I've written is Emoji-Log, a straightforward, open source Git commit log standard. It improves the developer experience (DX) by using emoji to create better Git commit messages.

I've used Emoji-Log while building the VSCode Tips & Tricks repo, my πŸ¦„ Shades of Purple VSCode theme repo, and even an automatic changelog that looks beautiful.

Emoji-Log's philosophy

I like emoji (which is, in fact, the plural of emoji). I like 'em a lot. Programming, code, geeks/nerds, open source… all of that is inherently dull and sometimes boring. Emoji help me add colors and emotions to the mix. There's nothing wrong with wanting to attach feelings to the 2D, flat, text-based world of code.

Instead of memorizing hundreds of emoji, I've learned it's better to keep the categories small and general.Β Here's the philosophy that guides writing commit messages with Emoji-Log:

  1. Imperative
    • Make your Git commit messages imperative.
    • Write commit message like you're giving an order.
      • e.g., Use βœ… Add instead of ❌ Added
      • e.g., Use βœ… Create instead of ❌ Creating
  2. Rules
    • A small number of categories are easy to memorize.
    • Nothing more, nothing less
      • e.g. πŸ“¦ NEW, πŸ‘Œ IMPROVE, πŸ› FIX, πŸ“– DOC, πŸš€ RELEASE, and βœ… TEST
  3. Actions
    • Make Git commits based on actions you take.
    • Use a good editor like VSCode to commit the right files with commit messages.

Writing commit messages

Use only the following Git commit messages. The simple and small footprint is the key to Emoji-Logo.

    • Use when you add something entirely new.
      • e.g., πŸ“¦ NEW: Add Git ignore file
    • Use when you improve/enhance piece of code like refactoring etc.
      • e.g., πŸ‘Œ IMPROVE: Remote IP API Function
    • Use when you fix a bug. Need I say more?
      • e.g., πŸ› FIX: Case converter
    • Use when you add documentation, like README.md or even inline docs.
      • e.g., πŸ“– DOC: API Interface Tutorial
    • Use when you release a new version. e.g., πŸš€ RELEASE: Version 2.0.0
    • Use when you release a new version.
      • e.g., βœ… TEST: Mock User Login/Logout

That's it for now. Nothing more, nothing less.

Emoji-Log functions

For quick prototyping, I have made the following functions that you can add to your .bashrc/.zshrc files to use Emoji-Log quickly.

#.# Better Git Logs.
### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log).

# Git Commit, Add all and Push β€” in one step.
function gcap() {
    git add . && git commit -m "$*" && git push

# NEW.
function gnew() {
    gcap "πŸ“¦ NEW: $@"

function gimp() {
    gcap "πŸ‘Œ IMPROVE: $@"

# FIX.
function gfix() {
    gcap "πŸ› FIX: $@"

function grlz() {
    gcap "πŸš€ RELEASE: $@"

# DOC.
function gdoc() {
    gcap "πŸ“– DOC: $@"

function gtst() {
    gcap "βœ… TEST: $@"

To install these functions for the fish shell, run the following commands:

function gcap; git add .; and git commit -m "$argv"; and git push; end;
function gnew; gcap "πŸ“¦ NEW: $argv"; end
function gimp; gcap "πŸ‘Œ IMPROVE: $argv"; end;
function gfix; gcap "πŸ› FIX: $argv"; end;
function grlz; gcap "πŸš€ RELEASE: $argv"; end;
function gdoc; gcap "πŸ“– DOC: $argv"; end;
function gtst; gcap "βœ… TEST: $argv"; end;
funcsave gcap
funcsave gnew
funcsave gimp
funcsave gfix
funcsave grlz
funcsave gdoc
funcsave gtst

If you prefer, you can paste these aliases directly in your ~/.gitconfig file:

# Git Commit, Add all and Push β€” in one step.
cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f"

# NEW.
new = "!f() { git cap \"πŸ“¦ NEW: $@\"; }; f"
imp = "!f() { git cap \"πŸ‘Œ IMPROVE: $@\"; }; f"
# FIX.
fix = "!f() { git cap \"πŸ› FIX: $@\"; }; f"
rlz = "!f() { git cap \"πŸš€ RELEASE: $@\"; }; f"
# DOC.
doc = "!f() { git cap \"πŸ“– DOC: $@\"; }; f"
tst = "!f() { git cap \"βœ… TEST: $@\"; }; f"

Emoji-Log examples

Here's a list of repos that use Emoji-Log.


About the author

Ahmad Awais
Ahmad Awais - πŸ‘¨β€πŸ« Edutainer at VSCode.pro 🎩 Full-time #OpenSourcerer πŸ₯‘ JavaScript Developer Advocate πŸ˜‚ Hilarious comedian πŸ”₯ Ridiculously hard-working Full Stack Web Developer ⓦ Regular WordPress Core Developer πŸ“£ TEDx Speaker ✌️ Spends 50-80% of his time building professional FOSS (Free & Open Source Software) used by over 218,900 Developers πŸ™Œ Cloud Community Evangelist 🎯 JavaScript & DevOps...