diff --git a/bin/git/submodule-update-master-commit b/bin/git/submodule-update-master-commit new file mode 100755 index 0000000..84dae36 --- /dev/null +++ b/bin/git/submodule-update-master-commit @@ -0,0 +1,15 @@ +#!/bin/zsh + +git submodule update --remote --rebase --init + +SUBMODULES=$(\ + git status\ + | grep '(new commits)' \ + | sed 's/^.*modified:\s*//; s/\s*(new commits).*$//' \ +) + +[[ ${#SUBMODULES[@]} -gt 0 ]] && { + git add $SUBMODULES + git commit -m "Updated submodules to master : $SUBMODULES" +} +