Reputation: 1028
My master branch is accessible by {USERNAME}.github.io. Let's say I make a new branch named "mobile" and make some new commits on the web interface. How to do I view the new mobile branch, locally, without merging it into master?
Upvotes: 18
Views: 7146
Reputation: 653
One option might be to fork your primary repo to a secondary one (call it beta.yourdomain.com) and then build there and test on the beta domain, before pull-requesting the final version back into your master repo.
TL;DR - don't use a branch, use a forked repo and a subdomain to preview the build :)
Upvotes: 3
Reputation: 798
I had to grapple with this too and ended up with the following. My branching strategy is that I release from a release/version-number branch. Once a new release is cut, I merge it to master and create the next release branch based off that. The master branch always contains the latest /docs content, which happens to be javadocs. I then advise the reader that if he wishes to see an older version of the javadoc to clone the repository locally, checkout the branch of interest, and load docs/index.html in the browser.
Upvotes: 0
Reputation: 137070
GitHub Pages are built on top of Jekyll, which you can also install and run locally. The short version is:
Install the version of Jekyll that GitHub uses by creating a Gemfile
that contains
source 'https://rubygems.org'
gem 'github-pages'
and running bundle install
Once that is done you can run Jekyll locally in a way that matches GitHub's setup for Pages:
Running Jekyll
To run Jekyll in a way that matches the GitHub Pages build server, run Jekyll with Bundler. Use the command
bundle exec jekyll serve
in the root of your repository (after switching to thegh-pages
branch for project repositories), and your site should be available athttp://localhost:4000
. For a full list of Jekyll commands, see the Jekyll documentation.
I believe you'll want to do this from your mobile
branch.
Upvotes: 7