Skip to content

Instantly share code, notes, and snippets.

@anistark
Last active August 29, 2015 14:04
Show Gist options
  • Save anistark/f59a99c05db41666a537 to your computer and use it in GitHub Desktop.
Save anistark/f59a99c05db41666a537 to your computer and use it in GitHub Desktop.
Github Pages
To get started with gh-pages, you should know what gh-pages is first. If you know, proceed here..
Supposing you already have a git repo open on your terminal with the default branch, master
To switch to a new branch, gh-pages:
git checkout --orphan gh-pages
--orphan creates a branch gh-pages with no parent.
Now you would wanna remove all files from the old working tree:
git rm -rf .
Now, you are in gh-pages branch and you have an empty repo.
Create a file, say index.html
Write a few html codes in it. And then push it:
git push origin gh-pages
Now, you're page would be displayed on [yourusername].github.io/reponame
In case you might wanna switch back to your master branch:
git checkout master
Deleting a local branch
git branch -D <branchname>
Deleting from remote branch
git push origin --delete <branchname>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment