从master分支构建成gh-pages分支 [英] Build into gh-pages branch from master branch

查看:139
本文介绍了从master分支构建成gh-pages分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是:
我正在使用github。
我有两个分支。主页和gh页面。
我的主分支上有一个unity3d项目。当我运行它时,它会生成一个网页。
我想在gh-pages分支上显示网页的内容。



我想这意味着我必须在我的两个分支之间共享一个文件夹库。
这似乎几乎是不可能的。



有没有正确的方法来做到这一点?我目前的解决方案是制作两个github项目,从第一个到第二个。然后,我查看第二个gh页面。这似乎非常...无关。我应该可以在一个项目中完成这项工作。

>在第一个存储库的工作目录结构中。所以在本地,你有这个文件夹结构:

 项目
| - .git /
| - 。 gitignore
| - (其他项目相关文件)
| - deploy /
| - .git /
| - (已部署文件)

项目和部署是克隆你的项目的存储库; deploy 已检出 gh-pages 分支。外部的 .gitignore 显然列出了 deploy / ,所以项目会忽略该文件夹。



现在,在部署时,您将所有文件发布到deploy文件夹,然后cd进入它,执行 git add。 git commit git push ,并且生成的文件被部署到。



显然这不会给你一个你的主和gh-pages分支之间的实际关系,但两者将在同一个存储库中完全独立于彼此。


What I want to do: I am using github. I have two branches. Master and gh-pages. I have a unity3d project on my master branch. When I run it, it will generate a webpage. I want to display the contents of the webpage on the gh-pages branch.

I assume this means I have to share a folder between two branches of my repository. That seems nearly impossible.

Is there a right way to do this? My current solution is making two github projects and building from the first into the second. Then, I view the gh-page for the second. That seems very... extraneous. I should be able to do this all with one project.

解决方案

You can just clone your repository again within your working directory structure of the first repository. So locally, you have this folder structure:

project
|- .git/
|- .gitignore
|- (other project related files)
|- deploy/
   |- .git/
   |- (deployed files)

Both project and deploy are cloned repositories of your project; deploy has the gh-pages branch checked out. The outer .gitignore obviously lists deploy/, so the folder is ignored for the project.

Now, when deploying, you publish all the files into the deploy folder, then cd into it, do a git add ., git commit, git push and the generated files are deployed.

Obviously this will not give you an actual relation between your master and the gh-pages branch, but both will live completely independent of each other in the same repository.

这篇关于从master分支构建成gh-pages分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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