Skip to content

Instantly share code, notes, and snippets.

@nwjsmith
Created August 6, 2011 01:44
Show Gist options
  • Save nwjsmith/1128902 to your computer and use it in GitHub Desktop.
Save nwjsmith/1128902 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
last_commit_time="$(git log --pretty=format:'%at' -1)"
current_time="$(date +%s)"
((minutes_since_last_commit=($current_time - $last_commit_time) / 60))
# Color Green/Yellow/Red depending on the amount of time since the last commit
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
RED="\033[0;31m"
RESET="\033[0m"
if [ $minutes_since_last_commit > 60 ]; then
color=$RED
elif [ $minutes_since_last_commit > 30 ]; then
color=$RED
else
color=$RED
fi
message=$color""$minutes_since_last_commit""$RESET
echo $message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment