Repository Refresh

By Paul Heinlein | Jan 4, 2017 (updated Feb 1, 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
  git -C $(dirname $D) config --get remote.origin.url
  git -C $(dirname $D) pull
  echo
done

# subversion repositories
for D in $(find $SRCDIR -type d -name '\.svn'); do
  svn update $(dirname $D)
  echo
done