#!/bin/bash width=$((`tput cols` - 10)) width2=$(($width - 2)) if tty -s <&1; then PRETTY='--pretty=format:%Cred%h %Cgreen%cd %Creset %s%x00%C(bold black)%an%Creset%C(yellow)%d' else PRETTY='--pretty=format:%h %cd %s%x00%an%d' fi exec git log --abbrev-commit --date=short "$PRETTY" "$@" \ |gawk --re-interval -F '\\0' \ '{ printf "%-'$width's%s\n", gensub(/^(.{'$width2'}).{2,}$/, "\\1… ", 1, $1), $2 }' \ |less -R