Ahmad Awais

NAVIGATE


SHARE


Show Emoji in Git Log! πŸ‘Œ

Ahmad AwaisAhmad Awais

πŸ†• Check out Emoji Log and 🌟star it on GitHub here β†’

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 bad if you want to add emotions to this 2D flat text-based world of code.

But the problem is that on MacOS the $ git log command is a little emoji-racist (yes, it’s a term that I coined and I have a post that I am writing about it). Apparently, if you run $ git log in your terminal it doesn’t display emoji.

$ git log
commit f60fd4a63be2c42588249a6db036b62c4ca2c0c8
Author: Ahmad Awais <[email protected]>
Date: 1 min ago
<U+1F4E6> Test Samples!

But if you add the argument --no-pager to it, that does work.

$ git log --no-pager
commit f60fd4a63be2c42588249a6db036b62c4ca2c0c8
Author: Ahmad Awais <[email protected]>
Date: 1 min ago
πŸ“¦ Test Samples!

So, after searching a bit, I found out that Git’s pager defaults to less. So, my next attempt was to try and print an emoji with less. Didn’t work. Now, I knew what was causing this issue. It was definitely less.

Less Emoji

After trying to disable less on recommendations from several answers over there at StackOverflow, I almost gave up, as none of that worked.

Finally, I thought about updating less as MacOS comes with a pretty old version of less, I think it was 458, whereas the current version of less is 530. (If MacOS was open source, I’d have found myself pushing a PR to update less β€” Apple, did you hear that?!).

So, our old friend Homebrew came to rescue. Instead of going through the trouble of downloading and compiling the latest source of less I just ran the following command.

brew install homebrew/core/less

Since less which used to be a part of homebrew/dupes was migrated to homebrew/core. And guess what, this is what fixed my git log.

git log

πŸ’‘#

Make your git log even better! I use the following alias in my ZSH/Bash rc files. It saves lots of space and gives me more human readable info.

alias lg="git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(red)%h%C(r) β€”β€” %C(bold blue)%an%C(r): %C(white)%s%C(r) %C(dim white) %C(bold green)(%ar)%C(r) %C(bold yellow)%d%C(r)' --all"

And I end up with this:

better git log alias

Peace! ✌

Founder & CEO at Langbase.com Β· Ex VP DevRel Rapid Β· Google Developers Advisory Board (gDAB) founding member. πŸ§‘β€πŸ’» AI/ML/DevTools Angel Investor ❯ AI/ML Advisory Board member San Francisco, DevNetwork

🎩 Award-winning Open Source Engineer & Dev Advocate 🦊 Google Developers Expert Web DevRel πŸš€ NASA Mars Ingenuity Helicopter mission code contributor πŸ† 8th GitHub Stars Award recipient with 3x GitHub Stars Award (Listed as GitHub's #1 JavaScript trending developer).

🌳 Node.js foundation Community Committee Outreach Lead, Member Linux Foundation, OpenAPI Business Governing Board, and DigitalOcean Navigator. πŸ“Ÿ Teaching thousands of developers Node.js CLI Automation (100 videos Β· 22 Projects) & VSCode.pro course. Over 142 Million views, 22 yrs Blogging, 56K developers learning, 200+ FOSS.

✌️ Author of various open-source dev-tools and software libraries utilized by millions of developers worldwide ⓦ WordPress Core Developer πŸ“£ TEDx Speaker with 100+ international talks.

✨ As quoted by: Satya Nadella Β· CEO of Microsoft β€” Awais is an awesome example for developers.
πŸ™Œ Leading developers and publishing technical content for over a decade πŸ’œ Loves his wife (Maedah) ❯ Read more about Ahmad Awais.

πŸ‘‹β€¦ Awais is mostly active on Twitter @MrAhmadAwais

πŸ“¨

Developers Takeaway

Stay ahead in the web dev community with Ahmad's expert insights on open-source, developer relations, dev-tools, and side-hustles. Insider-email-only-content. Don't miss out - subscirbe for a dose of professional advice and a dash of humor. No spam, pinky-promise!

✨ 172,438 Developers Already Subscribed
Comments 4
  • Jan
    Posted on

    Jan Jan

    Reply Author

    Hey Ahmad,
    this might be a dump question, but how do I add the Emoji Log to my projects?

    Best,
    Jan


    • Ahmad Awais
      Posted on

      Ahmad Awais Ahmad Awais

      Reply Author

      Hey, Jan! πŸ™Œ
      Nice to see you here. You can read about that here https://github.com/ahmadawais/Emoji-Log β€” the addition of Emoji-log to your projects and commit linting is something I am working on off an on. But the readme should give you the snippets to use.

      Peace! ✌️


  • LGM
    Posted on

    LGM LGM

    Reply Author

    Thanks for that tip!

    BTW, that monospaced font is beautiful.


    • Ahmad Awais
      Posted on

      Ahmad Awais Ahmad Awais

      Reply Author

      Awesome! πŸ’―
      It’s the same font I recommended in my VSCode.pro course. It’s free and called IBM Plex Mono.