Skip to content

Instantly share code, notes, and snippets.

@mikejgray
Created December 6, 2019 23:03
Show Gist options
  • Save mikejgray/1145f924fab912ca90db580978daeff8 to your computer and use it in GitHub Desktop.
Save mikejgray/1145f924fab912ca90db580978daeff8 to your computer and use it in GitHub Desktop.
Run in a directory with multiple Git repos to pull down the latest version of remote code.
#!/bin/bash
################################################################################
# Run in a directory with multiple Git repos to pull down the latest version
# of remote code.
################################################################################
shopt -s nullglob
array=(*/)
for dir in "${array[@]}"; do
if [ -d "${dir}.git/" ]; then
cd ${dir}
echo "Pulling ${dir}..."
git checkout master && git pull
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment