#!/bin/sh -e
#
# gst - fancy git status

unpushed="$(git rev-list --count \
  "origin/$(git rev-parse --abbrev-ref HEAD 2>/dev/null).." 2>/dev/null || true)"

if [ "${unpushed}" -eq 0 ]; then
  unpushed=$(printf '\e[2;37m%b\e[0m' "(${unpushed} unpushed)")
else
  unpushed=$(printf '\e[1m%b\e[0m' "(${unpushed} unpushed)")
fi

total_commits=$(git rev-list --count HEAD 2>/dev/null)
printf '%s\n' "${total_commits} total commits ${unpushed}"

git log --pretty --oneline --abbrev-commit -10
