#!/usr/bin/env bash set -euo pipefail if [[ $# -eq 0 ]]; then echo "Usage: git-commit-all " exit 1 fi MESSAGE="$*" # Commit in each submodule (skip any with nothing to commit) git submodule foreach --recursive ' git add -A if ! git diff --cached --quiet; then git commit -m "'"$MESSAGE"'" echo " ✔ committed in $name" else echo " – nothing to commit in $name" fi ' # Commit in the parent repo git add -A if ! git diff --cached --quiet; then git commit -m "$MESSAGE" echo "✔ committed in parent repo" else echo "– nothing to commit in parent repo" fi