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

19 lines
321 B
Plaintext
Raw Normal View History

2021-09-16 11:05:48 -06:00
#!/bin/zsh
2021-09-16 11:06:44 -06:00
echo hiya
2021-09-16 11:05:48 -06:00
git submodule update --remote --rebase --init
SUBMODULES=$(\
git status\
| grep '(new commits)' \
| sed 's/^.*modified:\s*//; s/\s*(new commits).*$//' \
)
2021-09-16 11:06:44 -06:00
echo $SUBMODULES
2021-09-16 11:05:48 -06:00
[[ ${#SUBMODULES[@]} -gt 0 ]] && {
git add $SUBMODULES
git commit -m "Updated submodules to master : $SUBMODULES"
}