Skip to content

Instantly share code, notes, and snippets.

@sontqq
Created November 4, 2018 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sontqq/77439f74991fb4c6e99df7bd88f5f6df to your computer and use it in GitHub Desktop.
Save sontqq/77439f74991fb4c6e99df7bd88f5f6df to your computer and use it in GitHub Desktop.
Update all cloned git repos in a single directory by a single command
#!/bin/bash
CUR_DIR=$(pwd)
counter=0
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
for i in $(find . -name ".git" | cut -c 3-); do
echo "";
echo "\033[33m"+$i+"\033[0m";
counter=$((counter+1))
cd "$i";
cd ..;
git pull origin master;
cd $CUR_DIR
done
echo "\n\033[32mComplete!\033[0m\n"
echo "$counter repos updated."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment