dotwryn/bin/git/submodule-update-master-commit

16 lines
293 B
Plaintext
Raw Normal View History

2021-09-16 17:05:48 +00:00
#!/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"
}