scripts

random scripts
git clone https://git.parazyd.org/scripts
Log | Files | Refs

update-gits (468B)


      1 #!/bin/sh
      2 
      3 if [ -n "$1" ]; then
      4 	cat <<EOF
      5 usage: $(basename "$0") SKIP=foo,bar,baz
      6 EOF
      7 	exit 1
      8 fi
      9 
     10 SKIP="${SKIP:-}"
     11 
     12 skips="$(echo "$SKIP" | tr ',' '\n')"
     13 
     14 for i in $(printf %s\\n */); do
     15 	test -e "$i.git" && {
     16 		for j in "$skips"; do
     17 			echo "i: $i"
     18 			echo "j: $j"
     19 			if [ "$i" = "$j/" ]; then
     20 				printf "\nskipping %s... \\n" "$j"
     21 				continue
     22 			fi
     23 		done
     24 		cd "$i"
     25 		printf "\nupdating %s...\\n" "$i"
     26 		git pull origin master --rebase
     27 		cd - >/dev/null
     28 	}
     29 done