Files
soleprint/mainroom/soleprint/ctrl/local/commit.sh
2025-12-24 07:10:08 -03:00

35 lines
897 B
Bash
Executable File

#!/bin/bash
# Commit changes across all repos with the same message
# Usage: ./commit.sh "commit message"
set -e
MSG="${1:?Usage: $0 \"commit message\"}"
# Find pawprint bare metal directory from PAWPRINT_BARE_PATH or default
PAWPRINT_DIR="${PAWPRINT_BARE_PATH:-/home/mariano/pawprint}"
REPOS=("$PAWPRINT_DIR" "$PAWPRINT_DIR/artery" "$PAWPRINT_DIR/album" "$PAWPRINT_DIR/ward")
for repo in "${REPOS[@]}"; do
name=$(basename "$repo")
[ "$repo" = "$PAWPRINT_DIR" ] && name="pawprint"
if [ ! -d "$repo/.git" ]; then
echo "=== $name: not a git repo, skipping ==="
continue
fi
cd "$repo"
if git diff --quiet && git diff --cached --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
echo "=== $name: nothing to commit ==="
continue
fi
echo "=== $name ==="
git add -A
git commit -m "$MSG"
done
echo "Done!"