summaryrefslogtreecommitdiff
path: root/git-lg
diff options
context:
space:
mode:
Diffstat (limited to 'git-lg')
-rwxr-xr-xgit-lg15
1 files changed, 15 insertions, 0 deletions
diff --git a/git-lg b/git-lg
new file mode 100755
index 0000000..a078a53
--- /dev/null
+++ b/git-lg
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+width=$((`tput cols` - 29))
+width2=$(($width - 2))
+
+if tty -s <&1; then
+ PRETTY='--pretty=format:%Cred%h %Creset %s%x00%Cgreen%cd%x00%C(bold black)%an%Creset%C(yellow)%d'
+else
+ PRETTY='--pretty=format:%h %s%x00%cd%x00%an%d'
+fi
+
+exec git log --abbrev-commit --date=relative --graph "$PRETTY" "$@" \
+ |gawk --re-interval -F '\\0' \
+ '{ printf "%-'$width's%18s %s\n", gensub(/^(.{'$width2'}).{2,}$/, "\\1… ", 1, $1), $2, $3 }' \
+ |less -R