Skip to content

Instantly share code, notes, and snippets.

@fbiville
Created May 15, 2012 08:14
Show Gist options
  • Select an option

  • Save fbiville/2699951 to your computer and use it in GitHub Desktop.

Select an option

Save fbiville/2699951 to your computer and use it in GitHub Desktop.
Tiny snippet to update Git projects contained in the same directory.
#!/bin/bash
git_pull () {
echo ""
echo "## Updating $1 ##"
echo ""
cd $1
git pull
cd - > /dev/null
}
if [ ! -d $1 ]; then
echo "Please specify a valid parent directory of your projects."
else
for dir in `ls $1`; do
complete_path="$1/$dir"
if [ -d "$complete_path/.git" ] ; then
git_pull $complete_path
else
echo "not git"
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment