summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAutomated System <kb9vqf@pearsoncomputing.net>2011-11-04 15:27:16 -0500
committerAutomated System <kb9vqf@pearsoncomputing.net>2011-11-04 15:27:16 -0500
commit5020be6de185c0dc8b9c2ac82ccca21d6aa3c36d (patch)
tree7bff3d66239d0aad5d54334202e9c278a5a7eccf
parent622cbc8d836e27e7cc0c85c63733b30b0bcfb016 (diff)
downloadscripts-5020be6de185c0dc8b9c2ac82ccca21d6aa3c36d.tar.gz
scripts-5020be6de185c0dc8b9c2ac82ccca21d6aa3c36d.zip
Add initial update submodules script
-rwxr-xr-xupdate_all_submodules33
1 files changed, 33 insertions, 0 deletions
diff --git a/update_all_submodules b/update_all_submodules
new file mode 100755
index 0000000..74cdfbd
--- /dev/null
+++ b/update_all_submodules
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+PARENTDIR=$PWD
+echo "Working in $PARENTDIR"
+
+exec 3< submodules
+while read <&3
+do
+ cd $PARENTDIR
+ DIR2UPDATE=$REPLY
+ if [[ $DIR2UPDATE != "" ]]; then
+ echo "Attempting to reset submodule $DIR2UPDATE"
+ cd $PARENTDIR/$DIR2UPDATE/..
+ while [[ ! -d .git ]]; do
+ cd ../
+ done
+ git submodule init
+ git submodule update
+ cd $PARENTDIR/$DIR2UPDATE
+ git reset --hard HEAD
+ git clean -d -x -f
+ git checkout master
+ git pull
+ cd ..
+ while [[ ! -d .git ]]; do
+ cd ../
+ done
+ echo "Committing changes to $PWD"
+ git commit -a -m "Reset submodule to latest HEAD"
+ git push origin master
+ fi
+done
+exec 3>&-