Skip to content

Keeping gh pages fresh

Richard Schneider edited this page Sep 25, 2016 · 5 revisions

As per github requirements, the project's web site is on the gh-pages branch. One issue we have is that the cards.css and cards.min are needed by the web site and thus must be in two branches. How do we keep the gh-pages branch in-sync with master?

As Nicolas Gallagher has blogged, we can use git checkout to copy a file from one branch to another.

# Assuming current branch is gh-pages
git checkout master -- cards.css
git checkout master -- cards.js
git commit -m "Update cardsJS from master"

Update

I'm finding this workflow very annoying because testing usually involves running the demo HTMLs.

I've decided to just mirror master in gh-pages; see Lea Verou's blog on syncing with master for more details.

git checkout gh-pages
git rebase master
git push origin gh-pages
git checkout master

Now if only I can find a cloud service that detects a change to master and runs the above script!

Clone this wiki locally