Skip to content

Instantly share code, notes, and snippets.

@barend
Last active August 24, 2017 09:41
Show Gist options
  • Save barend/eb5e2777fce77ecb08646ff2890acb24 to your computer and use it in GitHub Desktop.
Save barend/eb5e2777fce77ecb08646ff2890acb24 to your computer and use it in GitHub Desktop.
# Git pull all the repos two levels under $PWD, 4 in parallel
# vim: ft=zsh:
function woohoo() {
git -C "$1" pull --ff-only --recurse-submodules=yes --quiet 2>&1
if [ ! $? ]; then
echo "Failed: $1" 1>&2
fi
}
export -f woohoo
PROCS=4
REPOS=$(find . -name '.git' -and -type d -depth 3 | xargs -n1 dirname)
time echo $REPOS | xargs -n 1 -P $PROCS -I % bash -c 'woohoo "$@"' _ %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment