I have a simple static website, based on HTML 5 boilerplate and the whole thing is in a github repository. The project structure is something like this
build
css
img
js
publish # this directory isn't in source control!
...
index.html & other files
Basically what I do is run a build script (from HTML 5 boilerplate) that compiles all the HTML/CSS/JS into the publish
directory, which isn't in the git repository.
Now what I want to do, is make use of GitHub pages and be able to use the publish
directory output as a GitHub page.
The way GitHub pages work, is that you create a clean separate branch named gh-pages
, which will contain the final content. What I want to do, is to be able to on demand commit the current publish
directory into the gh-pages
branch, but I also want to keep it in the main .gitignore
file so it won't get pushed into the source repository.
I want to do this to kinda preview the current state of the project.
in short: I need to commit one directory to a separate branch, so it's root will be the same as contents of that one directory. publish/css
will become just css
on the gh-pages
branch
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…