| #!/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
johnweldon commentedMar 13, 2015
Shell script to display all your branches, local and remote, oldest to newest with the relative time of the last commit, colorized for bash.