3 # uses the directory where the command lies, so just symlink this script wherever it's needed
5 # based on auto-update that historically was guessing the scm in use
6 # this one is git-specific, it does the usual git pull
7 # but also exposes all remote branches as local
11 COMMAND=$(basename $0)
12 # without an argument, use the place where the command is stored
13 if [[ -z "$@" ]] ; then
15 DIRNAME=$(cd $DIRNAME; pwd -P)
23 function all_branches () {
25 git branch -r | grep $remote | fgrep -v -- '->' | sed "s/.*\///g"
29 function git_update () {
32 for branch in $(all_branches $remote); do
33 # create the branch as a tracking branch if not yet existing
34 git branch | grep -q ' '$branch'$' || git branch --track $branch $remote/$branch
36 git merge --ff $remote/$branch
40 git_update >& .git-update.log