Skip to content

Instantly share code, notes, and snippets.

@drewsberry
Last active August 29, 2015 14:05
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 drewsberry/1e29aa7b3738580726bb to your computer and use it in GitHub Desktop.
Save drewsberry/1e29aa7b3738580726bb to your computer and use it in GitHub Desktop.
Update all your git repositories within your development directory in one go.
#!/bin/bash
# Updates all my repositories in my ~/Dev folder.
# Requires `git-up`: `# gem install git-up`
REPO_DIR=$HOME/Dev # Replace with your development directory
cd $REPO_DIR
DIRS=`ls -d */`
dir_arr=$(echo $DIRS | tr "/" " ")
for dir in $dir_arr
do
echo "Changing directory into $dir..."
cd $dir
if [[ -d .git ]]
then
git-up && echo "Repository $dir successfully updated."
else
echo "Nothing to see here in $dir, moving on..."
fi
echo
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment