Skip to content

Instantly share code, notes, and snippets.

@kbychkov
Last active November 18, 2023 15:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbychkov/91e6db409ea10068ffaa3e1d8ac264b8 to your computer and use it in GitHub Desktop.
Save kbychkov/91e6db409ea10068ffaa3e1d8ac264b8 to your computer and use it in GitHub Desktop.
Working with gh-pages as an orphan branch
# Create `gh-pages` branch from scratch
cd <dir>
git init
git remote add origin <url>
git checkout --orphan gh-pages
git add .
git commit -m "build 1.0.0"
git push origin gh-pages
# Clone remote `gh-pages` branch
git clone -b gh-pages --single-branch <url> <dir>
# Update `gh-pages` branch from existing folder
cd <dir>
git init
git remote add origin <url>
git fetch origin gh-pages
git reset origin/gh-pages
git checkout gh-pages
git add .
git commit -m "build 1.x.x"
git push origin gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment