I deployed a repo to GitHub pages and it was created a new branch (gh-pages).
But on my machine, when I push changes to origin, it only goes to the master branch, and I have to, manually, add the updated content to gh-pages.
How can I add the gh-pages branch to my local machine so that I can push the changes automatically to GitHub pages?
You can create a branch by using git branch
:
$ git branch gh-pages
And then check out to it:
$ git checkout gh-pages
or use the -b
flag to perform both operations together:
$ git checkout -b gh-pages
Once you've done that, you can perform changes and commit them, and then use the branch name when pushing:
$ git push origin gh-pages