Skip to content

Instantly share code, notes, and snippets.

@andypotanin
Created October 10, 2013 23:11
Show Gist options
  • Save andypotanin/6927072 to your computer and use it in GitHub Desktop.
Save andypotanin/6927072 to your computer and use it in GitHub Desktop.
Bash script to update all Git repositories in curent directory.
#! /usr/bin/env bash
#
# To install globally:
# $ chmod +x vcs-update.sh
# $ mv vcs-update.sh /usr/local/bin/vcs-update
#
# Run "vcs-update" in terminal to update all directories.
#
DIRECTORIES=$PWD/*
echo "Updating all Git repositories in $DIRECTORIES";
for DIRECTORY in $DIRECTORIES
do
if [ -d "$DIRECTORY/.git" ]; then
echo "Updating Git $DIRECTORY";
cd $DIRECTORY && git pull
fi
if [ -d "$DIRECTORY/.svn" ]; then
echo "Updating SVN $DIRECTORY";
cd $DIRECTORY && svn update
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment