Skip to content

Instantly share code, notes, and snippets.

@frasertweedale
Last active January 6, 2016 05:28
Show Gist options
  • Save frasertweedale/c80df04bce621d10d6dc to your computer and use it in GitHub Desktop.
Save frasertweedale/c80df04bce621d10d6dc to your computer and use it in GitHub Desktop.
git: commit hakyll compiled site to gh-pages branch
export GIT_INDEX_FILE=$PWD/.git/index-deploy
export GIT_WORK_TREE=$PWD/_site
REF=refs/heads/gh-pages
git read-tree "$REF"
git add --all --intent-to-add
git diff --quiet && exit
git add --all
TREE=$(git write-tree)
COMMIT=$(git commit-tree "$TREE" -p "$REF" -m "snapshot $(date '+%y-%m-%d %H:%M')")
git update-ref "$REF" "$COMMIT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment