]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/git-subup
bin/git-amend: Smarter 'git stash' handling
[dotfiles.git] / bin / git-subup
1 #!/bin/bash
2 # Checkout and update source for all registered submodules (.gitmodules).
3 # Optionally 'git pull' on each submodule to check for updates.
4
5 # Ensure all submodules (and child submodules) are checked-out
6 git submodule update --init --recursive
7
8 # Update submodules' remotes based on .gitmodules
9 git submodule sync
10
11 if [ "$1" = "pull" ]; then
12 # Fetch & pull any new updates from submodule's origin
13 # [http://scribu.net/blog/git-alias-for-updating-submodules.html]
14 git submodule foreach 'git fetch origin --tags; git checkout master; git pull'
15 fi