place this file in your project root
chmod +x updateprojects.sh
to make it executable, then run
sh updateprojects.sh
to update all your git projects
#!/bin/bash | |
# store the current dir | |
CUR_DIR=$(pwd) | |
#hey user | |
echo "Pulling in latest changes for all repositories..." | |
# Find all git repositories and update it to the master latest revision | |
for i in $(find . -name ".git" | cut -c 3-); do | |
if [[ "$i" != *libraries* ]] | |
then | |
#list your submodule directories: here, ie I have a git submodule called deployment | |
if [[ "$i" != *deployment* ]] | |
then | |
echo ""; | |
echo $i; | |
#We have to go to the .git parent directory to call the pull command | |
cd "$i"; | |
cd ..; | |
#pull checked out branch | |
git pull; | |
#update submodules | |
git submodule update; | |
#lets get back to the CUR_DIR | |
cd $CUR_DIR | |
fi | |
fi | |
done | |
echo "Complete!" |