bin/ipaddr: Support Linux net-tools 2.x formats
[dotfiles.git] / bin / git-subup
index 52d4f0916af940204aec3cdfdf0610ba477ae408..ceef5b6149ed69f712b692325db467977188d3ec 100755 (executable)
@@ -2,21 +2,14 @@
 # Checkout and update source for all registered submodules (.gitmodules).
 # Optionally 'git pull' on each submodule to check for updates.
 
-# Change to root directory
-cd $(git rev-parse --show-toplevel)
-
 # Ensure all submodules (and child submodules) are checked-out
-git submodule update --init --checkout --recursive
+git submodule update --init --recursive
 
 # Update submodules' remotes based on .gitmodules
-git submodule sync --quiet --recursive
-
-# Forcibly update each submodule's "master" branch to be the current revision
-# in case HEAD is detached (e.g. due to "git submodule update --checkout")
-git submodule foreach --quiet --recursive 'git checkout --quiet -B master'
+git submodule sync
 
 if [ "$1" = "pull" ]; then
-    # Fetch & pull any new updates from submodule's origin (but *NOT* any child
-    # submodule updates -- those should come from the submodule proper)
-    git submodule foreach --quiet 'echo "\n\033[32m${path}:\033[0m" && git-up origin'
+    # Fetch & pull any new updates from submodule's origin
+    # [http://scribu.net/blog/git-alias-for-updating-submodules.html]
+    git submodule foreach 'git fetch origin --tags; git checkout master; git pull'
 fi