Skip to content

Instantly share code, notes, and snippets.

@romac
Created February 17, 2010 10:40
Show Gist options
  • Save romac/306498 to your computer and use it in GitHub Desktop.
Save romac/306498 to your computer and use it in GitHub Desktop.
This simple bash script update all the working copies in the current folder. Handle Git and Subversion.
#!/usr/bin/env bash
cd "$1";
PATH=`pwd`;
SVN_FOLDER=".svn"
SVN_BIN="/opt/local/bin/svn"
GIT_FOLDER=".git"
GIT_BIN="/opt/local/bin/git"
echo "In $PATH :";
for REPOSITORY in "$PATH"/*;
do
if [[ -d $REPOSITORY ]]
then
if [[ -f $REPOSITORY/SKIP_REPO ]]
then
continue;
fi
cd "$REPOSITORY";
echo -n Updating `/usr/bin/basename "$REPOSITORY"`...;
if [[ -d $REPOSITORY/$SVN_FOLDER ]]
then
echo " [Subversion]";
$SVN_BIN update;
fi
if [[ -d $REPOSITORY/$GIT_FOLDER ]]
then
echo " [Git]";
$GIT_BIN pull;
fi
echo "";
cd "$PATH";
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment