Created
October 10, 2013 23:11
-
-
Save andypotanin/6927072 to your computer and use it in GitHub Desktop.
Bash script to update all Git repositories in curent directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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