Skip to content

Instantly share code, notes, and snippets.

@jph00
Last active September 25, 2022 15:42
Show Gist options
  • Save jph00/7ab8813d795521d919bc4f10b4937169 to your computer and use it in GitHub Desktop.
Save jph00/7ab8813d795521d919bc4f10b4937169 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