To summarize your context:
- your current branch is
master
- you have a
dist/
folder that is ignored and untracked
- it contains the sources of a website that can be statically served
- you'd like to publish this
dist/
folder on GitHub Pages using a gh-pages
branch.
The simplest way to do this seems to follow the workflow suggested in this gist
as well as in the documentation of Yeoman.
But note that this relies on the advanced command git subtree and requires that the dist/
folder is not ignored and tracked on master
as well.
You could then follow the doc regarding the configuration of GH Pages' publishing source.
Does this address your question or do you really want to have the two branches separated and no dist/*
file in the master
branch?
In the latter case, the problem is more complicated (because of the untracked or ignored files in the work tree that can hinder the process...) but you may want to have a look at this project, which is an alternative to the git subtree
-based solution, and is based on a Bash script.
(Note: I have not tested this "git-directory-deploy" solution; it was suggested in the gist I mentioned above.)