Created
August 6, 2011 01:44
-
-
Save nwjsmith/1128902 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/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