#!/bin/bash -e if [[ $# -lt 1 ]]; then ( echo "Usage:" echo " $0 " ) >&2 exit 2 fi COMMIT_ID="$1" shift COMMIT_ID="$(git rev-parse "$COMMIT_ID")" exitcode=$? if [[ $exitcode -ne 0 ]]; then echo >&2 "Invalid ref \"$COMMIT_ID\"" exit 1 fi exec git commit -m "fixup! $COMMIT_ID" "$@"