From 9400f9410c3bca4b83243f6cc49b216a5d5559da Mon Sep 17 00:00:00 2001 From: mo Date: Fri, 26 Jun 2026 00:48:11 +0000 Subject: [PATCH] Add scripts/save.sh helper for commit+push per change --- scripts/save.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/save.sh diff --git a/scripts/save.sh b/scripts/save.sh new file mode 100755 index 0000000..92adaaf --- /dev/null +++ b/scripts/save.sh @@ -0,0 +1,23 @@ +#!/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"