Repository Refresh

By Paul Heinlein | Jan 4, 2017

Given a directory (e.g., ~/src) with a bunch of git and/or subversion repositories, refreshing them all is a script away.

#!/usr/bin/bash
SRCDIR="${HOME}/src"

# git repositories
for D in $(find $SRCDIR -type d -name '\.git'); do
  pushd $(dirname $D)
  git pull
  popd >/dev/null 2>&1
done

# subversion repositories
for D in $(find $SRCDIR -type d -name '\.svn'); do
  pushd $(dirname $D)
  svn update
  popd >/dev/null 2>&1
done