After building hundreds of open source software I've ended up inventing a git commit log standard called EMOJI-LOG
that helps me understand a project's history with a less cognitive load just by looking at the git log.
I like emoji. I like βem a lot. Programming, code, geeks/nerds, open-source, all of that is inherently dull and sometimes boring. Emoji (which is, in fact, the plural of emoji) helps me add colors and emotions to the mix. Nothing wrong if you want to attach feelings to this 2D flat text-based world of code. I found out that instead of memorizing hundreds of emoji it's better to keep the categories small and general.
- IMPERATIVE β
- Make your Git commit messages imperative.
- Write a commit message like you're giving an order.
- E.g., Use β
Add
instead of βAdded
. - E.g., Use β
Create
instead of βCreating
.
- RULES β
- A small number of categories β easy to memorize.
- Nothing more nothing less.
- E.g.
π¦ NEW
,π IMPROVE
,π FIX
,π DOC
,π RELEASE
,π€ TEST
, andβΌοΈ BREAKING
- ACTIONS β
- Make git commits based on the actions you take.
- Use a good editor like VSCode to commit the right files with commit messages.
Only use the following Git Commit Messages. A simple and small footprint is critical here.
-
π¦ NEW: IMPERATIVE_MESSAGE_GOES_HERE
Use when you add something entirely new. E.g.
π¦ NEW: Add Git ignore file
-
π IMPROVE: IMPERATIVE_MESSAGE_GOES_HERE
Use when you improve/enhance piece of code like refactoring etc. E.g.
π IMPROVE: Remote IP API Function
-
π FIX: IMPERATIVE_MESSAGE_GOES_HERE
Use when you fix a bug β need I say more? E.g.
π FIX: Case conversion
-
π DOC: IMPERATIVE_MESSAGE_GOES_HERE
Use when you add documentation like
README.md
, or even inline docs. E.g.π DOC: API Interface Tutorial
-
π RELEASE: IMPERATIVE_MESSAGE_GOES_HERE
Use when you release a new version. E.g.
π RELEASE: Version 2.0.0
-
π€ TEST: IMPERATIVE_MESSAGE_GOES_HERE
Use when it's related to testing. E.g.
π€ TEST: Mock User Login/Logout
-
βΌοΈ BREAKING: IMPERATIVE_MESSAGE_GOES_HERE
Use when releasing a change that breaks previous versions. E.g.
βΌοΈ BREAKING: Change authentication protocol
β That's it for now. Nothing more nothing less.
I'd like to share what each of these emojis mean.
π¦ NEW:
Emoji meaning: A "package emoji" β which can contain new stuff.π IMPROVE:
Emoji meaning: An "OK Hand emoji" β which is meant to appreciate an improvement.π FIX:
Emoji meaning: A "bug emoji" β which means there was a bug that got fixed.π DOCS:
Emoji meaning: A "book emoji" β which means documentation or notes just like in a book.π RELEASE:
Emoji meaning: A "rocket emoji" β which is meant to show a new release/launch.π€ TEST:
Emoji meaning: A "robot emoji" β which says some test were run successfully.βΌοΈ BREAKING:
Emoji meaning: A "bangbang emoji" β which attracts attention to a breaking change.
If you use VSCode, then I have built an extension Emoji-Log for VSCode. This can help you write git commit messages quickly.
For quick prototyping, I have made the following functions that you can add to your .bashrc
/.zshrc
files and 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.
gcap() {
git add . && git commit -m "$*" && git push
}
# NEW.
gnew() {
gcap "π¦ NEW: $@"
}
# IMPROVE.
gimp() {
gcap "π IMPROVE: $@"
}
# FIX.
gfix() {
gcap "π FIX: $@"
}
# RELEASE.
grlz() {
gcap "π RELEASE: $@"
}
# DOC.
gdoc() {
gcap "π DOC: $@"
}
# TEST.
gtst() {
gcap "π€ TEST: $@"
}
# BREAKING CHANGE.
gbrk() {
gcap "βΌοΈ BREAKING: $@"
}
gtype() {
NORMAL='\033[0;39m'
GREEN='\033[0;32m'
echo "$GREEN gnew$NORMAL β π¦ NEW
$GREEN gimp$NORMAL β π IMPROVE
$GREEN gfix$NORMAL β π FIX
$GREEN grlz$NORMAL β π RELEASE
$GREEN gdoc$NORMAL β π DOC
$GREEN gtst$NORMAL β π§ͺοΈ TEST
$GREEN gbrk$NORMAL β βΌοΈ BREAKING"
}
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;
function gbrk; gcap "βΌοΈ BREAKING: $argv"; end;
funcsave gcap
funcsave gnew
funcsave gimp
funcsave gfix
funcsave grlz
funcsave gdoc
funcsave gtst
funcsave gbrk
If you prefer, you can paste these aliases directly in your ~/.gitconfig
file:
# Make sure you're adding under the [alias] block.
[alias]
# 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"
# IMPROVE.
imp = "!f() { git cap \"π IMPROVE: $@\"; }; f"
# FIX.
fix = "!f() { git cap \"π FIX: $@\"; }; f"
# RELEASE.
rlz = "!f() { git cap \"π RELEASE: $@\"; }; f"
# DOC.
doc = "!f() { git cap \"π DOC: $@\"; }; f"
# TEST.
tst = "!f() { git cap \"π€ TEST: $@\"; }; f"
# BREAKING CHANGE.
brk = "!f() { git cap \"βΌοΈ BREAKING: $@\"; }; f"
Here's a list of repos that make use of Emoji-Log.
- Create-Guten-Block Toolkit β
- VSCode Shades of Purple Theme β
- Ahmad Awais GitHub Repos β β Latest repos on this account.
- CaptainCore CLI (WordPress Management Toolkit) β
- CaptainCore GUI (WordPress plugin) β
- You?! Add your repo to the list after adding the Emoji-log badge to your readme.
Alfred PowerPack users can use the Snippets feature to quickly call Emoji-Log, or use the text expand feature for even quicker creation.
To setup:
- Have Alfred 3 with PowerPack installed
- For auto expansion, in Alfred Settings Β» Features Β» Snippets ensure the "Automatically expand snippets by Keyword" box is checked
- Download & open
Emoji-Log.alfredsnippets
, deselecting "Strip snippets of 'auto expand' flag" when prompted
This will give the following text expander keywords for the Emoji-Log:
Keyword | Snippet |
---|---|
;gnew |
π¦ NEW: |
;gimp |
π IMPROVE: |
;gfix |
π FIX: |
;grlz |
π RELEASE: |
;gdoc |
π DOC: |
;gtst |
π€ TEST: |
;gbrk |
To edit the ;
prefix to your preferred expansion flag, double click right click the Emoji-Log Collection in Alfred Settings Β» Features Β» Snippets.
TextExpander Snippets are also available. Download & open
Emoji-Log.textexpander
to import.
If your repo uses EMOJI-LOG
then you can add any of the following badges to your read me and send me a PR to list your repo here.
- STYLE: Flat Square
- MARKDOWN β
[![emoji-log](https://cdn.rawgit.com/ahmadawais/stuff/ca97874/emoji-log/flat.svg)](https://github.com/ahmadawais/Emoji-Log/)
- HTML β
<a href="https://github.com/ahmadawais/Emoji-Log/"><img alt="emoji-log" src="https://cdn.rawgit.com/ahmadawais/stuff/ca97874/emoji-log/flat.svg" /></a>
- STYLE: Flat Rounded
- MARKDOWN β
[![emoji-log](https://cdn.rawgit.com/ahmadawais/stuff/ca97874/emoji-log/flat-round.svg)](https://github.com/ahmadawais/Emoji-Log/)
- HTML β
<a href="https://github.com/ahmadawais/Emoji-Log/"><img alt="emoji-log" src="https://cdn.rawgit.com/ahmadawais/stuff/ca97874/emoji-log/flat-round.svg" /></a>
- STYLE: Non-flat Rounded
- MARKDOWN β
[![emoji-log](https://cdn.rawgit.com/ahmadawais/stuff/ca97874/emoji-log/non-flat-round.svg)](https://github.com/ahmadawais/Emoji-Log/)
- HTML β
<a href="https://github.com/ahmadawais/Emoji-Log/"><img alt="emoji-log" src="https://cdn.rawgit.com/ahmadawais/stuff/ca97874/emoji-log/non-flat-round.svg" /></a>
Me (Ahmad Awais) and my incredible wife (Maedah Batool) are two engineers who fell in love with open source and then with each other. You can read more about me here. If you or your company use any of my projects or like what Iβm doing then consider backing me. I'm in this for the long run. An open-source developer advocate.
- π $9.99/month (recommended) β― Two cups of CaffΓ¨ latte (coffee) every month β
- π $99.99 (one-time sponsor) β― Support an hour of open-source code β
- π° $49.99 (one-time sponsor) β― Support an hour of maintenance β
- βοΈ $9.99 (one-time sponsor) β― Lunch/coffee β
- MIT Β© Ahmad Awais
- Code of Conduct
- Munawar for making awesome badges