Prettify Git Log Output

Git’s a pretty powerful distributed revision control system for non-linear workflows. One thing that can be annoying is how much vertical screen real estate is wasted by the – commonly used – git log command. Here’s how to alias a long git log command into a shorthand command of your choosing, to make viewing your commit history much easier.

Here’s the original Git log output:

111-ugly-git-log

Gross!

Alright, let’s create a bash script (anywhere on your hard drive). Once you’ve got it created, put the following in the file:

#!/bin/bash

git config --global alias.l "log --pretty=format:'%h (%p) %an, %ar : %s'"

Once we run this script, we’ll have a cross-repository git alias command git l that will produce the following output:

114-git-l-command

That’s more like it. We can now see the abbreviated parent commit’s hash in parenthesis. This becomes super useful as one becomes proficient with Git!