Creating a pretty git log

Wesley Camargo
FAUN — Developer Community 🐾
2 min readMay 1, 2021

--

Do you know git lg command? Git log command is very helpful, but sometimes, it can be a bit tricky to have a good view of your history tree. I’ll show with simple commands how to improve that and create your customized log message :).

The default git log command brings a lot of useful information, as we can see in the picture below. But when you need to know which branch your commit was originally created, it didn’t give you a good tree view of that.

Using git pretty formats

To solve that you can increment the git log command with pretty formats. The following formats are how I like to use, but you can check more options in the documentation: https://git-scm.com/docs/pretty-formats.

And this is how it looks like:

Creating git alias

Type this command every time can be a bit complicated, but no one needs to memorize that :). We can create an alias with the command below:

Behind the scenes, the alias will change your git configurations adding a line to your ~/.gitconfig file. To check which are your current configuration you can execute the commandgit config — list . It will list all your configurations, to see only alias type git config — get-regexp alias .

So finally we can call the alias created with the git lg command :)

I hope it can be useful, and see you in the next post!

Join FAUN: Website 💻|Podcast 🎙️|Twitter 🐦|Facebook 👥|Instagram 📷|Facebook Group 🗣️|Linkedin Group 💬| Slack 📱|Cloud Native News 📰|More.

If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇

--

--