Add scripts/save.sh helper for commit+push per change
This commit is contained in:
Executable
+23
@@ -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"
|
||||
Reference in New Issue
Block a user