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:
Alright, let’s create a bash script (anywhere on your hard drive). Once you’ve got it created, put the following in the file:
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:
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!