Skip to content

Instantly share code, notes, and snippets.

@QWxleA
Created January 31, 2017 20:01
Show Gist options
  • Save QWxleA/412d0b7fb737afcf61cc8c8d42545942 to your computer and use it in GitHub Desktop.
Save QWxleA/412d0b7fb737afcf61cc8c8d42545942 to your computer and use it in GitHub Desktop.
Create an orphan gh-pages directory in master
#!/usr/bin/env bash
#
# Run this in a repo checked out from github
#create gh-pages branch
git checkout --orphan gh-pages
git reset
echo "My new site" >> index.html
git add index.html
git commit --allow-empty -m "Initial commit gh-pages"
git push --set-upstream origin gh-pages
#in master create a linked checkout to gh-pages
git checkout --force master
git worktree add _export gh-pages
#disable jekyll and add _export to gitignore
touch .nojekyll
echo "_export" >> .gitignore
git add .
git commit -am "preparing for _export in a git worktree"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment