有没有办法在github中使用pre / post commit钩子来更新master的gh-pages分支? [英] Is there a way to use a pre/post commit hook in github to update gh-pages branch from master?
问题描述
我有一个完全静态的网站(例如 https://github.com/robertjchristian/angular -enterprise-seed ),它主持于 github ,我主要从事主分支。 / app /目录的内容是我想要托管的字节对于字节。所以在开发过程中,我只需cd〜/ projects / angular-enterprise-seed / app,然后选择python -m SimpleHTTPServer。这允许我在本地浏览本地localhost:8000。
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.
我想在网络上托管/ app的静态内容,而gh-pages是理想的人选。以下是我的要求:
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:
- 不希望仅将gh-pages分支作为主人
- 不希望依赖包装脚本来保持gh页面与来自客户端的主更改一致。
- 不想构建一个服务来处理webhook文章,从master签出并签入gh-pages。
- 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.
理想情况下,它将是一个github钩子,它表示Post commit hook - 同步gh页面与主变更
Ideally it would be a github hook that says "Post commit hook - sync gh-pages with change in master"
有什么想法?
谢谢。
推荐答案
阅读 a 品种 of 解决方案,以处理同步之间的主和gh页,我最终采用受到JavaScript大师青睐的 Sindre Sorhus 及其他人:
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:
- 使gh-pages分支成为GitHub上的默认分支
- 删除master分支
- 使用
gh-pages
branch as master。
- Make the gh-pages branch the default one on GitHub
- Delete the master branch
- Use the
gh-pages
branch as master.
你可以在Sindre的屏幕ful.js回购,或者在我的项目中选择菜单。
You can see this on GitHub in Sindre's screenful.js repo, or in my project, selection-menu.
这篇关于有没有办法在github中使用pre / post commit钩子来更新master的gh-pages分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!