Created
July 19, 2017 02:18
-
-
Save armadsen/e534971c643d88309e14a8d40196bcfa to your computer and use it in GitHub Desktop.
Quick and dirty bash script to recursively commit submodules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ "$#" -ne 1 ]]; then | |
echo "You must specify a commit message as an argument." | |
exit 1 | |
fi | |
COMMIT_MESSAGE="$1" | |
git submodule foreach "echo 'Adding all files.'; git add ." | |
git submodule foreach "echo 'Stashing.'; git stash" | |
git submodule foreach "echo 'Checking out master branch.'; git checkout master" | |
git submodule foreach "echo 'Applying stash.'; git stash apply" | |
git submodule foreach "echo 'Readding all files.'; git add ." | |
git submodule foreach "echo 'Committing changes.'; git commit -a -q -m '${COMMIT_MESSAGE}' || :" | |
echo 'Adding main repo changes.' | |
git add . | |
echo 'Committing changes to main repo.' | |
git commit -a -m "${COMMIT_MESSAGE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe there is something wrong in my local computer, this didn't work for me (still, thanks for your sharing!)