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.
The command suggested git push -f origin master:gh-pages will push your local master branch to the gh-pages branch.
On the upload page, you can drag-and-drop files and folders and they will be added to the repo. Go to the root directory of your Startup website code, select everything, then drag it to the page. It is better to use drag-and-drop than to use the choose your files link to select files from your computer.
app, change directory back to the parent folder, setup a "gh-pages" subfolder for your "gh-pages" branch and change directory into it. Clone your "grandmaster" repository into the "gh-pages" folder (this will clone in the "master" branch), checkout the "gh-pages" branch, list the files (should have "index. html" and ".
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.
This is similar to the Jekyll workflow. Say unity3d content is generated into a folder called foo
. Add foo
to .gitignore
then do this
git checkout master
<run unity3d>
git checkout gh-pages
git rm -qr .
cp -r foo/. .
rm -r foo
git add
git commit
Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With