24 lines
382 B
Plaintext
24 lines
382 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
usage () {
|
||
|
cat <<EOF>&2
|
||
|
Usage: ${0##*/} FOLDERS
|
||
|
|
||
|
Sync all git repos found in FOLDERS.
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
[ $# -eq 0 ] && usage && exit 1
|
||
|
[ "$1" = "-h" ] && usage && exit
|
||
|
[ "$1" = "--" ] && shift
|
||
|
|
||
|
for i; do
|
||
|
status="$(cd -- "$i" && git status -uno)"
|
||
|
if echo "$status" | grep -q "Your branch is ahead of"; then
|
||
|
echo "$i"
|
||
|
echo "$status"
|
||
|
(cd -- "$i" && git push)
|
||
|
echo
|
||
|
fi
|
||
|
done
|