I need to create a clean branch that does not reflect the commits of the master branch. This branch will be used to make project information available on Github through gh-pages and will never be used to merge with the master branch.
I need to create a clean branch that does not reflect the commits of the master branch. This branch will be used to make project information available on Github through gh-pages and will never be used to merge with the master branch.
First create an orphan branch:
git checkout --orphan gh-pages
Now remove all files from this branch:
git rm -rf .
git clean -fdx
Add some file, for example README.md
:
touch README.md
git add .
git commit "chore(app): initial commit"
Now just push the server:
git push origin gh-pages
Check out the master and look at the existing branches:
git checkout master
git branch
This feature is very useful for branches whose purpose is documentation or project preview.