Skip to content

Instantly share code, notes, and snippets.

@valpackett
Created June 27, 2010 17:31
Show Gist options
  • Save valpackett/455038 to your computer and use it in GitHub Desktop.
Save valpackett/455038 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Small script that updates version controlled subdirs.
# Awesome for your django apps or jquery plugins collection.
# By myfreeweb <[email protected]>
# Licensed under Do The Fuck What You Want License.
upd_tmpl="Updating with";
find_opts="-maxdepth 1 -mindepth 1 -type d";
root=`pwd`/;
for dir in `find . $find_opts`; do
abs_dir=$root$(basename $dir);
for subdir in `find $abs_dir/ $find_opts`; do
cd $abs_dir;
case $(basename $subdir) in
'.bzr')
echo "$upd_tmpl bzr: $subdir";
bzr pull
;;
'.git')
echo "$upd_tmpl git: $subdir";
git pull
;;
'.hg')
echo "$upd_tmpl hg: $subdir";
hg pull;
hg update
;;
'.svn')
echo "$upd_tmpl svn: $subdir";
svn up
;;
esac
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment