#!/bin/bash set -eu if [ -d "$(git rev-parse --git-dir)/annex" ]; then echo 'Sync: using git annex' exec git annex sync "$@" exit 1 # if attained, this is an error fi branch_name=$(git symbolic-ref -q --short HEAD) if [ "$(git config --get --bool branch.${branch_name}.sync)" != "true" ]; then echo "Branch is not configured to accept git-sync, maybe you can do:" >&2 echo " git config --bool branch.${branch_name}.sync true" >&2 exit 1 fi git fetch --all --quiet git add -A "./$(git rev-parse --show-cdup)" if ! git diff --cached --quiet; then git status --short git commit -m "git-sync on ${HOSTNAME}" fi #git merge --ff-only if ! git merge --quiet --no-edit; then git merge --abort exit 1 fi git push --quiet