Skip to content

Instantly share code, notes, and snippets.

@lonsty
Last active December 26, 2020 08:29
Show Gist options
  • Save lonsty/d251d91d92e700a5a13e23a659561931 to your computer and use it in GitHub Desktop.
Save lonsty/d251d91d92e700a5a13e23a659561931 to your computer and use it in GitHub Desktop.
Aliases to format git log

How to

Add following aliases to ~/.zshrc:

alias glo='f() { x=${1-16}; length=`expr $x`; git log --graph --pretty=format:"%>|($length)%C(yellow)%h%Creset %C(cyan)-%Creset %<(52,trunc)%s %C(cyan)%<(12,trunc)%cr%Creset %C(magenta)%<(10,trunc)%an%Creset (%cd)%C(red)%d%Creset" --date=format:"%a %b %d %H:%M %Y"}; f'
alias glor='f() { x=${1-16}; length=`expr $x`; git log --reflog --graph --pretty=format:"%>|($length)%C(yellow)%h%Creset %C(cyan)-%Creset %<(52,trunc)%s %C(cyan)%<(12,trunc)%cr%Creset %C(magenta)%<(10,trunc)%an%Creset (%cd)%C(red)%d%Creset" --date=format:"%a %b %d %H:%M %Y"}; f'

then,

source ~/.zshrc

Usage

Under a git repo:

glo

https://i.ibb.co/BzYRy94/Screen-Shot-2020-12-26-at-4-20-05-PM.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment