Skip to content

Instantly share code, notes, and snippets.

@randy681
Forked from jph00/pull-all.sh
Created September 17, 2022 22:09
Show Gist options
  • Select an option

  • Save randy681/744e46ae37cc91841d3ec3e4db8a2a88 to your computer and use it in GitHub Desktop.

Select an option

Save randy681/744e46ae37cc91841d3ec3e4db8a2a88 to your computer and use it in GitHub Desktop.
Update in parallel all repos listed in ~/git/repos, and print status of any that are dirty
#!/usr/bin/env bash
for f in $(<~/git/repos); do
cd ~/git/$f
git pull > /dev/null &
cd - > /dev/null
done
wait < <(jobs -p)
for f in $(<~/git/repos); do
cd ~/git/$f
r=$(git status -s)
if [[ $r = *[!^[:space:]]* ]]; then
cat <<EOF
=====
$f
$r
EOF
fi
cd - > /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment