This is a small shell script I use to batch update all of my git repositories that are children of a particular folder on my filesystem.
First create a single common folder to checkout all of your projects. We’ll use vc
.
mkdir ~/vc; cd ~/vc
Then place the following file inside the folder.
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
for FOLDER in $DIR/*/; do cd $FOLDER; echo "Updating " $FOLDER; git pull; cd $DIR; done | |
echo 'Done!' |
Now checkout your repositories into subfolder.
git clone https://github.com/stevenkword/WP-Present.git wp-present
You should now end up with a folder ~/vc/wp-present/ and we can test our update script.
sh ~/vc/update-git.sh
The script should traverse all of the subfolders and issue git pull
commands in each.