This is the process given to create a branch for GitHub Project Pages:
cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html
git add .
git commit -a -m "First pages commit"
git push origin gh-pages
It states that git symbolic-ref HEAD refs/heads/gh-pages will create a new root branch. I’m wondering what the difference between a root branch and a regular branch is.
A “root branch” is one without a previous history. *
If you are at master and you do
git branch gh-pages, gh-pages will be basedd off master.Here, the intention is to create a branch for github pages, which is typically not associated with the history of your repo (master and other branches) and hence the usage of
git symbolic-refAlso see here: https://stackoverflow.com/a/8815361/526535
*It is also called an orphan branch andgit checkout --orphanwill now do the same thing as thegit symbolic-refthat was being done beforeAlso see my answer here: https://stackoverflow.com/a/5690048/526535