]>
Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/git-subup
   2 # Checkout and update source for all registered submodules (.gitmodules). 
   3 # Optionally 'git pull' on each submodule to check for updates. 
   5 # Change to root directory 
   6 cd $(git rev-parse --show-toplevel) 
   8 # Ensure all submodules (and child submodules) are checked-out 
   9 git submodule update 
--init --checkout --recursive 
  11 # Update submodules' remotes based on .gitmodules 
  12 git submodule sync 
--quiet --recursive 
  14 # Forcibly update each submodule's "master" branch to be the current revision 
  15 # in case HEAD is detached (e.g. due to "git submodule update --checkout") 
  16 git submodule foreach 
--quiet --recursive 'git checkout --quiet -B master' 
  18 if [ "$1" = "pull" ]; then 
  19     # Fetch & pull any new updates from submodule's origin (but *NOT* any child 
  20     # submodule updates -- those should come from the submodule proper) 
  21     git submodule foreach 
--quiet 'echo "\n\033[32m${path}:\033[0m" && git-up origin'