Skip to content

Instantly share code, notes, and snippets.

@wesleybliss
Created April 25, 2014 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesleybliss/11299004 to your computer and use it in GitHub Desktop.
Save wesleybliss/11299004 to your computer and use it in GitHub Desktop.
List most recently touched GIT branches
#!/bin/bash
# Note: this only works in 256bit color terminal
# http://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg
rs="\e[0m"
dc="\e[38;5;227m"
cc="\e[38;5;051m"
git for-each-ref --sort=-committerdate refs/heads --format="%(committerdate:short) %(refname:short)" | \
while read line; do
ts=`echo $line | cut -d' ' -f1`
cm=`echo $line | cut -d' ' -f2`
#echo -e "\e[38;5;32m$ts\t\e[0m\e[38;5;155m$cm\e[0m"
echo -e "$rs$dc$ts $cc$cm$rs"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment