]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
Add sync.sh which fetches all remote branches.
authorSimon Ruderich <simon@ruderich.org>
Wed, 18 Feb 2009 18:51:07 +0000 (19:51 +0100)
committerSimon Ruderich <simon@ruderich.org>
Wed, 18 Feb 2009 19:01:01 +0000 (20:01 +0100)
All remote branches of all git repositories in or under this directory are
fetched.

sync.sh [new file with mode: 0755]

diff --git a/sync.sh b/sync.sh
new file mode 100755 (executable)
index 0000000..31084e5
--- /dev/null
+++ b/sync.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Fetches the current master from all remotes. Used to sync with all remote
+# hosts. No merging is done.
+
+
+# Fetch from each remote of each git subdirectory.
+for project in `find . -name .git -type d`; do
+    if [ -d "$project" ]; then
+        pwd=`pwd`
+        cd "$project"
+
+        # Fetch from all remotes.
+        for remote in `git remote`; do
+            echo "$project: fetching $remote ..."
+            git fetch "$remote"
+        done
+
+        cd "$pwd"
+    fi
+done