#!/bin/sh if ! GITDIR=$(git rev-parse --git-dir) ; then echo "Not in a git repository" >&2 exit 0 fi TREE=$(dirname $GITDIR) cd $TREE [ -e pre-sync ] && sh pre-sync git stash push -u -m "SYNC SAVE" git pull [ -e mid-sync ] && sh mid-sync git push [ -e post-sync ] && sh post-sync if git stash list | grep "SYNC SAVE" >/dev/null ; then git stash pop -q fi