Skip to content

Instantly share code, notes, and snippets.

@corbanmailloux
Last active August 21, 2023 10:03
Show Gist options
  • Save corbanmailloux/11076663 to your computer and use it in GitHub Desktop.
Save corbanmailloux/11076663 to your computer and use it in GitHub Desktop.
Loop through each subfolder of the current folder and call "git pull" in it.
# Run "git pull" in each subdirectory of the current directory.
# Useful when you store all of your git repos in one folder.
clear
for dir in ./*; # For every item in the folder:
do (
if [ -d "$dir" ]; # If it is a directory:
then (
echo "$dir" && # Print the path,
cd "$dir" && # Change directory into the path,
git pull && # Pull in the path,
echo. # Toss in a new line for readability.
);
fi
);
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment