--- /dev/null
+#!/bin/bash
+#
+# uses the directory where the command lies, so just symlink this script wherever it's needed
+#
+# based on auto-update that historically was guessing the scm in use
+# this one is git-specific, it does the usual git pull
+# but also exposes all remote branches as local
+#
+
+####################
+COMMAND=$(basename $0)
+# without an argument, use the place where the command is stored
+if [[ -z "$@" ]] ; then
+ DIRNAME=$(dirname $0)
+ DIRNAME=$(cd $DIRNAME; pwd -P)
+else
+ DIRNAME="$1" ; shift
+fi
+
+##########
+cd $DIRNAME
+
+function all_branches () {
+ remote=$1; shift
+ git branch -r | grep $remote | fgrep -v -- '->' | sed "s/.*\///g"
+}
+
+
+function git_update () {
+ echo Running $COMMAND
+ remote=origin
+ for branch in $(all_branches $remote); do
+ # create the branch as a tracking branch if not yet existing
+ git branch | grep -q ' '$branch'$' || git branch --track $branch $remote/$branch
+ git checkout $branch
+ git merge --ff $remote/$branch
+}
+
+git_update >& .git-update.log