Files
atc-agents/scripts/save.sh
T

24 lines
549 B
Bash
Executable File

#!/usr/bin/env bash
# Commit all current changes and push to Gitea. Used to snapshot every
# change to the Command Center so we can always roll back.
#
# Usage: scripts/save.sh "commit message"
set -euo pipefail
cd "$(dirname "$0")/.."
MSG="${*:-}"
if [[ -z "$MSG" ]]; then
MSG="checkpoint: $(date '+%Y-%m-%d %H:%M:%S')"
fi
if [[ -z "$(git status --porcelain)" ]]; then
echo "Nothing to commit; working tree clean."
exit 0
fi
git add -A
git commit -m "$MSG"
git push origin "$(git rev-parse --abbrev-ref HEAD)"
echo "Saved + pushed: $MSG"