More recent versions of git have an alternative to the git symbolic-ref method that Chandru explained. This avoids having to use the lower level commands.
git checkout --orphan gh-pages
git rm -rf .
Answer from Arrowmaster on Stack OverflowMore recent versions of git have an alternative to the git symbolic-ref method that Chandru explained. This avoids having to use the lower level commands.
git checkout --orphan gh-pages
git rm -rf .
You might find this tutorial useful:
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
To me this approach seems simpler then doing a git checkout gh-pages each time you want to edit your gh-pages content. Let me know what you think ^_^
Edit: I updated the tutorial link - thanks @Cawas. The old tutorial (not recommended) was https://gist.github.com/825950
gh-pages branch
github - Can I make the gh-pages branch of my git repository a mirror of the Master branch? - Stack Overflow
PSA: If you're using gh-pages to host your CI-generated documentation, make sure you don't store any history for that branch
My gh pages code and master code are not the same. Help
Videos
Github pages like to publish from a separate branch called gh-pages.
Am I meant to keep the documentation for my project in a separate branch permanently? I've never used git that way.
Why not keep it in a sub-directory of the master branch?
» npm install gh-pages