将本地主*推入github上的gh-pages分支 [英] push local master *into* gh-pages branch on github

查看:188
本文介绍了将本地主*推入github上的gh-pages分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在github和我的本地仓库上创建了一个简单的gh-pages分支。我使用自动页面生成器来创建它使用的5个文件:
images javascripts stylesheets index.html params.json



我把它拖到本地仓库,将js-markdown-extra.js添加到javascripts中,并编辑index.html以用由markdown库创建的已编译的README.md替换content部分。



放入一个模拟的README.md显示它完美地工作。



然后只需将我的本地主推入而不是修改5个网站文件。



我没有找到方法做这个。我被告知通过 http://oli.jp/2011/github-pages-workflow/,这将工作︰git push -f origin master:gh-pages



我在一个测试回购上试了这个,结果失败了,导致404本地gh-pages为降价技巧所做的修正)



所以 有一种方法可以将主推入 ,作为gh页面的一个子集?



如果没有删除5个网站文件,是否有一种简单的方法可以将主文件合并到gh页面中?

我知道如何镜像所有这些东西,所以5个文件将在回购站中,但我想避免这种混乱。

方案

据我所知,你必须切换到你本地的gh-pages副本。在master中合并,然后按gh-pages

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


I created a simple gh-pages branch on github and in my local repo. I used the auto page generator to create the 5 files it uses: images javascripts stylesheets index.html params.json

I pulled this to my local repo and added js-markdown-extra.js to javascripts, and edited index.html to replace the "content" section with the compiled README.md created by the markdown library.

Putting in a dummy README.md showed it to work perfectly.

I want to then simply push my local master into (not onto) the remote gh-pages branch, without modifying the 5 website files.

I haven't found a way to do this. I was told via http://oli.jp/2011/github-pages-workflow/ that this would work: git push -f origin master:gh-pages

I tried this on a test repo and it failed, resulting in a 404 (pushing the local gh-pages made for the markdown trick fixed that)

So is there a way to push master into, as a subset of, gh-pages?

Failing that, is there a simple way to merge the master into gh-pages locally without deleting the 5 website files?

I know how to "mirror" all this stuff so the 5 files would be in the repo but I'd like to avoid that clutter.

解决方案

From what I understand, you'd have to switch to your local copy of gh-pages. Merge in master, and then push gh-pages

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

这篇关于将本地主*推入github上的gh-pages分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆