#!bin/bash/ -e


if git status --porcelain 2>/dev/null | grep -q .; then
  echo "Working copy is dirty" >&2
  exit 1
fi

source generate_site.sh

git checkout gh-pages
cp -rf site/* .
rm -rf site
git add .
git commit -m "Automatic gh-pages commit"
git push origin gh-pages
git checkout master
