#!/bin/ash -efu git submodule init git submodule status | cut -d' ' -f2 | while read path; do url="$(git config --get "submodule.$path.url")" git remote add -f "$path" "$url" git merge -s ours --no-commit "$path"/master git read-tree --prefix="$path" -u "$path"/master git commit -m "Merge '$path' as our subdirectory" git config --remove-section "submodule.$path" done