Created
March 25, 2020 14:14
-
-
Save hqrd/7ffb7916fc6c2fad046d4c4d79b2ce00 to your computer and use it in GitHub Desktop.
This script is used to update all the git repositories in a directory at once
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
#! /usr/bin/env bash | |
### | |
# This script is used to update all the git repositories in a directory at once | |
### | |
for dir in ./*/ | |
do | |
cd ${dir} || exit | |
git status >/dev/null 2>&1 | |
# check if exit status of above was 0, indicating we're in a git repo | |
[ $(echo $?) -eq 0 ] && echo "Updating ${dir%*/}..." && git pull | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment