- # add an else if or two here if you want to get more specific
- if [[ ${git_status} =~ ${remote_pattern} ]]; then
- if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then
+ # http://stackoverflow.com/a/3278427
+ remote=$(git rev-parse '@{u}' 2>/dev/null)
+ base=$(git merge-base @ '@{u}' 2>/dev/null)
+ if [[ -n "$remote" && -n "$base" ]]; then
+ local=$(git rev-parse @)
+
+ if [[ $local = $remote ]]; then
+ remote=""
+ elif [[ $local = $base ]]; then
+ remote="${YELLOW}↓"
+ elif [[ $remote = $base ]]; then