It is not easily done (beside doing some git filter-branch magic)
If you have a look at "Configuring a publishing source for GitHub Pages", you should instead generate your site directly in the gh-pages branch.
Or, you can stay in master branch, but generate in a docs/ folder instead of dist.
In both cases, GitHub pages will render that content.
However, for a User Page:
If your site is a User or Organization Page that has a repository named <username>.github.io or <orgname>.github.io, you cannot publish your site's source files from different locations.
User and Organization Pages that have this type of repository name are only published from the master branch.
In that case, reverse your workflow:
- develop your site on a
dev branch,
- generate your site on the
master branch
When you are in your dev branch, you can declare the master branch as a submodule (see here for the procedure), which will therefore be visible as a "subfolder" (for example a "dist" subfolder, except that subfolder will actually be your same Git repo, on master)
Generate your site as usual (in dist), go in dist, add, commit and push (that subfolder being a submodule, it will push on its associated branch: master)
Then go back to your project repo folder (parent of dist, currently on the dev branch), add, commit and push (to record the new state of the submodule dist)