问题
I have a completely static site (eg. https://github.com/robertjchristian/angular-enterprise-seed) hosted on github, where I work mostly out of the master branch. The contents of the /app/ directory are byte-for-byte what I want to host. So during development I just cd ~/projects/angular-enterprise-seed/app, and then "python -m SimpleHTTPServer". This allows me to browse the site locally at localhost:8000.
I want to host the static contents of /app on the web as well, and gh-pages is the ideal candidate. Here are my requirements:
- Don't want to "just use gh-pages branch as master"
- Don't want to rely on a wrapper script that keeps gh-pages in line with master changes from the client.
- Don't want to build out a service to handle the webhook post, checkout from master, and check into gh-pages.
Ideally it would be a github hook that says "Post commit hook - sync gh-pages with change in master"
Any ideas?
Thanks.
回答1:
After reading through a variety of different solutions for handling the sync between master and gh-pages, I ended up adopting an approached favored by JavaScript guru Sindre Sorhus and others:
- Make the gh-pages branch the default one on GitHub
- Delete the master branch
- Use the
gh-pages
branch as master.
You can see this on GitHub in Sindre's screenful.js repo, or in my project, selection-menu.
来源:https://stackoverflow.com/questions/15285324/is-there-a-way-to-use-a-pre-post-commit-hook-in-github-to-update-gh-pages-branch