#!/bin/bash
set +e
from="$1"
to="$2"

if [ -z "$to" ]; then
	echo "Use: gitbackup <src repo> <destination directory>"
fi

if [ ! -d "$to" ]; then
	git clone "$from" "$to"
else
	pushd "$to" > /dev/null
	git fetch
	git pull
	popd > /dev/null
fi

