Skip to content

Instantly share code, notes, and snippets.

@evanmoran

evanmoran/fast-gh-pages

Last active Dec 12, 2015
Embed
What would you like to do?
Create github pages in a natural way by making gh-pages a submodule of master
# Create gh-pages branch
git checkout --orphan gh-pages
# Remove all files from the old working tree
git clean -fdx
# Create initial index.html file
echo "My github page" > index.html
# Turn off jekyll
echo "true" > .nojekyll
# Commit the new branch
git add .
git commit -a -m "Initial commit"
git push origin gh-pages
# Create submodule to gh-branch
git checkout master
git submodule add -b gh-pages git@github.com:username/project.git www
git status
git commit -m "Adding submodule to gh-pages"
git push
# If Something goes wrong here is how to delete a repository:
# 1. Delete the relevant section from the .gitmodules file
# 2. Delete the relevant section from .git/config.
# 3. Run git rm --cached path_to_submodule (no trailing slash).
# 4. Commit
# 5. Delete the now untracked submodule files
# 6. rm -rf path_to_submodule
@gnzlbg

This comment has been minimized.

Copy link

@gnzlbg gnzlbg commented Jan 24, 2014

git submodule add -b gh-pages git@github.com:username/project.git www
this seems to copy the whole repository into www and then switch to the branch gh-pages.. does this scale?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.