I created a simple gh-pages branch on github and in my local repo. I used the auto page generator to create the 5 files it uses: images javascripts stylesheets index.h
From what I understand, you'd have to switch to your local copy of gh-pages. Merge in master, and then push gh-pages
git checkout gh-pages
git merge master
git push origin gh-pages
If I understand you correctly it seems that you created the dummy Readme and the other files on your local master branch but intended to have them on the gh-pages branch. If thats the case, the safest option is to merge your master branch into the gh-pages branch (assuming you dont have other files on master you would rather not have on the gh-pages branch). The command suggested git push -f origin master:gh-pages
will push your local master branch to the gh-pages branch. I'm not really sure what you mean but into vs onto, as branch names are just pointers in git.
as an alternative approach, how about using a git subtree to serve as your gh-pages
branch?
git checkout master
git subtree push --prefix . origin gh-pages
according to the git-subtree docs on the source code:
Subtrees allow subprojects to be included within a subdirectory of the main project, optionally including the subproject's entire history.
in our case, we may be able to alias the same path (the root path; .
) as a virtual copy of the master branch (i have not tested it, though).
by the way, i found out about subtrees after encountering this gist, by cobyism.
Here is a good writeup github pages workflow that I used to understand how to interact between the master and gh-pages branches.
paul irish from google recommended it in the comments of another article- it had super clear examples.