Skip to content

Instantly share code, notes, and snippets.

@babvin
Created January 21, 2021 07:06
Show Gist options
  • Save babvin/7c428ad26cb5806b5dd315ed530973b5 to your computer and use it in GitHub Desktop.
Save babvin/7c428ad26cb5806b5dd315ed530973b5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Set the root directory
CUR_DIR=/git/DTMS-Tools
cd $CUR_DIR
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master revision
for i in $(find . -name "*.git" | cut -c 3-); do
repo=$(echo $i | awk -F/ '{ print $1 }');
echo -e "";
echo -e "\033[33m"+$repo+"\033[0m";
# We have to go to the .git parent directory to call the pull command
cd "$i";
cd ..;
git pull git@<your git repo path>/$repo master
cd $CUR_DIR
done
echo -e "\n\033[32mComplete!\033[0m\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment