Make my git log look pretty and readable

Share this video with your friends

Send Tweet

In order to always have a good overview of what’s going on in our repository, we use git log. However, the build-in git log output format is not really suitable for everyday usage. In this lesson we will create a dedicated git alias lg which will printout a nicely formatted git log list.

The example used in this video:

lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches

But there are more available on the web, just search for it :)

Roberto Zaniboni
Roberto Zaniboni
~ 5 years ago

thanks, very useful.

Juri Strumpflohner
Juri Strumpflohner(instructor)
~ 5 years ago

Hey @Roberto, thx 😊. Glad you liked it and I was able to help 🙂

Kevin E Rad
Kevin E Rad
~ 5 years ago

Great, you can also use tig tool (brew install tig) :)

Oscar Saraza
Oscar Saraza
~ 5 years ago

Hi, I can't make the .gitconfig works as you showed. The command git lggive me an error: "git: 'lg' is not a git command." I created the file on the project's root folder and added the alias. There's any additional step or requirement to this file to work?

Juri Strumpflohner
Juri Strumpflohner(instructor)
~ 5 years ago

@Oscar make sure it's on the "root" folder of your User not the project itself. On unix systems it is ~/.

Jexxie
Jexxie
~ 5 years ago

Why I type 'git lg' will show a new panel and should hit 'q' to exit while you just show the message in the same panel?

Jexxie
Jexxie
~ 5 years ago

Why I type 'git lg' will show a new panel and should hit 'q' to exit while you just show the message in the same panel?

Juri Strumpflohner
Juri Strumpflohner(instructor)
~ 5 years ago

@Jexxie I'm having the same "issue" on my work Mac while it works as I've shown in my own Mac 🤔. Noticed that weird behavior as well, but didn't investigate yet. I'll let you know if I find out