Created
March 21, 2019 13:54
-
-
Save JPry/03a8f9fedfb7ea56590583aed050cbef to your computer and use it in GitHub Desktop.
Look for any git repos in the current directory, and run `hub sync` in each one.
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 | |
set -e | |
# Ensure we have the `hub` command available. | |
if ! [[ -x "$(command -v hub)" ]]; then | |
echo "Error: 'hub' is required" | |
exit 1 | |
fi | |
# Loop through all subdirectories of the current directory that are Git repos | |
for gitDir in $(ls -d ./*/.git) | |
do | |
parent=$(echo ${gitDir} | sed -E 's/\/.git\/?//') | |
echo "running hub sync: hub --git-dir='${gitDir}' --work-tree='${parent}' sync" | |
hub --git-dir="${gitDir}" --work-tree="${parent}" sync | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment