Skip to content

Instantly share code, notes, and snippets.

@bonndan
Last active August 6, 2016 20:26
Show Gist options
  • Save bonndan/42cecfc5c5f4936321ce to your computer and use it in GitHub Desktop.
Save bonndan/42cecfc5c5f4936321ce to your computer and use it in GitHub Desktop.
gh-pages post commit hook
#!/bin/sh
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "gh-pages" == "$branch" ]; then
exit
fi
echo Updating gh-pages for branch $branch
git checkout gh-pages
git checkout $branch -- dist
mkdir -p $branch
git rm --ignore-unmatch -rf $branch
mv -f dist/* $branch
git rm -rf --ignore-unmatch dist
git add $branch
git describe --always | git commit -m -
git checkout $branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment