Skip to content

Instantly share code, notes, and snippets.

@sheepmaster
Created July 23, 2012 22:21
Show Gist options
  • Select an option

  • Save sheepmaster/3166612 to your computer and use it in GitHub Desktop.

Select an option

Save sheepmaster/3166612 to your computer and use it in GitHub Desktop.
#!/bin/bash
if test -z "$1"; then
case `uname -s` in
"Linux")
os=unix
;;
"Darwin")
os=mac
;;
*)
echo "You didn't specify an OS (mac, win, unix, or android), and I can't figure it out from 'uname -s'" 1>&2
exit 1
;;
esac
else
os=$1
fi
git config target.os $os
git checkout --force HEAD
git config -f .gitmodules --get-regexp '.os$' "(all|$os)" |
sed 's/^submodule\.\(.*\)\.os .*$/\1/' |
while read submodule; do
git config submodule.$submodule.update checkout
(cd $submodule && git checkout --force HEAD)
done
git submodule init
git submodule update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment