Last Updated: February 25, 2016
·
435
· causztic

Displaying your git commits better!

I was finding a way to show which branch is detached, what was not committed, and any discrepancies that might have occurred.

Searched around and came up with this simple command.

git config --global alias.l "log --graph --decorate --all \ 
--pretty=format:"%hx09%d%x20%s" --color"

Basically what this does it to create a log command that graphs the commits in a pretty way, so that you can get the overview of them in a clear and quick manner. Then, it is set to a global alias of "l", so that when you run

git l

the next time, the command will be run! No need for retyping or memorization :)

It'll look something like this:

Picture

You can play around with the --pretty formats to get what you like, or remove the --all to only show the details of your current branch.

Try it out!

3 Responses
Add your response

fancy!

over 1 year ago ·

What's the output of this look like? Any examples?

over 1 year ago ·

@spencerwi I'll update my protip soon with an example, hang on!

over 1 year ago ·