π 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.
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.
π‘#
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:
Peace! β
Jan
Hey Ahmad,
this might be a dump question, but how do I add the Emoji Log to my projects?
Best,
Jan
Ahmad Awais
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
Thanks for that tip!
BTW, that monospaced font is beautiful.
Ahmad Awais
Awesome! π―
It’s the same font I recommended in my VSCode.pro course. It’s free and called IBM Plex Mono.