Skip to content

Instantly share code, notes, and snippets.

@lazypower
Created August 27, 2012 00:29
Show Gist options
  • Save lazypower/3484659 to your computer and use it in GitHub Desktop.
Save lazypower/3484659 to your computer and use it in GitHub Desktop.
git l - ala gary bernhardt
HASH="%C(yellow)%h%Creset"
RELATIVE_TIME="%Cgreen(%ar)%Creset"
AUTHOR="%C(bold blue)<%an>%Creset"
REFS="%C(red)%d%Creset"
SUBJECT="%s"
FORMAT="$HASH}$RELATIVE_TIME}$AUTHOR}$REFS $SUBJECT"
show_git_head() {
pretty_git_log -1
git show -p --pretty="tformat:"
}
pretty_git_log() {
git log --graph --pretty="tformat:${FORMAT}" $* |
# Replace (2 years ago) with (2 years)
#sed -Ee 's/(^[^<]*) ago)/\1)/' |
# Replace (2 years, 5 months) with (2 years)
#sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?)/\1)/' |
# Line columns up based on } delimiter
column -s '}' -t |
# Page only if we need to
less -FXRS
}
pretty_git_log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment