Created
March 21, 2019 13:54
Star
You must be signed in to star a gist
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