For pages on github.io, it is common to use a branch called gh-pages
on the main repository to publish a website associated with a particular repository.
In my current project, I perform the following steps to update my documentation which is hosted on github.io.
- Build API documentation on the main branch using Doxygen.
- Move the
html
directory to a temporary directory. - Checkout the
gh-pages
branch. - Copy the contents of the temporary directory to the project directory.
git commit
andgit push
thegh-pages
branch.- Checkout
master
branch again.
Is it possible to commit the contents of the html
directory to the gh-pages
branch in a single step?
Note that I prefer not to add the contents of the html
directory to the master
branch because it is generated content rather than source.
I have already looked at this question and this question but they do not appear to solve this problem.
This is not actually a duplicate of this question because this question concerns whole-tree replacement rather than adding a single file, and I believe the former operation can be done in a cleaner way than the latter.