Last active
November 25, 2023 14:17
-
-
Save aaronmelton/c186f7699be7347d4d53860172426b18 to your computer and use it in GitHub Desktop.
A simple shell script to loop through all sub-directories of current directory and perform a 'git pull' on each. This assumes all sub-directories are git repositories.
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 | |
base_dir=$PWD | |
# Loop through directories | |
for dir in */ ; do | |
[ -L "${dir%/}" ] && continue | |
this_dir=$base_dir/$dir | |
cd $this_dir | |
echo "-->$this_dir" | |
if [ -d .git ]; then | |
git pull | |
else | |
echo "Not a git directory." | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment