Skip to content

Instantly share code, notes, and snippets.

@phyng
Created January 26, 2017 15:22
Show Gist options
  • Save phyng/b449c759f1e530dbd075fdd2ad65a261 to your computer and use it in GitHub Desktop.
Save phyng/b449c759f1e530dbd075fdd2ad65a261 to your computer and use it in GitHub Desktop.
Deploying a subfolder to GitHub Pages
# subfolder: dist
# ref: https://gist.github.com/cobyism/4730490
# save the last commit id
old_commit=$(git log -1 --pretty=format:"%h")
# force add dist and commit
git add dist -f && git commit -m "build: build prod"
# force push subtree
git push origin `git subtree split --prefix dist master`:gh-pages --force
# reset to old_commit
git reset "${old_commit}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment