From: Simon Ruderich Date: Wed, 18 Feb 2009 18:51:07 +0000 (+0100) Subject: Add sync.sh which fetches all remote branches. X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=commitdiff_plain;h=5846c6d81fe821017396caf101bf9f3c0ac2e24a Add sync.sh which fetches all remote branches. All remote branches of all git repositories in or under this directory are fetched. --- diff --git a/sync.sh b/sync.sh new file mode 100755 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