#!/usr/bin/env bash set -euo pipefail if [[ $# -lt 2 ]]; then echo "usage: $0 \"type: message\" " >&2 exit 2 fi msg="$1" shift git add -- "$@" if git diff --cached --quiet; then echo "nothing to commit" >&2 exit 1 fi git commit -m "$msg"