Skip to content

Instantly share code, notes, and snippets.

@AndersDJohnson
Last active June 5, 2019 13:35
Show Gist options
  • Save AndersDJohnson/5942821 to your computer and use it in GitHub Desktop.
Save AndersDJohnson/5942821 to your computer and use it in GitHub Desktop.
For GitHub Pages, copy a subtree to root of gh-pages branch.
#!/bin/bash
DIR=dist
parent_sha=$(git show-ref -s refs/heads/gh-pages)
doc_sha=$(git ls-tree -d HEAD "$DIR" | awk '{print $3}')
new_commit=$(echo "Auto-update docs." | git commit-tree $doc_sha -p $parent_sha)
git update-ref refs/heads/gh-pages $new_commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment