Created
May 17, 2022 07:47
-
-
Save abtris/b24c870405cf1f4b6634b9fe328da892 to your computer and use it in GitHub Desktop.
Update git source code in all directories
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
for name in */ ; do | |
if [ -d "$name" ] && [ ! -L "$name" ]; then | |
cd $name | |
if [ -d ".git" ]; then | |
BRANCH=`git branch --no-color | grep -e "^*" | tr -d ' *'` | |
if [ "$BRANCH" == "master" ] || [ "$BRANCH" == "main" ]; then | |
if git remote | grep origin > /dev/null; then | |
printf 'Update source in directory: %s\n' "$name" | |
git pull | |
fi | |
fi | |
fi | |
cd .. | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment