Created
March 13, 2015 23:33
-
-
Save johnweldon/0a9ee3c9406fab2ac93b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -r -d '' AWK <<EOF | |
{ | |
date=\$1; | |
refname=\$2; | |
subject=substr(\$3,1,72); | |
sha=\$4; | |
len=split(refname, ref, "/"); | |
reset="\033[0m"; | |
red="\033[0;31m"; | |
green="\033[0;32m"; | |
yellow="\033[0;33m"; | |
cyan="\033[0;36m"; | |
simple=red "%15s" green " %-30s" cyan " %15s" yellow " %s" reset " %s\n"; | |
cmplex=red "%15s" green " %-30s" cyan " %15s" yellow " %s" reset " %s\n"; | |
if(len<2) { | |
printf simple,"----",ref[1],date,sha,subject; | |
} else { | |
printf cmplex,ref[1],ref[2],date,sha,subject; | |
} | |
} | |
EOF | |
git for-each-ref --sort=committerdate --format='%(committerdate:relative)%09%(refname:short)%09%(subject)%09%(objectname:short)' | awk -F'\t' "$AWK" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shell script to display all your branches, local and remote, oldest to newest with the relative time of the last commit, colorized for bash.