#!/bin/sh git submodule status | sed 's/^.//' | while read -r i; do commit="$(echo -n "$i" | cut -d\ -f1)" path="$(echo -n "$i" | cut -d\ -f2)" key="submodule.${path}.commit" git config -f .gitmodules --unset-all "$key" git config -f .gitmodules --add "$key" "$commit" done