#!/bin/bash # # Recursively commit submodule changes # # Usage: # # From a submodule folder: # # sup # go upwards commit, until there's no parent repository # Parameters DIRNAME="`dirname $0`" BASENAME="`basename $0`" MESSAGE="$*" GIT="hit" # Check if it is a git repository if [ ! -d ".git" ]; then echo "$BASENAME: not a git repository" exit 1 fi # Default message if [ -z "$MESSAGE" ]; then BASE="$(basename `pwd`)" MESSAGE="Updates $BASE" fi # Commit commit $MESSAGE # Go up while test -d "../.git"; do sup cd .. done