Last active
September 7, 2018 02:49
-
-
Save riyadhalnur/8d01f8ac30f743d0b9efa6cf50b941be to your computer and use it in GitHub Desktop.
Recurses a parent directory to do git pulls inside each repo/sub folder
This file contains hidden or 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
#!/bin/bash | |
trap 'echo "Wait for the script to finish"' SIGINT SIGTERM EXIT | |
# Recurses a directory to do git pulls in each repo folder | |
BASEDIR=/Users/test/go/src/github.com | |
for dir in "$BASEDIR"/* | |
do | |
if [[ -d "$dir" ]]; then | |
cd "$dir" | |
if echo "$(git branch)" | grep "* master"; then | |
echo "Pulling in $dir..." | |
git pull | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment