Skip to content

Instantly share code, notes, and snippets.

@stephenyeargin
Created September 11, 2011 00:16
Show Gist options
  • Save stephenyeargin/1208999 to your computer and use it in GitHub Desktop.
Save stephenyeargin/1208999 to your computer and use it in GitHub Desktop.
Update all subversion and git repositories in a projects directory
#!/bin/sh
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset
cd /Library/WebServer/Documents
for X in `find . -maxdepth 2 -type d -name ".svn" | cut -d / -f 2`; do echo "${txtylw}[Updating $X ...]${txtrst}" ; svn update ./$X; done
for X in `find . -maxdepth 2 -type d -name ".git" | cut -d / -f 2`; do echo "${txtylw}[Updating $X ...]${txtrst}" ; cd $X ; git pull ; cd ..; done
cd /Library/WebServer/SymfonyProjects
for X in `find . -maxdepth 2 -type d -name ".svn" | cut -d / -f 2`; do echo "${txtylw}[Updating $X ...]${txtrst}" ; svn update ./$X; done
for X in `find . -maxdepth 2 -type d -name ".git" | cut -d / -f 2`; do echo "${txtylw}[Updating $X ...]${txtrst}" ; cd $X ; git pull ; cd ..; done
cd /Library/WebServer/RailsProjects
for X in `find . -maxdepth 2 -type d -name ".svn" | cut -d / -f 2`; do echo "${txtylw}[Updating $X ...]${txtrst}" ; svn update ./$X; done
for X in `find . -maxdepth 2 -type d -name ".git" | cut -d / -f 2`; do echo "${txtylw}[Updating $X ...]${txtrst}" ; cd $X ; git pull ; cd ..; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment