This blog post is a really short one.
Recently I wanted GitHub to serve my Helm chart via GitHub pages. So far so good, but I had already committed to the main branch. And I wanted a clean branch for my Helm repository.
But with a little Git magic it is possible to get a clean branch. Let me show you, what I did:
Checkout an orphan gh-pages branch
An orphan branch has no parents, means no git history when it is created. The history of the orphan branch is separate from other branches in the repository.
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "fresh and empty gh-pages branch"
git push origin gh-pages
Activate GitHub Pages
After pushing the branch to GitHub, we can head over to the Settings page
of the repository and select in the GitHub Pages
section the gh-pages
branch as source.
You should be able to access it via https://your-username.github.io/<repository-name>/